mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
nvmem: Introduce devm_nvmem_(un)register()
Introduce devm_nvmem_register()/devm_nvmem_unregister() to make .remove() unnecessary in trivial drivers. Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: Heiko Stuebner <heiko@sntech.de> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Carlo Caione <carlo@caione.org> Cc: Kevin Hilman <khilman@baylibre.com> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: cphealy@gmail.com Cc: linux-kernel@vger.kernel.org Cc: linux-mediatek@lists.infradead.org Cc: linux-rockchip@lists.infradead.org Cc: linux-amlogic@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
fd0f4906a3
commit
f1f50eca5f
@@ -72,6 +72,11 @@ struct nvmem_config {
|
||||
struct nvmem_device *nvmem_register(const struct nvmem_config *cfg);
|
||||
int nvmem_unregister(struct nvmem_device *nvmem);
|
||||
|
||||
struct nvmem_device *devm_nvmem_register(struct device *dev,
|
||||
const struct nvmem_config *cfg);
|
||||
|
||||
int devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem);
|
||||
|
||||
#else
|
||||
|
||||
static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c)
|
||||
@@ -84,5 +89,17 @@ static inline int nvmem_unregister(struct nvmem_device *nvmem)
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static inline struct nvmem_device *
|
||||
devm_nvmem_register(struct device *dev, const struct nvmem_config *c)
|
||||
{
|
||||
return nvmem_register(c);
|
||||
}
|
||||
|
||||
static inline int
|
||||
devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem)
|
||||
{
|
||||
return nvmem_unregister(nvmem);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NVMEM */
|
||||
#endif /* ifndef _LINUX_NVMEM_PROVIDER_H */
|
||||
|
||||
Reference in New Issue
Block a user