Commit bf58e882 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Greg Kroah-Hartman

nvmem: change the signature of nvmem_unregister()

We switched the nvmem framework to using kref instead of manually
checking the current number of users in nvmem_unregister() so this
function can no longer fail. We also converted all remaining users
that still checked the return value of nvmem_unregister() to using
devm_nvmem_register(). Make the routine return void.
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>
parent 7d9f9f24
...@@ -553,20 +553,16 @@ static void nvmem_device_release(struct kref *kref) ...@@ -553,20 +553,16 @@ static void nvmem_device_release(struct kref *kref)
* nvmem_unregister() - Unregister previously registered nvmem device * nvmem_unregister() - Unregister previously registered nvmem device
* *
* @nvmem: Pointer to previously registered nvmem device. * @nvmem: Pointer to previously registered nvmem device.
*
* Return: Will be an negative on error or a zero on success.
*/ */
int nvmem_unregister(struct nvmem_device *nvmem) void nvmem_unregister(struct nvmem_device *nvmem)
{ {
kref_put(&nvmem->refcnt, nvmem_device_release); kref_put(&nvmem->refcnt, nvmem_device_release);
return 0;
} }
EXPORT_SYMBOL_GPL(nvmem_unregister); EXPORT_SYMBOL_GPL(nvmem_unregister);
static void devm_nvmem_release(struct device *dev, void *res) static void devm_nvmem_release(struct device *dev, void *res)
{ {
WARN_ON(nvmem_unregister(*(struct nvmem_device **)res)); nvmem_unregister(*(struct nvmem_device **)res);
} }
/** /**
......
...@@ -70,7 +70,7 @@ struct nvmem_config { ...@@ -70,7 +70,7 @@ struct nvmem_config {
#if IS_ENABLED(CONFIG_NVMEM) #if IS_ENABLED(CONFIG_NVMEM)
struct nvmem_device *nvmem_register(const struct nvmem_config *cfg); struct nvmem_device *nvmem_register(const struct nvmem_config *cfg);
int nvmem_unregister(struct nvmem_device *nvmem); void nvmem_unregister(struct nvmem_device *nvmem);
struct nvmem_device *devm_nvmem_register(struct device *dev, struct nvmem_device *devm_nvmem_register(struct device *dev,
const struct nvmem_config *cfg); const struct nvmem_config *cfg);
...@@ -87,10 +87,7 @@ static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c) ...@@ -87,10 +87,7 @@ static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c)
return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOSYS);
} }
static inline int nvmem_unregister(struct nvmem_device *nvmem) static inline void nvmem_unregister(struct nvmem_device *nvmem) {}
{
return -ENOSYS;
}
static inline struct nvmem_device * static inline struct nvmem_device *
devm_nvmem_register(struct device *dev, const struct nvmem_config *c) devm_nvmem_register(struct device *dev, const struct nvmem_config *c)
...@@ -101,7 +98,7 @@ devm_nvmem_register(struct device *dev, const struct nvmem_config *c) ...@@ -101,7 +98,7 @@ devm_nvmem_register(struct device *dev, const struct nvmem_config *c)
static inline int static inline int
devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem) devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem)
{ {
return nvmem_unregister(nvmem); return -ENOSYS;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment