mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Marek Szyprowski <m.szyprowski@samsung.com>,
	pascal paillet <p.paillet@st.com>,
	benjamin.gaignard@linaro.org
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	linux-kernel@vger.kernel.org, Mark Brown <broonie@kernel.org>
Subject: [PATCH] regulator: core: Don't link consumers on the same device
Date: Mon,  9 Jul 2018 13:54:02 +0100	[thread overview]
Message-ID: <20180709125402.32427-1-broonie@kernel.org> (raw)

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


             reply	other threads:[~2018-07-09 12:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180709125425epcas1p2343265d3a6a826b2ace0ef584d062dac@epcas1p2.samsung.com>
2018-07-09 12:54 ` Mark Brown [this message]
2018-07-09 13:32   ` Marek Szyprowski
2018-07-09 16:11     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180709125402.32427-1-broonie@kernel.org \
    --to=broonie@kernel.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=benjamin.gaignard@linaro.org \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=p.paillet@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®