summaryrefslogtreecommitdiffstats
path: root/drivers/nvmem
diff options
context:
space:
mode:
authorAlban Bedel <albeu@free.fr>2019-01-28 16:55:00 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-31 16:24:14 +0100
commit1716cfe8be4974741e56529aa7076f244aed9ade (patch)
tree087b0a5fef185c29f77d8e9cea3fa1aa4d668a9c /drivers/nvmem
parentnvmem: imx-ocotp: Implement i.MX6ULL/ULZ support (diff)
downloadlinux-1716cfe8be4974741e56529aa7076f244aed9ade.tar.xz
linux-1716cfe8be4974741e56529aa7076f244aed9ade.zip
nvmem: core: Set the provider read-only when no write callback is given
If no write callback is given the device should be marked as read-only. While at it also move from a bit or to a logical or as that is a logical expression. Signed-off-by: Alban Bedel <albeu@free.fr> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/nvmem')
-rw-r--r--drivers/nvmem/core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index f7301bb4ef3b..cf2e1091fe89 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -646,8 +646,8 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
config->name ? config->id : nvmem->id);
}
- nvmem->read_only = device_property_present(config->dev, "read-only") |
- config->read_only;
+ nvmem->read_only = device_property_present(config->dev, "read-only") ||
+ config->read_only || !nvmem->reg_write;
if (config->root_only)
nvmem->dev.groups = nvmem->read_only ?