lkml.org 
[lkml]   [2018]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v3 10/21] nvmem: change the signature of nvmem_unregister()
    Date
    From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

    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 <bgolaszewski@baylibre.com>
    ---
    drivers/nvmem/core.c | 8 ++------
    include/linux/nvmem-provider.h | 9 +++------
    2 files changed, 5 insertions(+), 12 deletions(-)

    diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
    index 552ffedce38e..c950d54bb69d 100644
    --- a/drivers/nvmem/core.c
    +++ b/drivers/nvmem/core.c
    @@ -553,20 +553,16 @@ static void nvmem_device_release(struct kref *kref)
    * nvmem_unregister() - Unregister 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);
    -
    - return 0;
    }
    EXPORT_SYMBOL_GPL(nvmem_unregister);

    static void devm_nvmem_release(struct device *dev, void *res)
    {
    - WARN_ON(nvmem_unregister(*(struct nvmem_device **)res));
    + nvmem_unregister(*(struct nvmem_device **)res);
    }

    /**
    diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
    index 24def6ad09bb..033c9c3c80a6 100644
    --- a/include/linux/nvmem-provider.h
    +++ b/include/linux/nvmem-provider.h
    @@ -70,7 +70,7 @@ struct nvmem_config {
    #if IS_ENABLED(CONFIG_NVMEM)

    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,
    const struct nvmem_config *cfg);
    @@ -87,10 +87,7 @@ static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c)
    return ERR_PTR(-ENOSYS);
    }

    -static inline int nvmem_unregister(struct nvmem_device *nvmem)
    -{
    - return -ENOSYS;
    -}
    +static inline void nvmem_unregister(struct nvmem_device *nvmem) {}

    static inline struct nvmem_device *
    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
    devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem)
    {
    - return nvmem_unregister(nvmem);
    + return ERR_PTR(-ENOSYS);

    }

    --
    2.18.0
    \
     
     \ /
      Last update: 2018-09-12 09:53    [W:3.801 / U:0.332 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site