From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: mfe@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/6] driver: make struct bus_type::match optional
Date: Wed, 28 Feb 2024 17:05:13 +0100 [thread overview]
Message-ID: <20240228160518.1589193-1-a.fatoum@pengutronix.de> (raw)
Newly introduce soc_bus_type doesn't define .match, which would crash
once a driver is registered on that bus. Do as Linux does and treat a
non-existent match callback as meaning that all drivers should be
matched and that the probe function should indicate via -ENODEV/-ENXIO
whether a device is indeed suitable.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/base/driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 3fac9c59f677..babc08f8b6b2 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -221,7 +221,7 @@ static int match(struct driver *drv, struct device *dev)
dev->driver = drv;
- if (dev->bus->match(dev, drv))
+ if (dev->bus->match && dev->bus->match(dev, drv))
goto err_out;
ret = device_probe(dev);
if (ret)
--
2.39.2
next reply other threads:[~2024-02-28 16:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 16:05 Ahmad Fatoum [this message]
2024-02-28 16:05 ` [PATCH 2/6] driver: make struct bus_type::probe optional Ahmad Fatoum
2024-02-28 16:05 ` [PATCH 3/6] treewide: remove bus probe functions that just call driver probe Ahmad Fatoum
2024-02-28 16:05 ` [PATCH 4/6] usb: otg: maintain list of USB OTG controllers Ahmad Fatoum
2024-02-28 16:05 ` [PATCH 5/6] usb: otg: turn global otg device into device alias Ahmad Fatoum
2024-02-28 16:05 ` [PATCH 6/6] usb: print number of skipped OTG controllers when scanning Ahmad Fatoum
2024-02-29 8:10 ` [PATCH 1/6] driver: make struct bus_type::match optional Sascha Hauer
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=20240228160518.1589193-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=mfe@pengutronix.de \
/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