Commit fc2f9970 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Greg Kroah-Hartman

nvmem: core: switch to device_property_present for reading property "read-only"

Switch to more generic device_property_present to consider also non-DT
properties.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 99897efd
...@@ -444,7 +444,6 @@ static int nvmem_setup_compat(struct nvmem_device *nvmem, ...@@ -444,7 +444,6 @@ static int nvmem_setup_compat(struct nvmem_device *nvmem,
struct nvmem_device *nvmem_register(const struct nvmem_config *config) struct nvmem_device *nvmem_register(const struct nvmem_config *config)
{ {
struct nvmem_device *nvmem; struct nvmem_device *nvmem;
struct device_node *np;
int rval; int rval;
if (!config->dev) if (!config->dev)
...@@ -473,13 +472,12 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) ...@@ -473,13 +472,12 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
nvmem->priv = config->priv; nvmem->priv = config->priv;
nvmem->reg_read = config->reg_read; nvmem->reg_read = config->reg_read;
nvmem->reg_write = config->reg_write; nvmem->reg_write = config->reg_write;
np = config->dev->of_node; nvmem->dev.of_node = config->dev->of_node;
nvmem->dev.of_node = np;
dev_set_name(&nvmem->dev, "%s%d", dev_set_name(&nvmem->dev, "%s%d",
config->name ? : "nvmem", config->name ? : "nvmem",
config->name ? config->id : nvmem->id); config->name ? config->id : nvmem->id);
nvmem->read_only = of_property_read_bool(np, "read-only") | nvmem->read_only = device_property_present(config->dev, "read-only") |
config->read_only; config->read_only;
if (config->root_only) if (config->root_only)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment