This reverts commit d8e9a406a931f687945703a4bac45042eb81ce92. It needs some future changes as pointed out by Johan and is not ready to be merged just yet.
Showing the changes to include (1 of 3 files). Show all
Unified · Split
| @@ -19,15 +19,12 @@ struct serdev_device; · 18 unmodified lines | |||
| 19 | 19 | ||
| 20 | /** | 20 | /** |
| 21 | * struct serdev_device_ops - Callback operations for a serdev device | 21 | * struct serdev_device_ops - Callback operations for a serdev device |
| 22 | * @error: Function called with errors received from device; | ||
| 23 | * may sleep. | ||
| 24 | * @receive_buf: Function called with data received from device; | 22 | * @receive_buf: Function called with data received from device; |
| 25 | * returns number of bytes accepted; may sleep. | 23 | * returns number of bytes accepted; may sleep. |
| 26 | * @write_wakeup: Function called when ready to transmit more data; must | 24 | * @write_wakeup: Function called when ready to transmit more data; must |
| 27 | * not sleep. | 25 | * not sleep. |
| 28 | */ | 26 | */ |
| 29 | struct serdev_device_ops { | 27 | struct serdev_device_ops { |
| 30 | void (*error)(struct serdev_device *, unsigned long); | ||
| 31 | int (*receive_buf)(struct serdev_device *, const unsigned char *, size_t); | 28 | int (*receive_buf)(struct serdev_device *, const unsigned char *, size_t); |
| 32 | void (*write_wakeup)(struct serdev_device *); | 29 | void (*write_wakeup)(struct serdev_device *); |
| 33 | }; | 30 | }; |
| @@ -79,11 +76,6 @@ enum serdev_parity { · 45 unmodified lines | |||
| 79 | SERDEV_PARITY_ODD, | 76 | SERDEV_PARITY_ODD, |
| 80 | }; | 77 | }; |
| 81 | 78 | ||
| 82 | #define SERDEV_ERROR_BREAK 0 | ||
| 83 | #define SERDEV_ERROR_FRAME 1 | ||
| 84 | #define SERDEV_ERROR_PARITY 2 | ||
| 85 | #define SERDEV_ERROR_OVERRUN 3 | ||
| 86 | |||
| 87 | /* | 79 | /* |
| 88 | * serdev controller structures | 80 | * serdev controller structures |
| 89 | */ | 81 | */ |
| @@ -93,7 +85,6 @@ struct serdev_controller_ops { · 3 unmodified lines | |||
| 93 | int (*write_room)(struct serdev_controller *); | 85 | int (*write_room)(struct serdev_controller *); |
| 94 | int (*open)(struct serdev_controller *); | 86 | int (*open)(struct serdev_controller *); |
| 95 | void (*close)(struct serdev_controller *); | 87 | void (*close)(struct serdev_controller *); |
| 96 | void (*set_error_mask)(struct serdev_controller *, unsigned long); | ||
| 97 | void (*set_flow_control)(struct serdev_controller *, bool); | 88 | void (*set_flow_control)(struct serdev_controller *, bool); |
| 98 | int (*set_parity)(struct serdev_controller *, enum serdev_parity); | 89 | int (*set_parity)(struct serdev_controller *, enum serdev_parity); |
| 99 | unsigned int (*set_baudrate)(struct serdev_controller *, unsigned int); | 90 | unsigned int (*set_baudrate)(struct serdev_controller *, unsigned int); |
| @@ -199,24 +190,12 @@ static inline int serdev_controller_receive_buf(struct serdev_controller *ctrl, · 99 unmodified lines | |||
| 199 | return serdev->ops->receive_buf(serdev, data, count); | 190 | return serdev->ops->receive_buf(serdev, data, count); |
| 200 | } | 191 | } |
| 201 | 192 | ||
| 202 | static inline void serdev_controller_error(struct serdev_controller *ctrl, | ||
| 203 | unsigned long errors) | ||
| 204 | { | ||
| 205 | struct serdev_device *serdev = ctrl->serdev; | ||
| 206 | |||
| 207 | if (!serdev || !serdev->ops->error) | ||
| 208 | return; | ||
| 209 | |||
| 210 | serdev->ops->error(serdev, errors); | ||
| 211 | } | ||
| 212 | |||
| 213 | #if IS_ENABLED(CONFIG_SERIAL_DEV_BUS) | 193 | #if IS_ENABLED(CONFIG_SERIAL_DEV_BUS) |
| 214 | 194 | ||
| 215 | int serdev_device_open(struct serdev_device *); | 195 | int serdev_device_open(struct serdev_device *); |
| 216 | void serdev_device_close(struct serdev_device *); | 196 | void serdev_device_close(struct serdev_device *); |
| 217 | int devm_serdev_device_open(struct device *, struct serdev_device *); | 197 | int devm_serdev_device_open(struct device *, struct serdev_device *); |
| 218 | unsigned int serdev_device_set_baudrate(struct serdev_device *, unsigned int); | 198 | unsigned int serdev_device_set_baudrate(struct serdev_device *, unsigned int); |
| 219 | void serdev_device_set_error_mask(struct serdev_device *, unsigned long); | ||
| 220 | void serdev_device_set_flow_control(struct serdev_device *, bool); | 199 | void serdev_device_set_flow_control(struct serdev_device *, bool); |
| 221 | int serdev_device_write_buf(struct serdev_device *, const unsigned char *, size_t); | 200 | int serdev_device_write_buf(struct serdev_device *, const unsigned char *, size_t); |
| 222 | void serdev_device_wait_until_sent(struct serdev_device *, long); | 201 | void serdev_device_wait_until_sent(struct serdev_device *, long); |
| @@ -259,7 +238,6 @@ static inline unsigned int serdev_device_set_baudrate(struct serdev_device *sdev · 36 unmodified lines | |||
| 259 | { | 238 | { |
| 260 | return 0; | 239 | return 0; |
| 261 | } | 240 | } |
| 262 | static inline void serdev_device_set_error_mask(struct serdev_device *sdev, unsigned long mask) {} | ||
| 263 | static inline void serdev_device_set_flow_control(struct serdev_device *sdev, bool enable) {} | 241 | static inline void serdev_device_set_flow_control(struct serdev_device *sdev, bool enable) {} |
| 264 | static inline int serdev_device_write_buf(struct serdev_device *serdev, | 242 | static inline int serdev_device_write_buf(struct serdev_device *serdev, |
| 265 | const unsigned char *buf, | 243 | const unsigned char *buf, |