fmc-eeprom: Use "nvmem_device_find()" to get nvmem device
To use "nvmem_device_get()" we need to find correct name of our nvmem
device, which is a very complex job than it seems.
The way nvmem-consumer framework is designed, we only have the info
about the parent device which is handled by i2c. Thus, there is no
non-hackish way we can get the name of our nvmem-device.
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,
if the parent device is "2-0050", the nvmem device will be 2-005<id>.
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
that out of all nvmem devices, which one contains the name of our
i2c handler.
Signed-off-by:
Vaibhav Gupta <vaibhav.gupta@cern.ch>
Please register or sign in to comment