lkml.org 
[lkml]   [2018]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] regulator: core: Don't link consumers on the same device
Date
In some cases a device may end up supplying itself, for example when a
DCDC is used to improve the efficiency of LDOs or when a LDO is provided
to clean up sensitive supplies. In these cases the driver core will
warn loudly about attempts to add links so suppress them here.

Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---

Compile tested only.

drivers/regulator/core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index b5db0257bc40..1302e66e80ac 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1741,7 +1741,8 @@ struct regulator *_regulator_get(struct device *dev, const char *id,
rdev->use_count = 0;
}

- device_link_add(dev, &rdev->dev, DL_FLAG_STATELESS);
+ if (dev != &rdev->dev)
+ device_link_add(dev, &rdev->dev, DL_FLAG_STATELESS);

return regulator;
}
@@ -1840,7 +1841,7 @@ static void _regulator_put(struct regulator *regulator)
if (r->dev == regulator->dev)
count++;

- if (count == 1)
+ if (count == 1 && regulator->dev != &rdev->dev)
device_link_remove(regulator->dev, &rdev->dev);

/* remove any sysfs entries */
--
2.18.0.rc2
\
 
 \ /
  Last update: 2018-07-09 14:55    [W:0.018 / U:12.348 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site