mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/6] driver: make struct bus_type::match optional
@ 2024-02-28 16:05 Ahmad Fatoum
  2024-02-28 16:05 ` [PATCH 2/6] driver: make struct bus_type::probe optional Ahmad Fatoum
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2024-02-28 16:05 UTC (permalink / raw)
  To: barebox; +Cc: mfe, Ahmad Fatoum

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




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-02-29  8:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-28 16:05 [PATCH 1/6] driver: make struct bus_type::match optional Ahmad Fatoum
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox