powerpc/ps3: make system bus's remove and shutdown callbacks return void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 26 Nov 2020 16:59:50 +0000 (17:59 +0100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 3 Dec 2020 14:01:22 +0000 (01:01 +1100)
The driver core ignores the return value of struct device_driver::remove
because there is only little that can be done. For the shutdown callback
it's ps3_system_bus_shutdown() which ignores the return value.

To simplify the quest to make struct device_driver::remove return void,
let struct ps3_system_bus_driver::remove return void, too. All users
already unconditionally return 0, this commit makes it obvious that
returning an error code is a bad idea and ensures future users behave
accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201126165950.2554997-2-u.kleine-koenig@pengutronix.de
13 files changed:
arch/powerpc/include/asm/ps3.h
arch/powerpc/platforms/ps3/system-bus.c
drivers/block/ps3disk.c
drivers/block/ps3vram.c
drivers/char/ps3flash.c
drivers/net/ethernet/toshiba/ps3_gelic_net.c
drivers/ps3/ps3-lpm.c
drivers/ps3/ps3-vuart.c
drivers/scsi/ps3rom.c
drivers/usb/host/ehci-ps3.c
drivers/usb/host/ohci-ps3.c
drivers/video/fbdev/ps3fb.c
sound/ppc/snd_ps3.c

index cb89e4bf55ceff01a25e31973e2278869e3e76c9..e646c7f218bc8c2c2766ce02216fc634b9813e33 100644 (file)
@@ -378,8 +378,8 @@ struct ps3_system_bus_driver {
        enum ps3_match_sub_id match_sub_id;
        struct device_driver core;
        int (*probe)(struct ps3_system_bus_device *);
-       int (*remove)(struct ps3_system_bus_device *);
-       int (*shutdown)(struct ps3_system_bus_device *);
+       void (*remove)(struct ps3_system_bus_device *);
+       void (*shutdown)(struct ps3_system_bus_device *);
 /*     int (*suspend)(struct ps3_system_bus_device *, pm_message_t); */
 /*     int (*resume)(struct ps3_system_bus_device *); */
 };
index c62aaa29a9d5eef83605cc57e0cccf1617f19e2e..b431f41c6cb53abe2dd256c07e97c865903b51f1 100644 (file)
@@ -382,7 +382,6 @@ static int ps3_system_bus_probe(struct device *_dev)
 
 static int ps3_system_bus_remove(struct device *_dev)
 {
-       int result = 0;
        struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
        struct ps3_system_bus_driver *drv;
 
@@ -393,13 +392,13 @@ static int ps3_system_bus_remove(struct device *_dev)
        BUG_ON(!drv);
 
        if (drv->remove)
-               result = drv->remove(dev);
+               drv->remove(dev);
        else
                dev_dbg(&dev->core, "%s:%d %s: no remove method\n",
                        __func__, __LINE__, drv->core.name);
 
        pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev_name(&dev->core));
-       return result;
+       return 0;
 }
 
 static void ps3_system_bus_shutdown(struct device *_dev)
index 7b55811c2a81dbce602def925c6b814327199ed3..ba3ece56cbb33874f76d95f558a419d8334ffa79 100644 (file)
@@ -507,7 +507,7 @@ fail:
        return error;
 }
 
-static int ps3disk_remove(struct ps3_system_bus_device *_dev)
+static void ps3disk_remove(struct ps3_system_bus_device *_dev)
 {
        struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core);
        struct ps3disk_private *priv = ps3_system_bus_get_drvdata(&dev->sbd);
@@ -526,7 +526,6 @@ static int ps3disk_remove(struct ps3_system_bus_device *_dev)
        kfree(dev->bounce_buf);
        kfree(priv);
        ps3_system_bus_set_drvdata(_dev, NULL);
-       return 0;
 }
 
 static struct ps3_system_bus_driver ps3disk = {
index 1088798c8dd0c995db8a061c9b6b8a21236ea376..b71d28372ef3c8fe0d0ad8083adf4e96a5a197fc 100644 (file)
@@ -797,7 +797,7 @@ fail:
        return error;
 }
 
-static int ps3vram_remove(struct ps3_system_bus_device *dev)
+static void ps3vram_remove(struct ps3_system_bus_device *dev)
 {
        struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev);
 
@@ -817,7 +817,6 @@ static int ps3vram_remove(struct ps3_system_bus_device *dev)
        free_pages((unsigned long) priv->xdr_buf, get_order(XDR_BUF_SIZE));
        kfree(priv);
        ps3_system_bus_set_drvdata(dev, NULL);
-       return 0;
 }
 
 static struct ps3_system_bus_driver ps3vram = {
index 1a07fee33f663104ddcd000fa4379504de88fe0b..23871cde41fb625f5f6653a67df04f044978a9c3 100644 (file)
@@ -403,7 +403,7 @@ fail:
        return error;
 }
 
-static int ps3flash_remove(struct ps3_system_bus_device *_dev)
+static void ps3flash_remove(struct ps3_system_bus_device *_dev)
 {
        struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core);
 
@@ -413,7 +413,6 @@ static int ps3flash_remove(struct ps3_system_bus_device *_dev)
        kfree(ps3_system_bus_get_drvdata(&dev->sbd));
        ps3_system_bus_set_drvdata(&dev->sbd, NULL);
        ps3flash_dev = NULL;
-       return 0;
 }
 
 
index d9a5722f561b5bfa2329eb19872a5bd5d975e7a2..3d1fc8d2ca6679a15ee6a07a0700bd8224c3d87d 100644 (file)
@@ -1791,7 +1791,7 @@ fail_open:
  * ps3_gelic_driver_remove - remove a device from the control of this driver
  */
 
-static int ps3_gelic_driver_remove(struct ps3_system_bus_device *dev)
+static void ps3_gelic_driver_remove(struct ps3_system_bus_device *dev)
 {
        struct gelic_card *card = ps3_system_bus_get_drvdata(dev);
        struct net_device *netdev0;
@@ -1840,7 +1840,6 @@ static int ps3_gelic_driver_remove(struct ps3_system_bus_device *dev)
        ps3_close_hv_device(dev);
 
        pr_debug("%s: done\n", __func__);
-       return 0;
 }
 
 static struct ps3_system_bus_driver ps3_gelic_driver = {
index e54aa2d82f504464fe1af3d6b774a20ec5b67330..65512b6cc6fdcd2eaeabb0fdac41e676815f4e0e 100644 (file)
@@ -1196,7 +1196,7 @@ static int ps3_lpm_probe(struct ps3_system_bus_device *dev)
        return 0;
 }
 
-static int ps3_lpm_remove(struct ps3_system_bus_device *dev)
+static void ps3_lpm_remove(struct ps3_system_bus_device *dev)
 {
        dev_dbg(&dev->core, " -> %s:%u:\n", __func__, __LINE__);
 
@@ -1206,7 +1206,6 @@ static int ps3_lpm_remove(struct ps3_system_bus_device *dev)
        lpm_priv = NULL;
 
        dev_info(&dev->core, " <- %s:%u:\n", __func__, __LINE__);
-       return 0;
 }
 
 static struct ps3_system_bus_driver ps3_lpm_driver = {
index 4ed131eaff517456680fe8f653bd67ba85e4469e..e34ae6a442c7b1c83cbab4d730895bffb38c2762 100644 (file)
@@ -1102,7 +1102,7 @@ static int ps3_vuart_cleanup(struct ps3_system_bus_device *dev)
  * device can no longer be used.
  */
 
-static int ps3_vuart_remove(struct ps3_system_bus_device *dev)
+static void ps3_vuart_remove(struct ps3_system_bus_device *dev)
 {
        struct ps3_vuart_port_priv *priv = to_port_priv(dev);
        struct ps3_vuart_port_driver *drv;
@@ -1118,7 +1118,7 @@ static int ps3_vuart_remove(struct ps3_system_bus_device *dev)
                dev_dbg(&dev->core, "%s:%d: no driver bound\n", __func__,
                        __LINE__);
                mutex_unlock(&vuart_bus_priv.probe_mutex);
-               return 0;
+               return;
        }
 
        drv = ps3_system_bus_dev_to_vuart_drv(dev);
@@ -1141,7 +1141,6 @@ static int ps3_vuart_remove(struct ps3_system_bus_device *dev)
 
        dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__);
        mutex_unlock(&vuart_bus_priv.probe_mutex);
-       return 0;
 }
 
 /**
@@ -1154,7 +1153,7 @@ static int ps3_vuart_remove(struct ps3_system_bus_device *dev)
  * sequence.
  */
 
-static int ps3_vuart_shutdown(struct ps3_system_bus_device *dev)
+static void ps3_vuart_shutdown(struct ps3_system_bus_device *dev)
 {
        struct ps3_vuart_port_driver *drv;
 
@@ -1169,7 +1168,7 @@ static int ps3_vuart_shutdown(struct ps3_system_bus_device *dev)
                dev_dbg(&dev->core, "%s:%d: no driver bound\n", __func__,
                        __LINE__);
                mutex_unlock(&vuart_bus_priv.probe_mutex);
-               return 0;
+               return;
        }
 
        drv = ps3_system_bus_dev_to_vuart_drv(dev);
@@ -1193,7 +1192,6 @@ static int ps3_vuart_shutdown(struct ps3_system_bus_device *dev)
        dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__);
 
        mutex_unlock(&vuart_bus_priv.probe_mutex);
-       return 0;
 }
 
 static int __init ps3_vuart_bus_init(void)
index f75c0b5cd5871269b05166e7de2bda0916accbb0..ccb5771f1cb7147ca74b7bd655541ab9a6a57efc 100644 (file)
@@ -402,7 +402,7 @@ fail_free_bounce:
        return error;
 }
 
-static int ps3rom_remove(struct ps3_system_bus_device *_dev)
+static void ps3rom_remove(struct ps3_system_bus_device *_dev)
 {
        struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core);
        struct Scsi_Host *host = ps3_system_bus_get_drvdata(&dev->sbd);
@@ -412,7 +412,6 @@ static int ps3rom_remove(struct ps3_system_bus_device *_dev)
        scsi_host_put(host);
        ps3_system_bus_set_drvdata(&dev->sbd, NULL);
        kfree(dev->bounce_buf);
-       return 0;
 }
 
 static struct ps3_system_bus_driver ps3rom = {
index fb52133c3557fa40019bfe0efa07b3c3d275413f..98568b046a1a97339dea180cf72e0d44809ef0b6 100644 (file)
@@ -200,7 +200,7 @@ fail_start:
        return result;
 }
 
-static int ps3_ehci_remove(struct ps3_system_bus_device *dev)
+static void ps3_ehci_remove(struct ps3_system_bus_device *dev)
 {
        unsigned int tmp;
        struct usb_hcd *hcd = ps3_system_bus_get_drvdata(dev);
@@ -227,8 +227,6 @@ static int ps3_ehci_remove(struct ps3_system_bus_device *dev)
 
        ps3_dma_region_free(dev->d_region);
        ps3_close_hv_device(dev);
-
-       return 0;
 }
 
 static int __init ps3_ehci_driver_register(struct ps3_system_bus_driver *drv)
index f77cd6af0ccfc9335bab8d2379b05b6c390ae149..4f5af929c3e442ede3ab6b540111681c8cc2efa4 100644 (file)
@@ -184,7 +184,7 @@ fail_start:
        return result;
 }
 
-static int ps3_ohci_remove(struct ps3_system_bus_device *dev)
+static void ps3_ohci_remove(struct ps3_system_bus_device *dev)
 {
        unsigned int tmp;
        struct usb_hcd *hcd = ps3_system_bus_get_drvdata(dev);
@@ -212,8 +212,6 @@ static int ps3_ohci_remove(struct ps3_system_bus_device *dev)
 
        ps3_dma_region_free(dev->d_region);
        ps3_close_hv_device(dev);
-
-       return 0;
 }
 
 static int __init ps3_ohci_driver_register(struct ps3_system_bus_driver *drv)
index 203c254f8f6cbbb366fce6d34aacd3ff5f48d985..2fe08b67eda7138550a9246bcaa6583b34dafc7d 100644 (file)
@@ -1208,7 +1208,7 @@ err:
        return retval;
 }
 
-static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
+static void ps3fb_shutdown(struct ps3_system_bus_device *dev)
 {
        struct fb_info *info = ps3_system_bus_get_drvdata(dev);
        u64 xdr_lpar = ps3_mm_phys_to_lpar(__pa(ps3fb_videomemory.address));
@@ -1241,8 +1241,6 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
        lv1_gpu_memory_free(ps3fb.memory_handle);
        ps3_close_hv_device(dev);
        dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__);
-
-       return 0;
 }
 
 static struct ps3_system_bus_driver ps3fb_driver = {
index 6ab796a5d9363fe631a7b62fce4e2c4b8796c759..8e44fa5d4dc7e7ecd229d9091e004cc5f6bb8224 100644 (file)
@@ -1049,7 +1049,7 @@ clean_open:
 }; /* snd_ps3_probe */
 
 /* called when module removal */
-static int snd_ps3_driver_remove(struct ps3_system_bus_device *dev)
+static void snd_ps3_driver_remove(struct ps3_system_bus_device *dev)
 {
        int ret;
        pr_info("%s:start id=%d\n", __func__,  dev->match_id);
@@ -1075,7 +1075,6 @@ static int snd_ps3_driver_remove(struct ps3_system_bus_device *dev)
        lv1_gpu_device_unmap(2);
        ps3_close_hv_device(dev);
        pr_info("%s:end id=%d\n", __func__, dev->match_id);
-       return 0;
 } /* snd_ps3_remove */
 
 static struct ps3_system_bus_driver snd_ps3_bus_driver_info = {