Skip to content
Snippets Groups Projects
Commit 37a8cf39 authored by Vaibhav Gupta's avatar Vaibhav Gupta
Browse files

fixup! fmc-eeprom: Use "nvmem_device_find()" to get nvmem device

parent b041a2c2
Branches
Tags
No related merge requests found
...@@ -88,7 +88,7 @@ static void fmc_slot_eeprom_init_default(struct fmc_slot *slot, ...@@ -88,7 +88,7 @@ static void fmc_slot_eeprom_init_default(struct fmc_slot *slot,
* about the parent device which is handled by i2c. * about the parent device which is handled by i2c.
* One pattern which is helpful is that the nvmem framework names its * One pattern which is helpful is that the nvmem framework names its
* devices by just appending an id to the name of the parent device. So, * devices by just appending an id to the name of the parent device. So,
* if the parent device is "2-0050", the nvmem device will be 2-005<id>. * if the parent device is "2-0050", the nvmem device will be 2-0050<id>.
* *
* The silver lining in our case is that as per FMC standard, we have only * The silver lining in our case is that as per FMC standard, we have only
* one eeprom/nvmem device per i2c handler. Thus, we just need to check * one eeprom/nvmem device per i2c handler. Thus, we just need to check
...@@ -100,19 +100,7 @@ int fmc_nvmem_device_find_match(struct device *dev, const void *data) ...@@ -100,19 +100,7 @@ int fmc_nvmem_device_find_match(struct device *dev, const void *data)
const char *s1 = dev_name(dev); const char *s1 = dev_name(dev);
const char *s2 = (const char*) data; const char *s2 = (const char*) data;
while(*s2 && *s1 == *s2) { return memcmp(s1, s2, strlen(s2)) ? false: true;
s1++;
s2++;
}
/**
* If s2 is terminating with newline-then-NULL, the loop will break
* and *s2 will be still valid. Thus, check if we are out of loop
* because of newline?
*/
if (!*s2 || *s2 == '\n')
return true;
return false;
} }
/** /**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment