[RFC PATCH 48/57] drivers: s390: cio: Use driver_find_by_name() helper

From: Suzuki K Poulose
Date: Mon Jun 03 2019 - 11:56:07 EST


Use the new driver_find_by_name() helper.

Cc: Peter Oberparleiter <oberpar@xxxxxxxxxxxxx>
Cc: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
Cc: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
---
drivers/s390/cio/ccwgroup.c | 10 +---------
drivers/s390/cio/device.c | 17 +----------------
2 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index c554f16..b1e24fb 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -606,13 +606,6 @@ void ccwgroup_driver_unregister(struct ccwgroup_driver *cdriver)
}
EXPORT_SYMBOL(ccwgroup_driver_unregister);

-static int __ccwgroupdev_check_busid(struct device *dev, const void *id)
-{
- char *bus_id = id;
-
- return (strcmp(bus_id, dev_name(dev)) == 0);
-}
-
/**
* get_ccwgroupdev_by_busid() - obtain device from a bus id
* @gdrv: driver the device is owned by
@@ -629,8 +622,7 @@ struct ccwgroup_device *get_ccwgroupdev_by_busid(struct ccwgroup_driver *gdrv,
{
struct device *dev;

- dev = driver_find_device(&gdrv->driver, NULL, bus_id,
- __ccwgroupdev_check_busid);
+ dev = driver_find_device_by_name(&gdrv->driver, NULL, bus_id);

return dev ? to_ccwgroupdev(dev) : NULL;
}
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index a5c2765..262e81c 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -1649,20 +1649,6 @@ int ccw_device_force_console(struct ccw_device *cdev)
EXPORT_SYMBOL_GPL(ccw_device_force_console);
#endif

-/*
- * get ccw_device matching the busid, but only if owned by cdrv
- */
-static int
-__ccwdev_check_busid(struct device *dev, const void *id)
-{
- char *bus_id;
-
- bus_id = id;
-
- return (strcmp(bus_id, dev_name(dev)) == 0);
-}
-
-
/**
* get_ccwdev_by_busid() - obtain device from a bus id
* @cdrv: driver the device is owned by
@@ -1679,8 +1665,7 @@ struct ccw_device *get_ccwdev_by_busid(struct ccw_driver *cdrv,
{
struct device *dev;

- dev = driver_find_device(&cdrv->driver, NULL, (void *)bus_id,
- __ccwdev_check_busid);
+ dev = driver_find_device_by_name(&cdrv->driver, NULL, bus_id);

return dev ? to_ccwdev(dev) : NULL;
}
--
2.7.4