Skip to contentSkip to conversation

bus: mhi: Use bus callbacks for .probe() and .remove()

PATCH Applied Uwe Kleine-König 2 participants 4 messages Dec 18, 2025 – Dec 31, 2025

Subsystems (2)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover bus: mhi: Use bus callbacks for .probe() and .remove()

Hello,

this series converts the two busses defined in drivers/bus/mhi to use bus methods for .probe() and .remove() instead of the respective callbacks of struct device_driver.

The eventual goal is that these callbacks are removed from struct device.

There is no intended functional change, the series is only build tested (on ARCH=x86 and ARCH=arm64).

Best regards
Uwe

Uwe Kleine-König (2):
bus: mhi: host: Use bus callbacks for .probe() and .remove()
bus: mhi: ep: Use bus callbacks for .probe() and .remove()

 drivers/bus/mhi/ep/main.c   | 12 +++++-------
 drivers/bus/mhi/host/init.c | 12 +++++-------
 2 files changed, 10 insertions(+), 14 deletions(-)

base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8

Signature · 1 line
2.47.3
#1 lore raw

PATCH 1/2 bus: mhi: host: Use bus callbacks for .probe() and .remove()

These are nearly identical to the driver callbacks, the only relevant difference is that the bus remove method returns void (instead of an int where the value is ignored).

The objective is to get rid of users of struct device_driver callbacks .probe(), and .remove() to eventually remove these.

---
 drivers/bus/mhi/host/init.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/bus/mhi/host/init.c +5 -7
index 099be8dd1900..8a0fe09d974a 100644
@@ -1265,7 +1265,7 @@ struct mhi_device *mhi_alloc_device(struct mhi_controller *mhi_cntrl)
 	return mhi_dev;
 }
 
-static int mhi_driver_probe(struct device *dev)
+static int mhi_probe(struct device *dev)
 {
 	struct mhi_device *mhi_dev = to_mhi_device(dev);
 	struct mhi_controller *mhi_cntrl = mhi_dev->mhi_cntrl;
@@ -1341,7 +1341,7 @@ static int mhi_driver_probe(struct device *dev)
 	return ret;
 }
 
-static int mhi_driver_remove(struct device *dev)
+static void mhi_remove(struct device *dev)
 {
 	struct mhi_device *mhi_dev = to_mhi_device(dev);
 	struct mhi_driver *mhi_drv = to_mhi_driver(dev->driver);
@@ -1355,7 +1355,7 @@ static int mhi_driver_remove(struct device *dev)
 
 	/* Skip if it is a controller device */
 	if (mhi_dev->dev_type == MHI_DEVICE_CONTROLLER)
-		return 0;
+		return;
 
 	/* Reset both channels */
 	for (dir = 0; dir < 2; dir++) {
@@ -1407,8 +1407,6 @@ static int mhi_driver_remove(struct device *dev)
 
 	while (mhi_dev->dev_wake)
 		mhi_device_put(mhi_dev);
-
-	return 0;
 }
 
 int __mhi_driver_register(struct mhi_driver *mhi_drv, struct module *owner)
@@ -1420,8 +1418,6 @@ int __mhi_driver_register(struct mhi_driver *mhi_drv, struct module *owner)
 
 	driver->bus = &mhi_bus_type;
 	driver->owner = owner;
-	driver->probe = mhi_driver_probe;
-	driver->remove = mhi_driver_remove;
 
 	return driver_register(driver);
 }
@@ -1468,6 +1464,8 @@ const struct bus_type mhi_bus_type = {
 	.dev_name = "mhi",
 	.match = mhi_match,
 	.uevent = mhi_uevent,
+	.probe = mhi_probe,
+	.remove = mhi_remove,
 	.dev_groups = mhi_dev_groups,
 };
 
Signature · 1 line
2.47.3
#2 lore raw

PATCH 2/2 bus: mhi: ep: Use bus callbacks for .probe() and .remove()

In reply to Uwe Kleine-König

These are nearly identical to the driver callbacks, the only relevant difference is that the bus remove method returns void (instead of an int where the value is ignored).

The objective is to get rid of users of struct device_driver callbacks .probe(), and .remove() to eventually remove these.

---
 drivers/bus/mhi/ep/main.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/bus/mhi/ep/main.c +5 -7
index 3c208b5c8446..35922e7a24c1 100644
@@ -1596,7 +1596,7 @@ void mhi_ep_unregister_controller(struct mhi_ep_cntrl *mhi_cntrl)
 }
 EXPORT_SYMBOL_GPL(mhi_ep_unregister_controller);
 
-static int mhi_ep_driver_probe(struct device *dev)
+static int mhi_ep_probe(struct device *dev)
 {
 	struct mhi_ep_device *mhi_dev = to_mhi_ep_device(dev);
 	struct mhi_ep_driver *mhi_drv = to_mhi_ep_driver(dev->driver);
@@ -1609,7 +1609,7 @@ static int mhi_ep_driver_probe(struct device *dev)
 	return mhi_drv->probe(mhi_dev, mhi_dev->id);
 }
 
-static int mhi_ep_driver_remove(struct device *dev)
+static void mhi_ep_remove(struct device *dev)
 {
 	struct mhi_ep_device *mhi_dev = to_mhi_ep_device(dev);
 	struct mhi_ep_driver *mhi_drv = to_mhi_ep_driver(dev->driver);
@@ -1619,7 +1619,7 @@ static int mhi_ep_driver_remove(struct device *dev)
 
 	/* Skip if it is a controller device */
 	if (mhi_dev->dev_type == MHI_DEVICE_CONTROLLER)
-		return 0;
+		return;
 
 	/* Disconnect the channels associated with the driver */
 	for (dir = 0; dir < 2; dir++) {
@@ -1643,8 +1643,6 @@ static int mhi_ep_driver_remove(struct device *dev)
 
 	/* Remove the client driver now */
 	mhi_drv->remove(mhi_dev);
-
-	return 0;
 }
 
 int __mhi_ep_driver_register(struct mhi_ep_driver *mhi_drv, struct module *owner)
@@ -1660,8 +1658,6 @@ int __mhi_ep_driver_register(struct mhi_ep_driver *mhi_drv, struct module *owner
 
 	driver->bus = &mhi_ep_bus_type;
 	driver->owner = owner;
-	driver->probe = mhi_ep_driver_probe;
-	driver->remove = mhi_ep_driver_remove;
 
 	return driver_register(driver);
 }
@@ -1708,6 +1704,8 @@ const struct bus_type mhi_ep_bus_type = {
 	.dev_name = "mhi_ep",
 	.match = mhi_ep_match,
 	.uevent = mhi_ep_uevent,
+	.probe = mhi_ep_probe,
+	.remove = mhi_ep_remove,
 };
 
 static int __init mhi_ep_init(void)
Signature · 1 line
2.47.3
#3 lore raw
In reply to Uwe Kleine-König
Quoted 8 lines · Uwe Kleine-König

this series converts the two busses defined in drivers/bus/mhi to use bus methods for .probe() and .remove() instead of the respective callbacks of struct device_driver.

The eventual goal is that these callbacks are removed from struct device.

[...]

Applied, thanks!

[1/2] bus: mhi: host: Use bus callbacks for .probe() and .remove()

      commit: 8535df5dd64ec02d85e65dbcf79a59db9c16d921
[2/2] bus: mhi: ep: Use bus callbacks for .probe() and .remove()
      commit: 91a0b0dce350766675961892ba4431363c4e29f7

Best regards,

Signature · 1 line
Manivannan Sadhasivam <[email protected]>