Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/scm: Make struct scm_driver::remove return void

The driver core ignores the return value of scmdev_remove()
(because there is only little it can do when a device disappears).

So make it impossible for future drivers to return an unused error code
by changing the remove prototype to return void.

The real motivation for this change is the quest to make struct
bus_type::remove return void, too.

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20210713193522.1770306-5-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Uwe Kleine-König and committed by
Greg Kroah-Hartman
15f83bb0 7a47c521

+6 -5
+1 -1
arch/s390/include/asm/eadm.h
··· 105 105 struct scm_driver { 106 106 struct device_driver drv; 107 107 int (*probe) (struct scm_device *scmdev); 108 - int (*remove) (struct scm_device *scmdev); 108 + void (*remove) (struct scm_device *scmdev); 109 109 void (*notify) (struct scm_device *scmdev, enum scm_event event); 110 110 void (*handler) (struct scm_device *scmdev, void *data, 111 111 blk_status_t error);
+1 -3
drivers/s390/block/scm_drv.c
··· 60 60 return ret; 61 61 } 62 62 63 - static int scm_remove(struct scm_device *scmdev) 63 + static void scm_remove(struct scm_device *scmdev) 64 64 { 65 65 struct scm_blk_dev *bdev = dev_get_drvdata(&scmdev->dev); 66 66 67 67 scm_blk_dev_cleanup(bdev); 68 68 dev_set_drvdata(&scmdev->dev, NULL); 69 69 kfree(bdev); 70 - 71 - return 0; 72 70 } 73 71 74 72 static struct scm_driver scm_drv = {
+4 -1
drivers/s390/cio/scm.c
··· 33 33 struct scm_device *scmdev = to_scm_dev(dev); 34 34 struct scm_driver *scmdrv = to_scm_drv(dev->driver); 35 35 36 - return scmdrv->remove ? scmdrv->remove(scmdev) : -ENODEV; 36 + if (scmdrv->remove) 37 + scmdrv->remove(scmdev); 38 + 39 + return 0; 37 40 } 38 41 39 42 static int scmdev_uevent(struct device *dev, struct kobj_uevent_env *env)