greybus: power_supply: fix name setting location

We were checking for existing power supply names in the wrong place,
i.e, we were checking before any of the module power supply were
registered, because of that of course no name collision was detected.

Move the check to the register loop and with that we guarantee that this
mechanism works for greybus power supply naming.

Tested: using gbsim and using power supply with the same name and check
that: 1. no problems creating sysfs entries; 2. naming is done following
the desired rules.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
1 file changed
tree: abad7e484d3962ab440cffb570eebc88de27ddce
  1. drivers/