mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
nvmem: Use the same permissions for eeprom as for nvmem
commite70d8b2873
upstream. The compatibility "eeprom" attribute is currently root-only no matter what the configuration says. The "nvmem" attribute does respect the setting of the root_only configuration bit, so do the same for "eeprom". Signed-off-by: Jean Delvare <jdelvare@suse.de> Fixes:b6c217ab9b
("nvmem: Add backwards compatibility support for older EEPROM drivers.") Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Cc: Andrew Lunn <andrew@lunn.ch> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20190728184255.563332e6@endymion Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a75883f402
commit
b0fc60701d
1 changed files with 11 additions and 4 deletions
|
@ -407,10 +407,17 @@ static int nvmem_setup_compat(struct nvmem_device *nvmem,
|
|||
if (!config->base_dev)
|
||||
return -EINVAL;
|
||||
|
||||
if (nvmem->read_only)
|
||||
nvmem->eeprom = bin_attr_ro_root_nvmem;
|
||||
else
|
||||
nvmem->eeprom = bin_attr_rw_root_nvmem;
|
||||
if (nvmem->read_only) {
|
||||
if (config->root_only)
|
||||
nvmem->eeprom = bin_attr_ro_root_nvmem;
|
||||
else
|
||||
nvmem->eeprom = bin_attr_ro_nvmem;
|
||||
} else {
|
||||
if (config->root_only)
|
||||
nvmem->eeprom = bin_attr_rw_root_nvmem;
|
||||
else
|
||||
nvmem->eeprom = bin_attr_rw_nvmem;
|
||||
}
|
||||
nvmem->eeprom.attr.name = "eeprom";
|
||||
nvmem->eeprom.size = nvmem->size;
|
||||
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
||||
|
|
Loading…
Reference in a new issue