Skip to content

Commit

Permalink
nvmem: core: Set the provider read-only when no write callback is given
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
AlbanBedel authored and gregkh committed Jan 31, 2019
1 parent ffbc34b commit 1716cfe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/nvmem/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?
Expand Down

0 comments on commit 1716cfe

Please sign in to comment.