Skip to content

Commit bf58e88

Browse files
brglgregkh
authored andcommitted
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: Bartosz Golaszewski <[email protected]> Signed-off-by: Srinivas Kandagatla <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7d9f9f2 commit bf58e88

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

drivers/nvmem/core.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -553,20 +553,16 @@ static void nvmem_device_release(struct kref *kref)
553553
* nvmem_unregister() - Unregister previously registered nvmem device
554554
*
555555
* @nvmem: Pointer to previously registered nvmem device.
556-
*
557-
* Return: Will be an negative on error or a zero on success.
558556
*/
559-
int nvmem_unregister(struct nvmem_device *nvmem)
557+
void nvmem_unregister(struct nvmem_device *nvmem)
560558
{
561559
kref_put(&nvmem->refcnt, nvmem_device_release);
562-
563-
return 0;
564560
}
565561
EXPORT_SYMBOL_GPL(nvmem_unregister);
566562

567563
static void devm_nvmem_release(struct device *dev, void *res)
568564
{
569-
WARN_ON(nvmem_unregister(*(struct nvmem_device **)res));
565+
nvmem_unregister(*(struct nvmem_device **)res);
570566
}
571567

572568
/**

include/linux/nvmem-provider.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct nvmem_config {
7070
#if IS_ENABLED(CONFIG_NVMEM)
7171

7272
struct nvmem_device *nvmem_register(const struct nvmem_config *cfg);
73-
int nvmem_unregister(struct nvmem_device *nvmem);
73+
void nvmem_unregister(struct nvmem_device *nvmem);
7474

7575
struct nvmem_device *devm_nvmem_register(struct device *dev,
7676
const struct nvmem_config *cfg);
@@ -87,10 +87,7 @@ static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c)
8787
return ERR_PTR(-ENOSYS);
8888
}
8989

90-
static inline int nvmem_unregister(struct nvmem_device *nvmem)
91-
{
92-
return -ENOSYS;
93-
}
90+
static inline void nvmem_unregister(struct nvmem_device *nvmem) {}
9491

9592
static inline struct nvmem_device *
9693
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)
10198
static inline int
10299
devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem)
103100
{
104-
return nvmem_unregister(nvmem);
101+
return -ENOSYS;
105102

106103
}
107104

0 commit comments

Comments
 (0)