2019-06-03 15:53:51

by Suzuki K Poulose

[permalink] [raw]
Subject: [RFC PATCH 37/57] drivers: s390: zcrypt: Use class_find_device_by_devt helper

Use the generic helper to find a device matching the devt.

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

diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
index 16cad8e..99c9b77 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 devt value for find_zcdndev_by_devt() */
-static int __match_zcdn_devt(struct device *dev, const void *data)
-{
- return dev->devt == *((dev_t *) data);
-}
-
/*
* Find zcdn device by name.
* Returns reference to the zcdn device which needs to be released
@@ -159,10 +153,7 @@ static inline struct zcdn_device *find_zcdndev_by_name(const char *name)
*/
static inline struct zcdn_device *find_zcdndev_by_devt(dev_t devt)
{
- struct device *dev =
- class_find_device(zcrypt_class, NULL,
- (void *) &devt,
- __match_zcdn_devt);
+ struct device *dev = class_find_device_by_devt(zcrypt_class, NULL, devt);

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


2019-06-04 06:52:29

by Harald Freudenberger

[permalink] [raw]
Subject: Re: [RFC PATCH 37/57] drivers: s390: zcrypt: Use class_find_device_by_devt helper

On 03.06.19 17:50, Suzuki K Poulose wrote:
> Use the generic helper to find a device matching the devt.
>
> Cc: Harald Freudenberger <[email protected]>
> Cc: Heiko Carstens <[email protected]>
> Signed-off-by: Suzuki K Poulose <[email protected]>
> ---
> drivers/s390/crypto/zcrypt_api.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
> index 16cad8e..99c9b77 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 devt value for find_zcdndev_by_devt() */
> -static int __match_zcdn_devt(struct device *dev, const void *data)
> -{
> - return dev->devt == *((dev_t *) data);
> -}
> -
> /*
> * Find zcdn device by name.
> * Returns reference to the zcdn device which needs to be released
> @@ -159,10 +153,7 @@ static inline struct zcdn_device *find_zcdndev_by_name(const char *name)
> */
> static inline struct zcdn_device *find_zcdndev_by_devt(dev_t devt)
> {
> - struct device *dev =
> - class_find_device(zcrypt_class, NULL,
> - (void *) &devt,
> - __match_zcdn_devt);
> + struct device *dev = class_find_device_by_devt(zcrypt_class, NULL, devt);
>
> return dev ? to_zcdn_dev(dev) : NULL;
> }
fine with me, thanks
acked-by: Harald Freudenberger <[email protected]>