lkml.org 
[lkml]   [2020]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/5] misc: eeprom: at24: Support custom device names for AT24 EEPROMs
Date
By using the label property, a more descriptive name can be populated
for AT24 EEPROMs NVMEM device. Update the AT24 driver to check to see
if the label property is present and if so, use this as the name for
NVMEM device.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
drivers/misc/eeprom/at24.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 3f7a3bb6a36c..058be08a9a40 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -713,7 +713,15 @@ static int at24_probe(struct i2c_client *client)
return err;
}

- nvmem_config.name = dev_name(dev);
+ if (device_property_present(dev, "label")) {
+ err = device_property_read_string(dev, "label",
+ &nvmem_config.name);
+ if (err)
+ return err;
+ } else {
+ nvmem_config.name = dev_name(dev);
+ }
+
nvmem_config.dev = dev;
nvmem_config.id = NVMEM_DEVID_NONE;
nvmem_config.read_only = !writable;
--
2.25.1
\
 
 \ /
  Last update: 2020-09-10 23:33    [W:0.148 / U:3.756 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site