2019-06-03 15:53:43

by Suzuki K Poulose

[permalink] [raw]
Subject: [RFC PATCH 32/57] drivers: s390-crypto: Use class_device_find_by_name() helper

Use the new class_find_device_by_name() helper.

Cc: Harald Freudenberger <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Heiko Carstens <[email protected]>
Signed-off-by: Suzuki K Poulose <[email protected]>
---
drivers/s390/crypto/zcrypt_api.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
index 1058b4b..16cad8e 100644
--- a/drivers/s390/crypto/zcrypt_api.c
+++ b/drivers/s390/crypto/zcrypt_api.c
@@ -133,12 +133,6 @@ struct zcdn_device {
static int zcdn_create(const char *name);
static int zcdn_destroy(const char *name);

-/* helper function, matches the name for find_zcdndev_by_name() */
-static int __match_zcdn_name(struct device *dev, const void *data)
-{
- return strcmp(dev_name(dev), (const char *)data) == 0;
-}
-
/* helper function, matches the devt value for find_zcdndev_by_devt() */
static int __match_zcdn_devt(struct device *dev, const void *data)
{
@@ -152,10 +146,8 @@ static int __match_zcdn_devt(struct device *dev, const void *data)
*/
static inline struct zcdn_device *find_zcdndev_by_name(const char *name)
{
- struct device *dev =
- class_find_device(zcrypt_class, NULL,
- (void *) name,
- __match_zcdn_name);
+ struct device *dev = class_find_device_by_name(zcrypt_class,
+ NULL, (void *) name);

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


2019-06-04 06:47:37

by Harald Freudenberger

[permalink] [raw]
Subject: Re: [RFC PATCH 32/57] drivers: s390-crypto: Use class_device_find_by_name() helper

On 03.06.19 17:49, Suzuki K Poulose wrote:
> Use the new class_find_device_by_name() helper.
>
> Cc: Harald Freudenberger <[email protected]>
> Cc: Martin Schwidefsky <[email protected]>
> Cc: Heiko Carstens <[email protected]>
> Signed-off-by: Suzuki K Poulose <[email protected]>
> ---
> drivers/s390/crypto/zcrypt_api.c | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
> index 1058b4b..16cad8e 100644
> --- a/drivers/s390/crypto/zcrypt_api.c
> +++ b/drivers/s390/crypto/zcrypt_api.c
> @@ -133,12 +133,6 @@ struct zcdn_device {
> static int zcdn_create(const char *name);
> static int zcdn_destroy(const char *name);
>
> -/* helper function, matches the name for find_zcdndev_by_name() */
> -static int __match_zcdn_name(struct device *dev, const void *data)
> -{
> - return strcmp(dev_name(dev), (const char *)data) == 0;
> -}
> -
> /* helper function, matches the devt value for find_zcdndev_by_devt() */
> static int __match_zcdn_devt(struct device *dev, const void *data)
> {
> @@ -152,10 +146,8 @@ static int __match_zcdn_devt(struct device *dev, const void *data)
> */
> static inline struct zcdn_device *find_zcdndev_by_name(const char *name)
> {
> - struct device *dev =
> - class_find_device(zcrypt_class, NULL,
> - (void *) name,
> - __match_zcdn_name);
> + struct device *dev = class_find_device_by_name(zcrypt_class,
> + NULL, (void *) name);
>
> return dev ? to_zcdn_dev(dev) : NULL;
> }
fine with me, thanks
acked-by: Harald Freudenberger <[email protected]>