Skip to contentSkip to conversation

vfio/mdev: Remove redundant driver match function

PATCH In review Lizhe 2 participants 2 messages Mar 19, 2023

Subsystems (3)
lore
Share & tools
lore

Lizhe

author
#0 lore raw

PATCH 1/1 vfio/mdev: Remove redundant driver match function

If there is no driver match function, the driver core assumes that each candidate pair (driver, device) matches, see driver_match_device().

Drop the bus's match function that always returned 1 and so implements the same behaviour as when there is no match function.

---
 drivers/vfio/mdev/mdev_driver.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/vfio/mdev/mdev_driver.c +0 -10
index 7825d83a55f8..fafa4416aad9 100644
@@ -31,20 +31,10 @@ static void mdev_remove(struct device *dev)
 		drv->remove(to_mdev_device(dev));
 }
 
-static int mdev_match(struct device *dev, struct device_driver *drv)
-{
-	/*
-	 * No drivers automatically match. Drivers are only bound by explicit
-	 * device_driver_attach()
-	 */
-	return 0;
-}
-
 struct bus_type mdev_bus_type = {
 	.name		= "mdev",
 	.probe		= mdev_probe,
 	.remove		= mdev_remove,
-	.match		= mdev_match,
 };
 
 /**
Signature · 1 line
2.34.1
#1 lore raw
Quoted 5 lines · On Sun, 19 Mar 2023 13:01:30 +0800 Lizhe <[email protected]> wrote:

If there is no driver match function, the driver core assumes that each candidate pair (driver, device) matches, see driver_match_device().

Drop the bus's match function that always returned 1 and so implements the same behaviour as when there is no match function.

The removed function returns 0, not 1, so this is replacing the functionality with something that does exactly the opposite of the current behavior. Please explain. Thanks,

Alex

Quoted 30 lines
---
 drivers/vfio/mdev/mdev_driver.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/vfio/mdev/mdev_driver.c +0 -10
index 7825d83a55f8..fafa4416aad9 100644
@@ -31,20 +31,10 @@ static void mdev_remove(struct device *dev)
 		drv->remove(to_mdev_device(dev));
 }
 
-static int mdev_match(struct device *dev, struct device_driver *drv)
-{
-	/*
-	 * No drivers automatically match. Drivers are only bound by explicit
-	 * device_driver_attach()
-	 */
-	return 0;
-}
-
 struct bus_type mdev_bus_type = {
 	.name		= "mdev",
 	.probe		= mdev_probe,
 	.remove		= mdev_remove,
-	.match		= mdev_match,
 };
 
 /**