]> git.karo-electronics.de Git - karo-tx-linux.git/commit
nvmem: core: Allow allocating several anonymous nvmem devices
authorAban Bedel <albeu@free.fr>
Fri, 31 Mar 2017 12:44:46 +0000 (13:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 8 Apr 2017 15:51:48 +0000 (17:51 +0200)
commit5253193d5479006b14dbe475740d031ce3e01570
tree8e386997cc7a3c1806da8998168932e41ac38f74
parent1b595505bf68bf6a821e944f87766af76d515f96
nvmem: core: Allow allocating several anonymous nvmem devices

Currently the nvmem core expect the config to provide a name and ID
that are then used to create the device name. When no device name is
given 'nvmem' is used. However if there is several such anonymous
devices they all get named 'nvmem0', which doesn't work.

To fix this problem use the ID from the config only when the config
also provides a name. When no name is provided take the uinque ID of
the nvmem device instead.

Signed-off-by: Aban Bedel <albeu@free.fr>
Reviewed-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvmem/core.c