From: Tony Lindgren <tony@atomide.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.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: [PATCH v2 1/1] serial: core: Fix serial_base_match() after fixing controller port name
Date: Thu, 3 Aug 2023 10:10:32 +0300 [thread overview]
Message-ID: <20230803071034.25571-1-tony@atomide.com> (raw)
While fixing DEVNAME to be more usable, I broke serial_base_match() as the
ctrl and port prefix for device names seemed unnecessary.
The prefixes are still needed by serial_base_match() to probe the serial
base controller port, and serial tx is now broken.
Let's fix the issue by checking against dev->type and drv->name instead
of the prefixes that are no longer in the DEVNAME.
Fixes: 1ef2c2df1199 ("serial: core: Fix serial core controller port name to show controller id")
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202308021529.35b3ad6c-oliver.sang@intel.com
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
Changes since v1:
- Leave out magic numbers and use str_has_prefix() as suggested by Andy
and Greg
- Improve patch description and add a link for Closes tag as suggested
by Jiri
- Check the name against device_type name since we have it and leave
out the changes to try to define names in the header because of the
issues noted by Jiri
- Leave out Tested-by from Mark and Anders as the patch changed
---
drivers/tty/serial/serial_base_bus.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
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 &&
+ str_has_prefix(drv->name, serial_ctrl_type.name))
+ return 1;
- return !strncmp(dev_name(dev), drv->name, len);
+ if (dev->type == &serial_port_type &&
+ str_has_prefix(drv->name, serial_port_type.name))
+ return 1;
+
+ return 0;
}
static struct bus_type serial_base_bus_type = {
--
2.41.0
WARNING: multiple messages have this Message-ID (diff)
From: Biju Das <biju.das.jz@bp.renesas.com>
To: tony@atomide.com
Cc: andriy.shevchenko@intel.com, andriy.shevchenko@linux.intel.com,
bigeasy@linutronix.de, d-gole@ti.com, gregkh@linuxfoundation.org,
ilpo.jarvinen@linux.intel.com, jirislaby@kernel.org,
johan@kernel.org, john.ogness@linutronix.de,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
oliver.sang@intel.com, vigneshr@ti.com,
linux-renesas-soc@vger.kernel.org,
Biju Das <biju.das.jz@bp.renesas.com>
Subject: [PATCH v2 1/1] serial: core: Fix serial_base_match() after fixing controller port name
Date: Thu, 3 Aug 2023 16:34:17 +0100 [thread overview]
Message-ID: <20230803071034.25571-1-tony@atomide.com> (raw) (raw)
Message-ID: <20230803153417.bfrD153QdpZS9x_l-zSwILb-jyjHb-MvZh0PK6rvjH0@z> (raw)
In-Reply-To: <20230803071034.25571-1-tony@atomide.com>
Hi,
> While fixing DEVNAME to be more usable, I broke serial_base_match() as the
> ctrl and port prefix for device names seemed unnecessary.
> The prefixes are still needed by serial_base_match() to probe the serial
> base controller port, and serial tx is now broken.
> Let's fix the issue by checking against dev->type and drv->name instead
> of the prefixes that are no longer in the DEVNAME.
> Fixes: 1ef2c2df1199 ("serial: core: Fix serial core controller port name to show controller id")
> Reported-by: kernel test robot <oliver.sang@intel.com>
> Closes: https://lore.kernel.org/oe-lkp/202308021529.35b3ad6c-oliver.sang@intel.com
> Signed-off-by: Tony Lindgren <tony@atomide.com>
This patch fixes the boot issue on RZ/G2L SMARC EVK since yesterday.
Tested-by: Biju Das <biju.das.jz@bp.renesas.com>
next reply other threads:[~2023-08-03 7:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-03 7:10 Tony Lindgren [this message]
2023-08-03 7:26 ` [PATCH v2 1/1] serial: core: Fix serial_base_match() after fixing controller port name Jiri Slaby
2023-08-03 7:50 ` Greg Kroah-Hartman
2023-08-03 8:52 ` Conor Dooley
2023-08-03 15:34 ` Biju Das
2023-08-04 21:42 ` Guenter Roeck
2023-08-05 4:49 ` Tony Lindgren
2023-08-05 10:50 ` Guenter Roeck
2023-08-05 11:48 ` Tony Lindgren
2023-08-05 15:50 ` Guenter Roeck
2023-08-05 16:12 ` Guenter Roeck
2023-08-06 4:33 ` Tony Lindgren
2023-08-06 6:23 ` Tony Lindgren
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=20230803071034.25571-1-tony@atomide.com \
--to=tony@atomide.com \
--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=jirislaby@kernel.org \
--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=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