From: Jiri Slaby <jirislaby@kernel.org>
To: Tony Lindgren <tony@atomide.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Andy Shevchenko" <andriy.shevchenko@intel.com>,
"Dhruva Gole" <d-gole@ti.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"John Ogness" <john.ogness@linutronix.de>,
"Johan Hovold" <johan@kernel.org>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
"Vignesh Raghavendra" <vigneshr@ti.com>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
"kernel test robot" <oliver.sang@intel.com>
Subject: Re: [PATCH] serial: core: Fix serial_base_match() after fixing controller port name
Date: Thu, 3 Aug 2023 07:13:33 +0200 [thread overview]
Message-ID: <496b56e1-1cc3-dfa3-d628-aeab62b9e60f@kernel.org> (raw)
In-Reply-To: <20230802114846.21899-1-tony@atomide.com>
On 02. 08. 23, 13:48, Tony Lindgren wrote:
> While fixing DEVNAME to be more usable, I broke serial_base_match() as
> the ctrl and port prefix for device seemed unnecessary.
It's not completely clear to me what you are actually fixing. Please
elaborate in more detail.
> Let's fix the issue by checking against dev->type and drv->name.
>
> Fixes: 1ef2c2df1199 ("serial: core: Fix serial core controller port name to show controller id")
> Reported-by: kernel test robot <oliver.sang@intel.com>
Then we are missing a Link here.
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
> drivers/tty/serial/serial_base.h | 3 +++
> drivers/tty/serial/serial_base_bus.c | 10 ++++++++--
> drivers/tty/serial/serial_ctrl.c | 2 +-
> drivers/tty/serial/serial_port.c | 2 +-
> 4 files changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/tty/serial/serial_base.h b/drivers/tty/serial/serial_base.h
> --- a/drivers/tty/serial/serial_base.h
> +++ b/drivers/tty/serial/serial_base.h
> @@ -6,6 +6,9 @@
> * Author: Tony Lindgren <tony@atomide.com>
> */
>
> +#define SERIAL_BASE_CTRL_NAME "ctrl"
> +#define SERIAL_BASE_PORT_NAME "port"
Could you make those char[] instead? The compiler/linker will hopefully
(will it?) de-dup the occurrences, but the arrays would look cleaner and
safer from this POV.
> #define to_serial_base_ctrl_device(d) container_of((d), struct serial_ctrl_device, dev)
> #define to_serial_base_port_device(d) container_of((d), struct serial_port_device, dev)
>
> diff --git a/drivers/tty/serial/serial_base_bus.c b/drivers/tty/serial/serial_base_bus.c
> --- a/drivers/tty/serial/serial_base_bus.c
> +++ b/drivers/tty/serial/serial_base_bus.c
> @@ -29,9 +29,15 @@ static const struct device_type serial_port_type = {
>
> static int serial_base_match(struct device *dev, struct device_driver *drv)
> {
> - int len = strlen(drv->name);
> + if (dev->type == &serial_ctrl_type &&
> + !strncmp(SERIAL_BASE_CTRL_NAME, drv->name, 4))
> + return 1;
>
> - return !strncmp(dev_name(dev), drv->name, len);
> + if (dev->type == &serial_port_type &&
> + !strncmp(SERIAL_BASE_PORT_NAME, drv->name, 4))
> + return 1;
> +
> + return 0;
> }
>
> static struct bus_type serial_base_bus_type = {
> diff --git a/drivers/tty/serial/serial_ctrl.c b/drivers/tty/serial/serial_ctrl.c
> --- a/drivers/tty/serial/serial_ctrl.c
> +++ b/drivers/tty/serial/serial_ctrl.c
> @@ -47,7 +47,7 @@ void serial_ctrl_unregister_port(struct uart_driver *drv, struct uart_port *port
> }
>
> static struct device_driver serial_ctrl_driver = {
> - .name = "ctrl",
> + .name = SERIAL_BASE_CTRL_NAME,
> .suppress_bind_attrs = true,
> .probe = serial_ctrl_probe,
> .remove = serial_ctrl_remove,
> diff --git a/drivers/tty/serial/serial_port.c b/drivers/tty/serial/serial_port.c
> --- a/drivers/tty/serial/serial_port.c
> +++ b/drivers/tty/serial/serial_port.c
> @@ -83,7 +83,7 @@ void uart_remove_one_port(struct uart_driver *drv, struct uart_port *port)
> EXPORT_SYMBOL(uart_remove_one_port);
>
> static struct device_driver serial_port_driver = {
> - .name = "port",
> + .name = SERIAL_BASE_PORT_NAME,
> .suppress_bind_attrs = true,
> .probe = serial_port_probe,
> .remove = serial_port_remove,
--
js
suse labs
next prev parent reply other threads:[~2023-08-03 5:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-02 11:48 [PATCH] serial: core: Fix serial_base_match() after fixing controller port name Tony Lindgren
2023-08-02 13:48 ` Greg Kroah-Hartman
2023-08-02 21:44 ` Andy Shevchenko
2023-08-02 18:32 ` Mark Brown
2023-08-03 5:13 ` Jiri Slaby [this message]
2023-08-03 6:56 ` Tony Lindgren
2023-08-03 7:00 ` Anders Roxell
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=496b56e1-1cc3-dfa3-d628-aeab62b9e60f@kernel.org \
--to=jirislaby@kernel.org \
--cc=andriy.shevchenko@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bigeasy@linutronix.de \
--cc=d-gole@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=johan@kernel.org \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=oliver.sang@intel.com \
--cc=tony@atomide.com \
--cc=vigneshr@ti.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 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).