lkml.org 
[lkml]   [2021]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 05/11] amiserial: simplify rs_open
Date
tty->port is already set when rs_open is called given we linked it by
tty_port_link_device(). If it wasn't, the tty layer would WARN loudly.
So it's pointless to set it in rs_open. Instead, use the value in
tty->port to find out the serial_state (info).

It's a fallout of commit b19e2ca77ee4 (TTY: use tty_port_link_device)
which added tty_port_link_device here, but omitted to remove the
tty->port assignment from rs_open.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/amiserial.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 0962b197e676..68f8cee389ec 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -1361,14 +1361,14 @@ static void rs_hangup(struct tty_struct *tty)
*/
static int rs_open(struct tty_struct *tty, struct file * filp)
{
- struct serial_state *info = rs_table + tty->index;
- struct tty_port *port = &info->tport;
+ struct tty_port *port = tty->port;
+ struct serial_state *info = container_of(port, struct serial_state,
+ tport);
int retval;

port->count++;
port->tty = tty;
tty->driver_data = info;
- tty->port = port;

retval = startup(tty, info);
if (retval) {
--
2.32.0
\
 
 \ /
  Last update: 2021-07-14 11:15    [W:0.246 / U:0.560 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site