Commit 9f3044c3 authored by Lukas Wunner's avatar Lukas Wunner Committed by Greg Kroah-Hartman
Browse files

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: default avatarLukas Wunner <lukas@wunner.de>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3f827245
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -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;