Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1663596 > unrolled thread

[PATCH] regulator: core: Prioritise consumer mappings over regulator name

Started byCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
First post2017-06-12 17:20 +0200
Last post2017-06-13 15:20 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] regulator: core: Prioritise consumer mappings over regulator name Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2017-06-12 17:20 +0200
    Re: [PATCH] regulator: core: Prioritise consumer mappings over  regulator name Mark Brown <broonie@kernel.org> - 2017-06-12 18:40 +0200
      Re: [PATCH] regulator: core: Prioritise consumer mappings over  regulator name Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2017-06-13 10:10 +0200
        Re: [PATCH] regulator: core: Prioritise consumer mappings over  regulator name Mark Brown <broonie@kernel.org> - 2017-06-13 12:20 +0200
          Re: [PATCH] regulator: core: Prioritise consumer mappings over  regulator name Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2017-06-13 15:20 +0200

#1663596 — [PATCH] regulator: core: Prioritise consumer mappings over regulator name

FromCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Date2017-06-12 17:20 +0200
Subject[PATCH] regulator: core: Prioritise consumer mappings over regulator name
Message-ID<tRzii-3K9-13@gated-at.bofh.it>
Currently, when looking up a regulator supply, the regulator name
takes priority over the consumer mappings. As there are a lot of
regulator names that are in fairly common use (VDD, MICVDD, etc.) this
can easily lead to obtaining the wrong supply, when a system contains
two regulators that share a name.

The explicit consumer mappings contain much less ambiguity as they
specify both a name and a consumer device. As such prioritise those if
one exists and only fall back to the regulator name if there are no
matching explicit mappings.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 drivers/regulator/core.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 919b7f1..d257952 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1490,8 +1490,6 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev,
 		devname = dev_name(dev);
 
 	r = regulator_lookup_by_name(supply);
-	if (r)
-		return r;
 
 	mutex_lock(&regulator_list_mutex);
 	list_for_each_entry(map, &regulator_map_list, list) {
-- 
2.1.4

[toc] | [next] | [standalone]


#1663921 — Re: [PATCH] regulator: core: Prioritise consumer mappings over regulator name

FromMark Brown <broonie@kernel.org>
Date2017-06-12 18:40 +0200
SubjectRe: [PATCH] regulator: core: Prioritise consumer mappings over regulator name
Message-ID<tRAxJ-4uO-47@gated-at.bofh.it>
In reply to#1663596

[Multipart message — attachments visible in raw view] — view raw

On Mon, Jun 12, 2017 at 04:17:52PM +0100, Charles Keepax wrote:

>  	r = regulator_lookup_by_name(supply);
> -	if (r)
> -		return r;

Why have you left the lookup here?

[toc] | [prev] | [next] | [standalone]


#1664584 — Re: [PATCH] regulator: core: Prioritise consumer mappings over regulator name

FromCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Date2017-06-13 10:10 +0200
SubjectRe: [PATCH] regulator: core: Prioritise consumer mappings over regulator name
Message-ID<tRP3I-5vi-11@gated-at.bofh.it>
In reply to#1663921
On Mon, Jun 12, 2017 at 05:38:56PM +0100, Mark Brown wrote:
> On Mon, Jun 12, 2017 at 04:17:52PM +0100, Charles Keepax wrote:
> 
> >  	r = regulator_lookup_by_name(supply);
> > -	if (r)
> > -		return r;
> 
> Why have you left the lookup here?

Yeah was thinking that could maybe use a comment, if we don't
find a match in the following loop over the supply map then we
will exit with the regulator found here. So we can still use the
regulator name for lookup just we default to the supply map.

Thanks,
Charles

[toc] | [prev] | [next] | [standalone]


#1664710 — Re: [PATCH] regulator: core: Prioritise consumer mappings over regulator name

FromMark Brown <broonie@kernel.org>
Date2017-06-13 12:20 +0200
SubjectRe: [PATCH] regulator: core: Prioritise consumer mappings over regulator name
Message-ID<tRR5x-6If-49@gated-at.bofh.it>
In reply to#1664584

[Multipart message — attachments visible in raw view] — view raw

On Tue, Jun 13, 2017 at 09:07:31AM +0100, Charles Keepax wrote:
> On Mon, Jun 12, 2017 at 05:38:56PM +0100, Mark Brown wrote:
> > On Mon, Jun 12, 2017 at 04:17:52PM +0100, Charles Keepax wrote:

> > >  	r = regulator_lookup_by_name(supply);
> > > -	if (r)
> > > -		return r;

> > Why have you left the lookup here?

> Yeah was thinking that could maybe use a comment, if we don't
> find a match in the following loop over the supply map then we
> will exit with the regulator found here. So we can still use the
> regulator name for lookup just we default to the supply map.

Why are we even doing the lookup here if we only use it if we fail to
find a supply mapping?

[toc] | [prev] | [next] | [standalone]


#1664835 — Re: [PATCH] regulator: core: Prioritise consumer mappings over regulator name

FromCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Date2017-06-13 15:20 +0200
SubjectRe: [PATCH] regulator: core: Prioritise consumer mappings over regulator name
Message-ID<tRTTH-8sf-1@gated-at.bofh.it>
In reply to#1664710
On Tue, Jun 13, 2017 at 11:15:56AM +0100, Mark Brown wrote:
> On Tue, Jun 13, 2017 at 09:07:31AM +0100, Charles Keepax wrote:
> > On Mon, Jun 12, 2017 at 05:38:56PM +0100, Mark Brown wrote:
> > > On Mon, Jun 12, 2017 at 04:17:52PM +0100, Charles Keepax wrote:
> 
> > > >  	r = regulator_lookup_by_name(supply);
> > > > -	if (r)
> > > > -		return r;
> 
> > > Why have you left the lookup here?
> 
> > Yeah was thinking that could maybe use a comment, if we don't
> > find a match in the following loop over the supply map then we
> > will exit with the regulator found here. So we can still use the
> > regulator name for lookup just we default to the supply map.
> 
> Why are we even doing the lookup here if we only use it if we fail to
> find a supply mapping?

Yeah I think that is probably a poor choice I will do a V2 that
does the lookup conditionally after the search of the supply map.

Thanks,
Charles

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web