public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: Jiri Slaby <jirislaby@kernel.org>
Cc: Rob Herring <robh@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Johan Hovold <johan@kernel.org>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH 1/3] serdev: ttyport: make use of tty_kopen_exclusive
Date: Mon, 19 Aug 2024 14:23:56 +0200	[thread overview]
Message-ID: <20240819122356.rh2f6ldpauvxhgui@pengutronix.de> (raw)
In-Reply-To: <dc936358-a718-4f1c-a2a6-695bbae1d2ec@kernel.org>

On 24-08-19, Jiri Slaby wrote:
> On 19. 08. 24, 12:19, Marco Felsch wrote:
> > Hi,
> > 
> > sorry for not replying earlier.
> > 
> > On 24-08-08, Jiri Slaby wrote:
> > > On 07. 08. 24, 16:08, Marco Felsch wrote:
> > > > The purpose of serdev is to provide kernel drivers for particular serial
> > > > device, serdev-ttyport is no exception here. Make use of the
> > > > tty_kopen_exclusive() funciton to mark this tty device as kernel
> > > > internal device.
> > > > 
> > > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > > > ---
> > > >    drivers/tty/serdev/serdev-ttyport.c | 9 ++++++---
> > > >    1 file changed, 6 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/drivers/tty/serdev/serdev-ttyport.c b/drivers/tty/serdev/serdev-ttyport.c
> > > > index 3d7ae7fa5018..94c43d25ddbe 100644
> > > > --- a/drivers/tty/serdev/serdev-ttyport.c
> > > > +++ b/drivers/tty/serdev/serdev-ttyport.c
> > > > @@ -103,11 +103,14 @@ static int ttyport_write_room(struct serdev_controller *ctrl)
> > > >    static int ttyport_open(struct serdev_controller *ctrl)
> > > >    {
> > > >    	struct serport *serport = serdev_controller_get_drvdata(ctrl);
> > > > +	struct tty_driver *tty_drv = serport->tty_drv;
> > > >    	struct tty_struct *tty;
> > > >    	struct ktermios ktermios;
> > > > +	dev_t dev;
> > > >    	int ret;
> > > > -	tty = tty_init_dev(serport->tty_drv, serport->tty_idx);
> > > > +	dev = MKDEV(tty_drv->major, tty_drv->minor_start + serport->tty_idx);
> > > > +	tty = tty_kopen_exclusive(dev);
> > > 
> > > I believe that the now added tty_lookup_driver() has negligible impact in
> > > this anyway slow path, right?
> > 
> > Can you please elaborate a bit more? I don't see how the
> > tty_lookup_driver() is involved in the serdev-ctrl open path anyway.
> 
> It's called now in of tty_kopen_exclusive()->tty_kopen().
> (tty_lookup_driver() is the major difference between the raw tty_init_dev()
> and tty_kopen_exclusive().)

Okay now I get the "now added tty_lookup_driver()" statement, sorry.
Yes, I believe that this is negligible. The main difference for me was
that the tty_port_set_kopened() is set accordingly which which is
important to not trigger warnings during the release path.

Regards,
  Marco

> 
> -- 
> js
> suse labs
> 
> 

  reply	other threads:[~2024-08-19 12:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-07 14:08 [PATCH 0/3] USB-Serial serdev support Marco Felsch
2024-08-07 14:08 ` [PATCH 1/3] serdev: ttyport: make use of tty_kopen_exclusive Marco Felsch
2024-08-08  7:51   ` Jiri Slaby
2024-08-19 10:19     ` Marco Felsch
2024-08-19 10:42       ` Jiri Slaby
2024-08-19 12:23         ` Marco Felsch [this message]
2024-08-21  7:25     ` Marco Felsch
2024-08-07 14:08 ` [PATCH 2/3] USB: serial: cosmetic cleanup <space><tab> mix Marco Felsch
2024-08-07 14:08 ` [PATCH 3/3] USB: serial: enable serdev support Marco Felsch
2024-09-09 12:03 ` [PATCH 0/3] USB-Serial " Johan Hovold
2024-09-17  4:49   ` Marco Felsch
2025-03-11  8:12     ` Johan Hovold
2025-03-13 19:40       ` Marco Felsch
2025-08-21 16:40         ` Marco Felsch
2025-10-23 12:32         ` Johan Hovold
2025-10-23 13:48           ` Marco Felsch
2025-10-24  8:21             ` Johan Hovold
2025-10-24  9:27               ` Marco Felsch
2025-10-24 10:32                 ` Johan Hovold
2025-10-24 12:40                   ` Marco Felsch
2025-10-24 13:26                     ` Johan Hovold
2025-10-24 16:22                       ` Marco Felsch
2024-10-01  7:24 ` Marco Felsch
2024-10-01  7:29   ` Greg Kroah-Hartman
2024-10-01  7:47     ` Marco Felsch
2024-10-28 22:57     ` Marco Felsch
2025-03-03 11:25       ` Marco Felsch
2025-03-11  8:20       ` Johan Hovold

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=20240819122356.rh2f6ldpauvxhgui@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robh@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