Commit e70d8b28 authored by Jean Delvare's avatar Jean Delvare Committed by Greg Kroah-Hartman

nvmem: Use the same permissions for eeprom as for nvmem

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: default avatarJean Delvare <>
Fixes: b6c217ab ("nvmem: Add backwards compatibility support for older EEPROM drivers.")
Reviewed-by: default avatarBartosz Golaszewski <>
Cc: Andrew Lunn <>
Cc: Srinivas Kandagatla <>
Cc: Arnd Bergmann <>
Link: default avatarGreg Kroah-Hartman <>
parent d21a95e0
......@@ -224,10 +224,17 @@ int nvmem_sysfs_setup_compat(struct nvmem_device *nvmem,
if (!config->base_dev)
return -EINVAL;
if (nvmem->read_only)
nvmem->eeprom = bin_attr_ro_root_nvmem;
nvmem->eeprom = bin_attr_rw_root_nvmem;
if (nvmem->read_only) {
if (config->root_only)
nvmem->eeprom = bin_attr_ro_root_nvmem;
nvmem->eeprom = bin_attr_ro_nvmem;
} else {
if (config->root_only)
nvmem->eeprom = bin_attr_rw_root_nvmem;
nvmem->eeprom = bin_attr_rw_nvmem;
nvmem-> = "eeprom";
nvmem->eeprom.size = nvmem->size;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment