]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bus: mhi: ep: Use bus callbacks for .probe() and .remove()
authorUwe Kleine-König <u.kleine-koenig@baylibre.com>
Thu, 18 Dec 2025 20:42:16 +0000 (21:42 +0100)
committerManivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Wed, 31 Dec 2025 10:57:13 +0000 (16:27 +0530)
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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/2a79d99182a5171e83a07bf9f438ae31362f7e5d.1766090211.git.ukleinek@kernel.org
drivers/bus/mhi/ep/main.c

index 3c208b5c844682c8929887710b8a48a2e02e5772..35922e7a24c156641c534ba878afdf2f45126420 100644 (file)
@@ -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)