From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 07/13] nvmem: core: Set the provider read-only when no write callback is given
Date: Mon, 28 Jan 2019 15:55:00 +0000 [thread overview]
Message-ID: <20190128155506.25566-8-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20190128155506.25566-1-srinivas.kandagatla@linaro.org>
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(-)
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 ?
--
2.20.1
next prev parent reply other threads:[~2019-01-28 15:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-28 15:54 [PATCH 00/13] nvmem: patches for 5.1 Srinivas Kandagatla
2019-01-28 15:54 ` [PATCH 01/13] nvmem: sc27xx: Convert nvmem offset to block index Srinivas Kandagatla
2019-01-28 15:54 ` [PATCH 02/13] nvmem: bcm-ocotp: Add ACPI support to BCM OCOTP Srinivas Kandagatla
2019-01-28 15:54 ` [PATCH 03/13] dt-bindings: nvmem: imx-ocotp: add compatible string for i.MX7ULP Srinivas Kandagatla
2019-01-28 15:54 ` [PATCH 04/13] nvmem: imx-ocotp: add i.MX7ULP support Srinivas Kandagatla
2019-01-28 15:54 ` [PATCH 05/13] dt-bindings: imx-ocotp: Add i.MX6ULL/ULZ support Srinivas Kandagatla
2019-01-28 15:54 ` [PATCH 06/13] nvmem: imx-ocotp: Implement " Srinivas Kandagatla
2019-01-28 15:55 ` Srinivas Kandagatla [this message]
2019-01-28 15:55 ` [PATCH 08/13] nvmem: core: Fix of_nvmem_cell_get() for optional cells Srinivas Kandagatla
2019-01-28 15:55 ` [PATCH 09/13] nvmem: core: Fix cell lookup when no cell is found Srinivas Kandagatla
2019-01-28 15:55 ` [PATCH 10/13] nvmem: core: Properly handle connection ID in of_nvmem_device_get() Srinivas Kandagatla
2019-01-28 15:55 ` [PATCH 11/13] nvmem: core: Always reference the device returned by nvmem_device_get() Srinivas Kandagatla
2019-01-28 15:55 ` [PATCH 12/13] nvmem: core: Fix device reference leak Srinivas Kandagatla
2019-01-28 15:55 ` [PATCH 13/13] nvmem: core: Avoid useless iterations in nvmem_cell_get_from_lookup() Srinivas Kandagatla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190128155506.25566-8-srinivas.kandagatla@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).