staging: vc04_services: Implement vchiq_bus .remove
authorUmang Jain <umang.jain@ideasonboard.com>
Thu, 21 Mar 2024 13:07:36 +0000 (18:37 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Mar 2024 18:09:19 +0000 (19:09 +0100)
Implement the struct vchiq_bus .remove() so that cleanup
paths can be executed by the devices registered to this
bus, when being removed.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Link: https://lore.kernel.org/r/20240321130737.898154-5-umang.jain@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c

index 68f830d7553108facd16a3c0e33827cc4e83c028..93609716df8432dc585cfc0c09ed3e02ed2c714d 100644 (file)
@@ -37,11 +37,21 @@ static int vchiq_bus_probe(struct device *dev)
        return driver->probe(device);
 }
 
+static void vchiq_bus_remove(struct device *dev)
+{
+       struct vchiq_device *device = to_vchiq_device(dev);
+       struct vchiq_driver *driver = to_vchiq_driver(dev->driver);
+
+       if (driver->remove)
+               driver->remove(device);
+}
+
 const struct bus_type vchiq_bus_type = {
        .name   = "vchiq-bus",
        .match  = vchiq_bus_type_match,
        .uevent = vchiq_bus_uevent,
        .probe  = vchiq_bus_probe,
+       .remove = vchiq_bus_remove,
 };
 
 static void vchiq_device_release(struct device *dev)