* [PATCH] nvmem: core: Deduplicate bus_find_device() by name matching
@ 2017-11-25 11:31 Lukas Wunner
2017-11-25 14:47 ` Srinivas Kandagatla
0 siblings, 1 reply; 2+ messages in thread
From: Lukas Wunner @ 2017-11-25 11:31 UTC (permalink / raw)
To: Srinivas Kandagatla; +Cc: linux-kernel
No need to reinvent the wheel, we have bus_find_device_by_name().
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
drivers/nvmem/core.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 5a5cefd12153..93084ab61e0f 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -600,16 +600,11 @@ static void __nvmem_device_put(struct nvmem_device *nvmem)
mutex_unlock(&nvmem_mutex);
}
-static int nvmem_match(struct device *dev, void *data)
-{
- return !strcmp(dev_name(dev), data);
-}
-
static struct nvmem_device *nvmem_find(const char *name)
{
struct device *d;
- d = bus_find_device(&nvmem_bus_type, NULL, (void *)name, nvmem_match);
+ d = bus_find_device_by_name(&nvmem_bus_type, NULL, name);
if (!d)
return NULL;
--
2.11.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] nvmem: core: Deduplicate bus_find_device() by name matching
2017-11-25 11:31 [PATCH] nvmem: core: Deduplicate bus_find_device() by name matching Lukas Wunner
@ 2017-11-25 14:47 ` Srinivas Kandagatla
0 siblings, 0 replies; 2+ messages in thread
From: Srinivas Kandagatla @ 2017-11-25 14:47 UTC (permalink / raw)
To: Lukas Wunner; +Cc: linux-kernel
Thanks for the patch,
On 25/11/17 11:31, Lukas Wunner wrote:
> No need to reinvent the wheel, we have bus_find_device_by_name().
>
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> ---
> drivers/nvmem/core.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
It looks good for me, I will queue it up!
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 5a5cefd12153..93084ab61e0f 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -600,16 +600,11 @@ static void __nvmem_device_put(struct nvmem_device *nvmem)
> mutex_unlock(&nvmem_mutex);
> }
>
> -static int nvmem_match(struct device *dev, void *data)
> -{
> - return !strcmp(dev_name(dev), data);
> -}
> -
> static struct nvmem_device *nvmem_find(const char *name)
> {
> struct device *d;
>
> - d = bus_find_device(&nvmem_bus_type, NULL, (void *)name, nvmem_match);
> + d = bus_find_device_by_name(&nvmem_bus_type, NULL, name);
>
> if (!d)
> return NULL;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-25 14:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-25 11:31 [PATCH] nvmem: core: Deduplicate bus_find_device() by name matching Lukas Wunner
2017-11-25 14:47 ` Srinivas Kandagatla
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®