[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZBF2Pyd4VSZq3HoA@kroah.com>
Date: Wed, 15 Mar 2023 08:39:43 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Sherry Sun <sherry.sun@....com>
Cc: jirislaby@...nel.org, robh@...nel.org,
linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-imx@....com
Subject: Re: [PATCH] tty: serdev: serdev-ttyport: set correct tty->dev for
serdev framework
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@....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
Powered by blists - more mailing lists