提交 9f3044c3 编写于 作者: L Lukas Wunner 提交者: Greg Kroah-Hartman

nvmem: core: Deduplicate bus_find_device() by name matching

No need to reinvent the wheel, we have bus_find_device_by_name().
Signed-off-by: NLukas Wunner <lukas@wunner.de>
Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 3f827245
...@@ -600,16 +600,11 @@ static void __nvmem_device_put(struct nvmem_device *nvmem) ...@@ -600,16 +600,11 @@ static void __nvmem_device_put(struct nvmem_device *nvmem)
mutex_unlock(&nvmem_mutex); 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) static struct nvmem_device *nvmem_find(const char *name)
{ {
struct device *d; 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) if (!d)
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册