From 86f0a011e548774fd8eb952f67bfeb19f3174dd0 Mon Sep 17 00:00:00 2001 From: Julian Wiedmann Date: Tue, 16 Mar 2021 10:45:12 +0100 Subject: s390/dasd: remove dasd_fba_probe() wrapper commit e03c5941f904 ("s390/dasd: Remove unused parameter from dasd_generic_probe()") allows us to wire the generic callback up directly, avoiding the additional level of indirection. While at it also remove the forward declaration for the dasd_fba_driver struct, it's no longer needed. Signed-off-by: Julian Wiedmann Reviewed-by: Jan Hoeppner Signed-off-by: Stefan Haberland Link: https://lore.kernel.org/r/20210316094513.2601218-2-sth@linux.ibm.com Signed-off-by: Jens Axboe --- drivers/s390/block/dasd_fba.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index 1aeb68794ce8..f76fe05b66c6 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c @@ -54,13 +54,6 @@ static struct ccw_device_id dasd_fba_ids[] = { MODULE_DEVICE_TABLE(ccw, dasd_fba_ids); -static struct ccw_driver dasd_fba_driver; /* see below */ -static int -dasd_fba_probe(struct ccw_device *cdev) -{ - return dasd_generic_probe(cdev); -} - static int dasd_fba_set_online(struct ccw_device *cdev) { @@ -73,7 +66,7 @@ static struct ccw_driver dasd_fba_driver = { .owner = THIS_MODULE, }, .ids = dasd_fba_ids, - .probe = dasd_fba_probe, + .probe = dasd_generic_probe, .remove = dasd_generic_remove, .set_offline = dasd_generic_set_offline, .set_online = dasd_fba_set_online, -- cgit v1.2.3 From 1987c55139c9ebe1bed48490c49cfe266cd35ac8 Mon Sep 17 00:00:00 2001 From: Julian Wiedmann Date: Tue, 16 Mar 2021 10:45:13 +0100 Subject: s390/dasd: let driver core manage the sysfs attributes Wire up device_driver->dev_groups, so that really_probe() creates the sysfs attributes for us automatically. Signed-off-by: Julian Wiedmann Reviewed-by: Jan Hoeppner Signed-off-by: Stefan Haberland Link: https://lore.kernel.org/r/20210316094513.2601218-3-sth@linux.ibm.com Signed-off-by: Jens Axboe --- drivers/s390/block/dasd.c | 17 ++--------------- drivers/s390/block/dasd_devmap.c | 15 ++------------- drivers/s390/block/dasd_eckd.c | 1 + drivers/s390/block/dasd_fba.c | 1 + drivers/s390/block/dasd_int.h | 3 +-- 5 files changed, 7 insertions(+), 30 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index ba9ce4e0d30a..a446f7c1ec68 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c @@ -3440,15 +3440,6 @@ static void dasd_generic_auto_online(void *data, async_cookie_t cookie) */ int dasd_generic_probe(struct ccw_device *cdev) { - int ret; - - ret = dasd_add_sysfs_files(cdev); - if (ret) { - DBF_EVENT_DEVID(DBF_WARNING, cdev, "%s", - "dasd_generic_probe: could not add " - "sysfs entries"); - return ret; - } cdev->handler = &dasd_int_handler; /* @@ -3489,15 +3480,13 @@ void dasd_generic_remove(struct ccw_device *cdev) struct dasd_block *block; device = dasd_device_from_cdev(cdev); - if (IS_ERR(device)) { - dasd_remove_sysfs_files(cdev); + if (IS_ERR(device)) return; - } + if (test_and_set_bit(DASD_FLAG_OFFLINE, &device->flags) && !test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { /* Already doing offline processing */ dasd_put_device(device); - dasd_remove_sysfs_files(cdev); return; } /* @@ -3516,8 +3505,6 @@ void dasd_generic_remove(struct ccw_device *cdev) */ if (block) dasd_free_block(block); - - dasd_remove_sysfs_files(cdev); } EXPORT_SYMBOL_GPL(dasd_generic_remove); diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 03d27ee9cac6..2c40fe15da55 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c @@ -1772,12 +1772,13 @@ static const struct attribute_group ext_pool_attr_group = { .attrs = ext_pool_attrs, }; -static const struct attribute_group *dasd_attr_groups[] = { +const struct attribute_group *dasd_dev_groups[] = { &dasd_attr_group, &capacity_attr_group, &ext_pool_attr_group, NULL, }; +EXPORT_SYMBOL_GPL(dasd_dev_groups); /* * Return value of the specified feature. @@ -1895,18 +1896,6 @@ void dasd_path_remove_kobjects(struct dasd_device *device) } EXPORT_SYMBOL(dasd_path_remove_kobjects); -int dasd_add_sysfs_files(struct ccw_device *cdev) -{ - return sysfs_create_groups(&cdev->dev.kobj, dasd_attr_groups); -} - -void -dasd_remove_sysfs_files(struct ccw_device *cdev) -{ - sysfs_remove_groups(&cdev->dev.kobj, dasd_attr_groups); -} - - int dasd_devmap_init(void) { diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 65eb87cbbb9b..a6ac505cbdd7 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c @@ -6630,6 +6630,7 @@ static struct ccw_driver dasd_eckd_driver = { .driver = { .name = "dasd-eckd", .owner = THIS_MODULE, + .dev_groups = dasd_dev_groups, }, .ids = dasd_eckd_ids, .probe = dasd_eckd_probe, diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index f76fe05b66c6..4789410885e4 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c @@ -64,6 +64,7 @@ static struct ccw_driver dasd_fba_driver = { .driver = { .name = "dasd-fba", .owner = THIS_MODULE, + .dev_groups = dasd_dev_groups, }, .ids = dasd_fba_ids, .probe = dasd_generic_probe, diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index b8a04c42d1d2..1c59b0e86a9f 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h @@ -854,8 +854,7 @@ void dasd_delete_device(struct dasd_device *); int dasd_get_feature(struct ccw_device *, int); int dasd_set_feature(struct ccw_device *, int, int); -int dasd_add_sysfs_files(struct ccw_device *); -void dasd_remove_sysfs_files(struct ccw_device *); +extern const struct attribute_group *dasd_dev_groups[]; void dasd_path_create_kobj(struct dasd_device *, int); void dasd_path_create_kobjects(struct dasd_device *); void dasd_path_remove_kobjects(struct dasd_device *); -- cgit v1.2.3