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: add devt for ctrl->dev
Date: Wed, 15 Mar 2023 12:10:22 +0100 [thread overview]
Message-ID: <ZBGnniL7x5ENju6H@kroah.com> (raw)
In-Reply-To: <20230315105400.23426-1-sherry.sun@nxp.com>
On Wed, Mar 15, 2023 at 06:54:00PM +0800, Sherry Sun wrote:
> For serdev framework, the serdev_controller device is the tty device,
> which is also the child device of the uart_port device. If we don't set
> devt property for ctrl->dev, device_find_child(uport->dev, ...) may
> always return NULL in uart_suspend_port() function, which prevents us
> from properly handling uart port suspend, so fix it here.
>
> Fixes: bed35c6dfa6a ("serdev: add a tty port controller driver")
> Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
> ---
> drivers/tty/serdev/serdev-ttyport.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/tty/serdev/serdev-ttyport.c b/drivers/tty/serdev/serdev-ttyport.c
> index bba37ab90215..c58af8141380 100644
> --- a/drivers/tty/serdev/serdev-ttyport.c
> +++ b/drivers/tty/serdev/serdev-ttyport.c
> @@ -268,6 +268,7 @@ struct device *serdev_tty_port_register(struct tty_port *port,
> {
> struct serdev_controller *ctrl;
> struct serport *serport;
> + dev_t devt = MKDEV(drv->major, drv->minor_start) + idx;
> int ret;
>
> if (!port || !drv || !parent)
> @@ -282,6 +283,7 @@ struct device *serdev_tty_port_register(struct tty_port *port,
> serport->tty_idx = idx;
> serport->tty_drv = drv;
>
> + ctrl->dev.devt = devt;
This feels wrong as you can't just create a magic dev_t out of no where
and expect it to be handled properly. Where now is this dev_t exposed?
Something else feels wrong here, sorry, I do not think this is correct.
thanks,
greg k-h
next prev parent reply other threads:[~2023-03-15 11:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-15 10:54 [PATCH] tty: serdev: serdev-ttyport: add devt for ctrl->dev Sherry Sun
2023-03-15 11:10 ` Greg KH [this message]
2023-03-15 13:37 ` Sherry Sun
2023-03-20 5:55 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2023-03-15 19:12 kernel test robot
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=ZBGnniL7x5ENju6H@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.