Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd1ab3b4 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Gerrit - the friendly Code Review server
Browse files

nvmem: provide nvmem_dev_name()



Kernel users don't have any means of checking the names of nvmem
devices. Add a routine that returns the name of the nvmem provider.

This will be useful for future nvmem notifier subscribers - otherwise
they can't check what device is being added/removed.

Change-Id: I41552043b85e050dd92e5ed8aa86a516e3752bb2
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Git-commit: d7b9fd1669d4a4f38281c4e29f1408e1bdce09b3
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarGaurav Kohli <gkohli@codeaurora.org>
parent 52fc4cfa
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1349,6 +1349,19 @@ int nvmem_device_write(struct nvmem_device *nvmem,
}
EXPORT_SYMBOL_GPL(nvmem_device_write);

/**
 * nvmem_dev_name() - Get the name of a given nvmem device.
 *
 * @nvmem: nvmem device.
 *
 * Return: name of the nvmem device.
 */
const char *nvmem_dev_name(struct nvmem_device *nvmem)
{
	return dev_name(&nvmem->dev);
}
EXPORT_SYMBOL_GPL(nvmem_dev_name);

static int __init nvmem_init(void)
{
	return bus_register(&nvmem_bus_type);
+8 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@ ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem,
int nvmem_device_cell_write(struct nvmem_device *nvmem,
			    struct nvmem_cell_info *info, void *buf);

const char *nvmem_dev_name(struct nvmem_device *nvmem);

#else

static inline struct nvmem_cell *nvmem_cell_get(struct device *dev,
@@ -143,6 +145,12 @@ static inline int nvmem_device_write(struct nvmem_device *nvmem,
{
	return -ENOSYS;
}

static inline const char *nvmem_dev_name(struct nvmem_device *nvmem)
{
	return NULL;
}

#endif /* CONFIG_NVMEM */

#if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF)