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>
This commit is contained in:
Alban Bedel 2019-01-28 15:55:00 +00:00 коммит произвёл Greg Kroah-Hartman
Родитель ffbc34bf0e
Коммит 1716cfe8be
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -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 ?