nvmem: core: add root_only member to nvmem device struct
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Wed, 25 Mar 2020 12:21:15 +0000 (12:21 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Mar 2020 12:45:09 +0000 (13:45 +0100)
As we are planning to move to use sysfs is_bin_visible callback,
having root_only as part of nvmem_device will help decide correct
permissions.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200325122116.15096-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvmem/core.c
drivers/nvmem/nvmem.h

index 77d890d..acf7593 100644 (file)
@@ -377,6 +377,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
        nvmem->dev.type = &nvmem_provider_type;
        nvmem->dev.bus = &nvmem_bus_type;
        nvmem->dev.parent = config->dev;
+       nvmem->root_only = config->root_only;
        nvmem->priv = config->priv;
        nvmem->type = config->type;
        nvmem->reg_read = config->reg_read;
index be0d66d..16c0d3a 100644 (file)
@@ -20,6 +20,7 @@ struct nvmem_device {
        struct kref             refcnt;
        size_t                  size;
        bool                    read_only;
+       bool                    root_only;
        int                     flags;
        enum nvmem_type         type;
        struct bin_attribute    eeprom;