提交 6cc7bda1 编写于 作者: J Jiri Slaby 提交者: Greg Kroah-Hartman

amiserial: switch rs_table to a single state

amiserial deals only with a single serial, so drop the rs_table array
and NR_PORTS and define a single non-array serial_state for simplicity
instead.
Signed-off-by: NJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210714091314.8292-10-jslaby@suse.czSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 f3d788b4
...@@ -97,9 +97,7 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info, ...@@ -97,9 +97,7 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info,
static void rs_wait_until_sent(struct tty_struct *tty, int timeout); static void rs_wait_until_sent(struct tty_struct *tty, int timeout);
static struct serial_state rs_table[1]; static struct serial_state serial_state;
#define NR_PORTS ARRAY_SIZE(rs_table)
/* some serial hardware definitions */ /* some serial hardware definitions */
#define SDR_OVRUN (1<<15) #define SDR_OVRUN (1<<15)
...@@ -1424,7 +1422,7 @@ static inline void line_info(struct seq_file *m, int line, ...@@ -1424,7 +1422,7 @@ static inline void line_info(struct seq_file *m, int line,
static int rs_proc_show(struct seq_file *m, void *v) static int rs_proc_show(struct seq_file *m, void *v)
{ {
seq_printf(m, "serinfo:1.0 driver:4.30\n"); seq_printf(m, "serinfo:1.0 driver:4.30\n");
line_info(m, 0, &rs_table[0]); line_info(m, 0, &serial_state);
return 0; return 0;
} }
...@@ -1494,11 +1492,11 @@ static const struct tty_port_operations amiga_port_ops = { ...@@ -1494,11 +1492,11 @@ static const struct tty_port_operations amiga_port_ops = {
*/ */
static int __init amiga_serial_probe(struct platform_device *pdev) static int __init amiga_serial_probe(struct platform_device *pdev)
{ {
struct serial_state *state = &serial_state;
unsigned long flags; unsigned long flags;
struct serial_state * state;
int error; int error;
serial_driver = alloc_tty_driver(NR_PORTS); serial_driver = alloc_tty_driver(1);
if (!serial_driver) if (!serial_driver)
return -ENOMEM; return -ENOMEM;
...@@ -1516,7 +1514,6 @@ static int __init amiga_serial_probe(struct platform_device *pdev) ...@@ -1516,7 +1514,6 @@ static int __init amiga_serial_probe(struct platform_device *pdev)
serial_driver->flags = TTY_DRIVER_REAL_RAW; serial_driver->flags = TTY_DRIVER_REAL_RAW;
tty_set_operations(serial_driver, &serial_ops); tty_set_operations(serial_driver, &serial_ops);
state = rs_table;
memset(state, 0, sizeof(*state)); memset(state, 0, sizeof(*state));
state->port = (int)&amiga_custom.serdatr; /* Just to give it a value */ state->port = (int)&amiga_custom.serdatr; /* Just to give it a value */
tty_port_init(&state->tport); tty_port_init(&state->tport);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册