All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Sherry Sun <sherry.sun@nxp.com>
Cc: jirislaby@kernel.org, robh@kernel.org,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-imx@nxp.com
Subject: Re: [PATCH] tty: serdev: serdev-ttyport: set correct tty->dev for serdev framework
Date: Wed, 15 Mar 2023 08:39:43 +0100	[thread overview]
Message-ID: <ZBF2Pyd4VSZq3HoA@kroah.com> (raw)
In-Reply-To: <20230315072143.7815-1-sherry.sun@nxp.com>

On Wed, Mar 15, 2023 at 03:21:43PM +0800, Sherry Sun wrote:
> ttyport_open() calls tty_init_dev() to initialize a tty device, but
> tty_get_device() cannot get the correct tty->dev for serdev tty in
> alloc_tty_struct(), because serdev framework does not set tty_class, so
> class_find_device_by_devt(tty_class, devt) may always return NULL.
> 
> For serdev framework, we need to assign the correct ctrl->dev to
> tty->dev.
> 
> Fixes: bed35c6dfa6a ("serdev: add a tty port controller driver")
> Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
> ---
>  drivers/tty/serdev/serdev-ttyport.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/tty/serdev/serdev-ttyport.c b/drivers/tty/serdev/serdev-ttyport.c
> index d367803e2044..bba37ab90215 100644
> --- a/drivers/tty/serdev/serdev-ttyport.c
> +++ b/drivers/tty/serdev/serdev-ttyport.c
> @@ -112,6 +112,7 @@ static int ttyport_open(struct serdev_controller *ctrl)
>  	tty = tty_init_dev(serport->tty_drv, serport->tty_idx);
>  	if (IS_ERR(tty))
>  		return PTR_ERR(tty);
> +	tty->dev = &ctrl->dev;

What in-kernel driver needs this change?  How has it not been a problem
so far?

And why are you saving off a reference counted pointer without
incrementing the reference to the pointer?

thanks,

greg k-h

  reply	other threads:[~2023-03-15  7:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15  7:21 [PATCH] tty: serdev: serdev-ttyport: set correct tty->dev for serdev framework Sherry Sun
2023-03-15  7:39 ` Greg KH [this message]
2023-03-15  9:49   ` Sherry Sun
2023-03-15 11:33     ` Greg KH
2023-03-16  5:05       ` Sherry Sun

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=ZBF2Pyd4VSZq3HoA@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sherry.sun@nxp.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.