diff mbox series

[1/5] misc: eeprom: at24: Initialise AT24 NVMEM ID field

Message ID 20200910134239.192030-2-jonathanh@nvidia.com
State Superseded
Headers show
Series Add support for custom names for AT24 EEPROMs | expand

Commit Message

Jon Hunter Sept. 10, 2020, 1:42 p.m. UTC
The AT24 EEPROM driver does not initialise the 'id' field of the
nvmem_config structure and because the entire structure is not
initialised, it ends up with a random value. This causes the NVMEM
driver to append the device 'devid' value to name of the NVMEM
device. Although this is not a problem per-se, for I2C devices such as
the AT24, that already have a device unique name, there does not seem
much value in appending an additional 0 to the I2C name. For example,
appending a 0 to an I2C device name such as 1-0050 does not seem
necessary and maybe even a bit confusing. Therefore, fix this by
setting the NVMEM config.id to NVMEM_DEVID_NONE for AT24 EEPROMs.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/misc/eeprom/at24.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index e9df1ca251df..3f7a3bb6a36c 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -715,6 +715,7 @@  static int at24_probe(struct i2c_client *client)
 
 	nvmem_config.name = dev_name(dev);
 	nvmem_config.dev = dev;
+	nvmem_config.id = NVMEM_DEVID_NONE;
 	nvmem_config.read_only = !writable;
 	nvmem_config.root_only = !(flags & AT24_FLAG_IRUGO);
 	nvmem_config.owner = THIS_MODULE;