From: Jiri Slaby <jslaby@suse.cz>
To: gregkh@linuxfoundation.org
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
Jiri Slaby <jslaby@suse.cz>
Subject: [PATCH 05/11] amiserial: simplify rs_open
Date: Wed, 14 Jul 2021 11:13:08 +0200 [thread overview]
Message-ID: <20210714091314.8292-5-jslaby@suse.cz> (raw)
In-Reply-To: <20210714091314.8292-1-jslaby@suse.cz>
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
next prev parent reply other threads:[~2021-07-14 9:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-14 9:13 [PATCH 01/11] amiserial: remove unused DBG_CNT Jiri Slaby
2021-07-14 9:13 ` [PATCH 02/11] amiserial: remove serial_* strings Jiri Slaby
2021-07-14 9:13 ` [PATCH 03/11] amiserial: remove stale comment Jiri Slaby
2021-07-14 9:13 ` [PATCH 04/11] amiserial: remove serial_state::xmit_fifo_size Jiri Slaby
2021-07-14 9:13 ` Jiri Slaby [this message]
2021-07-14 9:13 ` [PATCH 06/11] amiserial: use memset to zero serial_state Jiri Slaby
2021-07-14 9:13 ` [PATCH 07/11] amiserial: expand serial_isroot Jiri Slaby
2021-07-14 9:13 ` [PATCH 08/11] amiserial: expand "custom" Jiri Slaby
2021-07-14 9:13 ` [PATCH 09/11] amiserial: pack and sort includes Jiri Slaby
2021-07-14 9:13 ` [PATCH 10/11] amiserial: switch rs_table to a single state Jiri Slaby
2021-07-14 9:13 ` [PATCH 11/11] amiserial: remove unused state from shutdown Jiri Slaby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210714091314.8292-5-jslaby@suse.cz \
--to=jslaby@suse.cz \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).