diff mbox series

[07/13] nvmem: core: Set the provider read-only when no write callback is given

Message ID 20190128155506.25566-8-srinivas.kandagatla@linaro.org
State New
Headers show
Series nvmem: patches for 5.1 | expand

Commit Message

Srinivas Kandagatla Jan. 28, 2019, 3:55 p.m. UTC
From: Alban Bedel <albeu@free.fr>


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>

---
 drivers/nvmem/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.20.1
diff mbox series

Patch

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 ?