From: Jiri Slaby Date: Wed, 14 Jul 2021 09:13:08 +0000 (+0200) Subject: amiserial: simplify rs_open X-Git-Tag: v5.15-rc1~153^2~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ec3114ec78026b132eba2c7f4b1d582fad82047;p=thirdparty%2Flinux.git amiserial: simplify rs_open 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 Link: https://lore.kernel.org/r/20210714091314.8292-5-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 0962b197e6760..68f8cee389ec7 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) {