dax-device: Make remove callback return void
authorUwe Kleine-König <uwe@kleine-koenig.org>
Fri, 5 Feb 2021 22:28:42 +0000 (23:28 +0100)
committerDan Williams <dan.j.williams@intel.com>
Wed, 17 Feb 2021 03:45:13 +0000 (19:45 -0800)
The driver core ignores the return value of struct bus_type::remove()
because there is only little that can be done. To simplify the quest to
make this function return void, let struct dax_device_driver::remove()
return void, too. All users already unconditionally return 0, this commit
makes it obvious that returning an error code isn't intended.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Link: https://lore.kernel.org/r/20210205222842.34896-6-uwe@kleine-koenig.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/dax/bus.c
drivers/dax/bus.h
drivers/dax/kmem.c

index d2419e88073ac9c4763510815bda3dde2ae0c458..452e85ae87a836611056720c5dcebb9938bdf612 100644 (file)
@@ -178,12 +178,11 @@ static int dax_bus_remove(struct device *dev)
 {
        struct dax_device_driver *dax_drv = to_dax_drv(dev->driver);
        struct dev_dax *dev_dax = to_dev_dax(dev);
-       int ret = 0;
 
        if (dax_drv->remove)
-               ret = dax_drv->remove(dev_dax);
+               dax_drv->remove(dev_dax);
 
-       return ret;
+       return 0;
 }
 
 static struct bus_type dax_bus_type = {
index 72b92f95509f7ece65ab7e7b22dfb66915e019c0..1e946ad7780a82b40f6ccdc472429c41005ee960 100644 (file)
@@ -39,7 +39,7 @@ struct dax_device_driver {
        struct list_head ids;
        int match_always;
        int (*probe)(struct dev_dax *dev);
-       int (*remove)(struct dev_dax *dev);
+       void (*remove)(struct dev_dax *dev);
 };
 
 int __dax_driver_register(struct dax_device_driver *dax_drv,
index 403ec42472d1d9ff9480e2db0b3a12ee03fc4004..ac231cc3635959ad7a92a9e59e91a0c19300ed4b 100644 (file)
@@ -136,7 +136,7 @@ err_res_name:
 }
 
 #ifdef CONFIG_MEMORY_HOTREMOVE
-static int dev_dax_kmem_remove(struct dev_dax *dev_dax)
+static void dev_dax_kmem_remove(struct dev_dax *dev_dax)
 {
        int i, success = 0;
        struct device *dev = &dev_dax->dev;
@@ -176,11 +176,9 @@ static int dev_dax_kmem_remove(struct dev_dax *dev_dax)
                kfree(data);
                dev_set_drvdata(dev, NULL);
        }
-
-       return 0;
 }
 #else
-static int dev_dax_kmem_remove(struct dev_dax *dev_dax)
+static void dev_dax_kmem_remove(struct dev_dax *dev_dax)
 {
        /*
         * Without hotremove purposely leak the request_mem_region() for the
@@ -190,7 +188,6 @@ static int dev_dax_kmem_remove(struct dev_dax *dev_dax)
         * request_mem_region().
         */
        any_hotremove_failed = true;
-       return 0;
 }
 #endif /* CONFIG_MEMORY_HOTREMOVE */