Merge tag 'at24-fixes-for-v5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into i2c/for-current

at24 fixes for v5.14

- fix a problem with repeating labels not getting a device id
This commit is contained in:
Wolfram Sang 2021-07-20 22:28:56 +02:00
commit a750bff5b9
1 changed files with 7 additions and 10 deletions

View File

@ -714,23 +714,20 @@ static int at24_probe(struct i2c_client *client)
} }
/* /*
* If the 'label' property is not present for the AT24 EEPROM, * We initialize nvmem_config.id to NVMEM_DEVID_AUTO even if the
* then nvmem_config.id is initialised to NVMEM_DEVID_AUTO, * label property is set as some platform can have multiple eeproms
* and this will append the 'devid' to the name of the NVMEM * with same label and we can not register each of those with same
* device. This is purely legacy and the AT24 driver has always * label. Failing to register those eeproms trigger cascade failure
* defaulted to this. However, if the 'label' property is * on such platform.
* present then this means that the name is specified by the
* firmware and this name should be used verbatim and so it is
* not necessary to append the 'devid'.
*/ */
nvmem_config.id = NVMEM_DEVID_AUTO;
if (device_property_present(dev, "label")) { if (device_property_present(dev, "label")) {
nvmem_config.id = NVMEM_DEVID_NONE;
err = device_property_read_string(dev, "label", err = device_property_read_string(dev, "label",
&nvmem_config.name); &nvmem_config.name);
if (err) if (err)
return err; return err;
} else { } else {
nvmem_config.id = NVMEM_DEVID_AUTO;
nvmem_config.name = dev_name(dev); nvmem_config.name = dev_name(dev);
} }