regulator: add dummy function of_find_regulator_by_node
authorChangbin Du <changbin.du@intel.com>
Wed, 2 May 2018 13:44:57 +0000 (21:44 +0800)
committerMark Brown <broonie@kernel.org>
Sat, 5 May 2018 01:40:49 +0000 (10:40 +0900)
commit08813e0ec1cb48e53c86a24d88d26b26878e7b6e
tree6c73872f5195993d36eea6e6d24f9342cc8043d9
parent60891ceb8075e02cbf841ac1e7f7437d711ffc5f
regulator: add dummy function of_find_regulator_by_node

If device tree is not enabled, of_find_regulator_by_node() should have
a dummy function since the function call is still there.

This is to fix build error after CONFIG_NO_AUTO_INLINE is introduced.
If this option is enabled, GCC will not auto-inline functions that are
not explicitly marked as inline.

In this case (no CONFIG_OF), the copmiler will report error in function
regulator_dev_lookup().

W/O NO_AUTO_INLINE, function of_get_regulator() is auto-inlined and then
the call to of_find_regulator_by_node() is optimized out since
of_get_regulator() always return NULL.

W/ NO_AUTO_INLINE, the return value of of_get_regulator() is a variable
so the call to of_find_regulator_by_node() cannot be optimized out. So
we need a stub of_find_regulator_by_node().

static struct regulator_dev *regulator_dev_lookup(struct device *dev,
  const char *supply)
{
struct regulator_dev *r = NULL;
struct device_node *node;
struct regulator_map *map;
const char *devname = NULL;

regulator_supply_alias(&dev, &supply);

/* first do a dt based lookup */
if (dev && dev->of_node) {
node = of_get_regulator(dev, supply);
if (node) {
r = of_find_regulator_by_node(node);
if (r)
return r;
...

Signed-off-by: Changbin Du <changbin.du@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/internal.h