History

Revert "serdev: BREAK/FRAME/PARITY/OVERRUN notification prototype V2"

This reverts commit d8e9a406a931f687945703a4bac45042eb81ce92. It needs some future changes as pointed out by Johan and is not ready to be merged just yet.

Greg Kroah-Hartman committed 4 years ago

Commit 99a507a1 parent 5acb78d3 files · +0 −82Browse files

Unified · Split

3 files
  1. drivers/tty/serdev/core.c +0 −11
  2. drivers/tty/serdev/serdev-ttyport.c +0 −49
  3. include/linux/serdev.h +0 −22
drivers/tty/serdev/core.c+0−11
@@ -349,17 +349,6 @@ unsigned int serdev_device_set_baudrate(struct serdev_device *serdev, unsigned i · 348 unmodified lines
349}349}
350EXPORT_SYMBOL_GPL(serdev_device_set_baudrate);350EXPORT_SYMBOL_GPL(serdev_device_set_baudrate);
351 351
352void serdev_device_set_error_mask(struct serdev_device *serdev, unsigned long mask)
353{
354 struct serdev_controller *ctrl = serdev->ctrl;
355
356 if (!ctrl || !ctrl->ops->set_error_mask)
357 return;
358
359 ctrl->ops->set_error_mask(ctrl, mask);
360}
361EXPORT_SYMBOL_GPL(serdev_device_set_error_mask);
362
363void serdev_device_set_flow_control(struct serdev_device *serdev, bool enable)352void serdev_device_set_flow_control(struct serdev_device *serdev, bool enable)
364{353{
365 struct serdev_controller *ctrl = serdev->ctrl;354 struct serdev_controller *ctrl = serdev->ctrl;
drivers/tty/serdev/serdev-ttyport.c+0−49
@@ -2,7 +2,6 @@ · 1 unmodified line
2/*2/*
3 * Copyright (C) 2016-2017 Linaro Ltd., Rob Herring <robh@kernel.org>3 * Copyright (C) 2016-2017 Linaro Ltd., Rob Herring <robh@kernel.org>
4 */4 */
5#include <linux/bits.h>
6#include <linux/kernel.h>5#include <linux/kernel.h>
7#include <linux/serdev.h>6#include <linux/serdev.h>
8#include <linux/tty.h>7#include <linux/tty.h>
@@ -10,10 +9,6 @@ · 1 unmodified line
10#include <linux/poll.h>9#include <linux/poll.h>
11 10
12#define SERPORT_ACTIVE 111#define SERPORT_ACTIVE 1
13#define SERPORT_NOTIFY_BREAK 2
14#define SERPORT_NOTIFY_FRAME 3
15#define SERPORT_NOTIFY_PARITY 4
16#define SERPORT_NOTIFY_OVERRUN 5
17 12
18struct serport {13struct serport {
19 struct tty_port *port;14 struct tty_port *port;
@@ -32,39 +27,11 @@ static int ttyport_receive_buf(struct tty_port *port, const unsigned char *cp, · 12 unmodified lines
32{27{
33 struct serdev_controller *ctrl = port->client_data;28 struct serdev_controller *ctrl = port->client_data;
34 struct serport *serport = serdev_controller_get_drvdata(ctrl);29 struct serport *serport = serdev_controller_get_drvdata(ctrl);
35 unsigned long errors = 0;
36 unsigned int i;
37 int ret;30 int ret;
38 31
39 if (!test_bit(SERPORT_ACTIVE, &serport->flags))32 if (!test_bit(SERPORT_ACTIVE, &serport->flags))
40 return 0;33 return 0;
41 34
42 for (i = 0; fp && i < count; i++) {
43 switch (fp[i]) {
44 case TTY_BREAK:
45 if (test_bit(SERPORT_NOTIFY_BREAK, &serport->flags))
46 __set_bit(SERDEV_ERROR_BREAK, &errors);
47 break;
48
49 case TTY_FRAME:
50 if (test_bit(SERPORT_NOTIFY_FRAME, &serport->flags))
51 __set_bit(SERDEV_ERROR_FRAME, &errors);
52 break;
53
54 case TTY_PARITY:
55 if (test_bit(SERPORT_NOTIFY_PARITY, &serport->flags))
56 __set_bit(SERDEV_ERROR_PARITY, &errors);
57 break;
58
59 case TTY_OVERRUN:
60 if (test_bit(SERPORT_NOTIFY_OVERRUN, &serport->flags))
61 __set_bit(SERDEV_ERROR_OVERRUN, &errors);
62 break;
63 }
64 }
65 if (errors)
66 serdev_controller_error(ctrl, errors);
67
68 ret = serdev_controller_receive_buf(ctrl, cp, count);35 ret = serdev_controller_receive_buf(ctrl, cp, count);
69 36
70 dev_WARN_ONCE(&ctrl->dev, ret < 0 || ret > count,37 dev_WARN_ONCE(&ctrl->dev, ret < 0 || ret > count,
@@ -213,21 +180,6 @@ static unsigned int ttyport_set_baudrate(struct serdev_controller *ctrl, unsigne · 142 unmodified lines
213 return ktermios.c_ospeed;180 return ktermios.c_ospeed;
214}181}
215 182
216static void ttyport_set_error_mask(struct serdev_controller *ctrl,
217 unsigned long m)
218{
219 struct serport *sp = serdev_controller_get_drvdata(ctrl);
220
221 assign_bit(SERPORT_NOTIFY_BREAK, &sp->flags,
222 m & BIT(SERDEV_ERROR_BREAK));
223 assign_bit(SERPORT_NOTIFY_FRAME, &sp->flags,
224 m & BIT(SERDEV_ERROR_FRAME));
225 assign_bit(SERPORT_NOTIFY_PARITY, &sp->flags,
226 m & BIT(SERDEV_ERROR_PARITY));
227 assign_bit(SERPORT_NOTIFY_OVERRUN, &sp->flags,
228 m & BIT(SERDEV_ERROR_OVERRUN));
229}
230
231static void ttyport_set_flow_control(struct serdev_controller *ctrl, bool enable)183static void ttyport_set_flow_control(struct serdev_controller *ctrl, bool enable)
232{184{
233 struct serport *serport = serdev_controller_get_drvdata(ctrl);185 struct serport *serport = serdev_controller_get_drvdata(ctrl);
@@ -301,7 +253,6 @@ static const struct serdev_controller_ops ctrl_ops = { · 67 unmodified lines
301 .write_room = ttyport_write_room,253 .write_room = ttyport_write_room,
302 .open = ttyport_open,254 .open = ttyport_open,
303 .close = ttyport_close,255 .close = ttyport_close,
304 .set_error_mask = ttyport_set_error_mask,
305 .set_flow_control = ttyport_set_flow_control,256 .set_flow_control = ttyport_set_flow_control,
306 .set_parity = ttyport_set_parity,257 .set_parity = ttyport_set_parity,
307 .set_baudrate = ttyport_set_baudrate,258 .set_baudrate = ttyport_set_baudrate,
include/linux/serdev.h+0−22
@@ -19,15 +19,12 @@ struct serdev_device; · 18 unmodified lines
19 19
20/**20/**
21 * struct serdev_device_ops - Callback operations for a serdev device21 * 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; must24 * @write_wakeup: Function called when ready to transmit more data; must
27 * not sleep.25 * not sleep.
28 */26 */
29struct serdev_device_ops {27struct 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 structures80 * 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
202static 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
215int serdev_device_open(struct serdev_device *);195int serdev_device_open(struct serdev_device *);
216void serdev_device_close(struct serdev_device *);196void serdev_device_close(struct serdev_device *);
217int devm_serdev_device_open(struct device *, struct serdev_device *);197int devm_serdev_device_open(struct device *, struct serdev_device *);
218unsigned int serdev_device_set_baudrate(struct serdev_device *, unsigned int);198unsigned int serdev_device_set_baudrate(struct serdev_device *, unsigned int);
219void serdev_device_set_error_mask(struct serdev_device *, unsigned long);
220void serdev_device_set_flow_control(struct serdev_device *, bool);199void serdev_device_set_flow_control(struct serdev_device *, bool);
221int serdev_device_write_buf(struct serdev_device *, const unsigned char *, size_t);200int serdev_device_write_buf(struct serdev_device *, const unsigned char *, size_t);
222void serdev_device_wait_until_sent(struct serdev_device *, long);201void 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}
262static inline void serdev_device_set_error_mask(struct serdev_device *sdev, unsigned long mask) {}
263static inline void serdev_device_set_flow_control(struct serdev_device *sdev, bool enable) {}241static inline void serdev_device_set_flow_control(struct serdev_device *sdev, bool enable) {}
264static inline int serdev_device_write_buf(struct serdev_device *serdev,242static inline int serdev_device_write_buf(struct serdev_device *serdev,
265 const unsigned char *buf,243 const unsigned char *buf,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t