All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Rajendra Nayak <rnayak@ti.com>
Cc: grant.likely@secretlab.ca, devicetree-discuss@lists.ozlabs.org,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	tony@atomide.com, lrg@ti.com, b-cousson@ti.com
Subject: Re: [RFC PATCH 10/11] regulator: Implement consumer regulator mapping from device tree
Date: Thu, 15 Sep 2011 14:59:39 +0100	[thread overview]
Message-ID: <20110915135939.GO7988@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1316085727-15023-11-git-send-email-rnayak@ti.com>

On Thu, Sep 15, 2011 at 04:52:06PM +0530, Rajendra Nayak wrote:

> +#ifdef CONFIG_OF
> +	struct device_node *node;
> +	node = of_get_regulator(dev, id);
> +	if (!node)
> +		goto out;
> +	list_for_each_entry(rdev, &regulator_list, list)
> +		if (node == rdev->node)
> +			goto found;
> +#else
>  	list_for_each_entry(map, &regulator_map_list, list) {
>  		/* If the mapping has a device set up it must match */
>  		if (map->dev_name &&
> @@ -1178,6 +1189,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
>  			goto found;
>  		}
>  	}
> +#endif

This forces all machines to use device tree when CONFIG_OF is enabled.
I'd expect to see both mechanisms supported simultaneously, for example
by falling back to the current code if the device tree lookup fails.

> @@ -1216,6 +1228,15 @@ found:
>  	if (!try_module_get(rdev->owner))
>  		goto out;
>  
> +#ifdef CONFIG_OF
> +	ret = set_consumer_device_supply(rdev, dev, devname, id);
> +	if (ret < 0) {
> +		dev_err(dev, "Failed to set supply %d\n", ret);
> +		unset_regulator_supplies(rdev);
> +		goto out;
> +	}
> +#endif
> +

This seems wrong, why are we adding things to the regulator_map which is
really only there for lookups when we already did the lookup using the
device tree?

> @@ -2619,6 +2640,8 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
>  	rdev->reg_data = driver_data;
>  	rdev->owner = regulator_desc->owner;
>  	rdev->desc = regulator_desc;
> +	if (dev && dev->of_node)
> +		rdev->node = dev->of_node;

dev is mandatory.

WARNING: multiple messages have this Message-ID (diff)
From: broonie@opensource.wolfsonmicro.com (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 10/11] regulator: Implement consumer regulator mapping from device tree
Date: Thu, 15 Sep 2011 14:59:39 +0100	[thread overview]
Message-ID: <20110915135939.GO7988@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1316085727-15023-11-git-send-email-rnayak@ti.com>

On Thu, Sep 15, 2011 at 04:52:06PM +0530, Rajendra Nayak wrote:

> +#ifdef CONFIG_OF
> +	struct device_node *node;
> +	node = of_get_regulator(dev, id);
> +	if (!node)
> +		goto out;
> +	list_for_each_entry(rdev, &regulator_list, list)
> +		if (node == rdev->node)
> +			goto found;
> +#else
>  	list_for_each_entry(map, &regulator_map_list, list) {
>  		/* If the mapping has a device set up it must match */
>  		if (map->dev_name &&
> @@ -1178,6 +1189,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
>  			goto found;
>  		}
>  	}
> +#endif

This forces all machines to use device tree when CONFIG_OF is enabled.
I'd expect to see both mechanisms supported simultaneously, for example
by falling back to the current code if the device tree lookup fails.

> @@ -1216,6 +1228,15 @@ found:
>  	if (!try_module_get(rdev->owner))
>  		goto out;
>  
> +#ifdef CONFIG_OF
> +	ret = set_consumer_device_supply(rdev, dev, devname, id);
> +	if (ret < 0) {
> +		dev_err(dev, "Failed to set supply %d\n", ret);
> +		unset_regulator_supplies(rdev);
> +		goto out;
> +	}
> +#endif
> +

This seems wrong, why are we adding things to the regulator_map which is
really only there for lookups when we already did the lookup using the
device tree?

> @@ -2619,6 +2640,8 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
>  	rdev->reg_data = driver_data;
>  	rdev->owner = regulator_desc->owner;
>  	rdev->desc = regulator_desc;
> +	if (dev && dev->of_node)
> +		rdev->node = dev->of_node;

dev is mandatory.

  parent reply	other threads:[~2011-09-15 13:59 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-15 11:21 [RFC PATCH 00/11] Device tree support for regulators Rajendra Nayak
2011-09-15 11:21 ` Rajendra Nayak
2011-09-15 11:21 ` [RFC PATCH 01/11] OMAP: TWL: Clean up mode and ops mask passed from board files Rajendra Nayak
2011-09-15 11:21   ` Rajendra Nayak
2011-09-15 11:21   ` [RFC PATCH 02/11] regulator: Fix error check in set_consumer_device_supply Rajendra Nayak
2011-09-15 11:21     ` Rajendra Nayak
2011-09-15 11:21     ` [RFC PATCH 03/11] DT: regulator: Helper routine to extract regulator_init_data Rajendra Nayak
2011-09-15 11:21       ` Rajendra Nayak
2011-09-15 11:22       ` [RFC PATCH 04/11] omap4: SDP: Pass regulator_init_data from DT Rajendra Nayak
2011-09-15 11:22         ` Rajendra Nayak
2011-09-15 11:22         ` [RFC PATCH 05/11] TWL: regulator: Make twl-regulator driver extract data " Rajendra Nayak
2011-09-15 11:22           ` Rajendra Nayak
2011-09-15 11:22           ` [RFC PATCH 06/11] DT: regulator: Helper routine to extract fixed_voltage_config Rajendra Nayak
2011-09-15 11:22             ` Rajendra Nayak
2011-09-15 11:22             ` [RFC PATCH 07/11] regulator: Make fixed regulator driver extract data from DT Rajendra Nayak
2011-09-15 11:22               ` Rajendra Nayak
2011-09-15 11:22               ` [RFC PATCH 08/11] omap4: panda: Pass fixed regulator " Rajendra Nayak
2011-09-15 11:22                 ` Rajendra Nayak
2011-09-15 11:22                 ` [RFC PATCH 09/11] DT: regulator: Helper to extract regulator node based on supply name Rajendra Nayak
2011-09-15 11:22                   ` Rajendra Nayak
2011-09-15 11:22                   ` [RFC PATCH 10/11] regulator: Implement consumer regulator mapping from device tree Rajendra Nayak
2011-09-15 11:22                     ` Rajendra Nayak
2011-09-15 11:22                     ` [RFC PATCH 11/11] DT: regulator: register regulators as platform devices Rajendra Nayak
2011-09-15 11:22                       ` Rajendra Nayak
2011-09-15 14:21                       ` Mark Brown
2011-09-15 14:21                         ` Mark Brown
2011-09-16  7:22                         ` Rajendra Nayak
2011-09-16  7:22                           ` Rajendra Nayak
2011-09-15 13:59                     ` Mark Brown [this message]
2011-09-15 13:59                       ` [RFC PATCH 10/11] regulator: Implement consumer regulator mapping from device tree Mark Brown
2011-09-16  7:21                       ` Rajendra Nayak
2011-09-16  7:21                         ` Rajendra Nayak
     [not found]                         ` <4E72F8E2.3020200-l0cyMroinI0@public.gmane.org>
2011-09-16  9:02                           ` Mark Brown
2011-09-16  9:02                             ` Mark Brown
2011-09-15 13:54                   ` [RFC PATCH 09/11] DT: regulator: Helper to extract regulator node based on supply name Mark Brown
2011-09-15 13:54                     ` Mark Brown
2011-09-15 22:50                     ` Grant Likely
2011-09-15 22:50                       ` Grant Likely
2011-09-15 23:03                       ` Mark Brown
2011-09-15 23:03                         ` Mark Brown
2011-09-16  7:19                         ` Rajendra Nayak
2011-09-16  7:19                           ` Rajendra Nayak
2011-09-15 13:51               ` [RFC PATCH 07/11] regulator: Make fixed regulator driver extract data from DT Mark Brown
2011-09-15 13:51                 ` Mark Brown
2011-09-15 13:50             ` [RFC PATCH 06/11] DT: regulator: Helper routine to extract fixed_voltage_config Mark Brown
2011-09-15 13:50               ` Mark Brown
2011-09-16  7:19               ` Rajendra Nayak
2011-09-16  7:19                 ` Rajendra Nayak
2011-09-16  9:01                 ` Mark Brown
2011-09-16  9:01                   ` Mark Brown
     [not found]                   ` <20110916090123.GE22062-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-09-16  9:26                     ` Rajendra Nayak
2011-09-16  9:26                       ` Rajendra Nayak
2011-09-15 22:19             ` Grant Likely
2011-09-15 22:19               ` Grant Likely
2011-09-15 22:18           ` [RFC PATCH 05/11] TWL: regulator: Make twl-regulator driver extract data from DT Grant Likely
2011-09-15 22:18             ` Grant Likely
2011-09-16  7:25             ` Rajendra Nayak
2011-09-16  7:25               ` Rajendra Nayak
2011-09-15 13:46         ` [RFC PATCH 04/11] omap4: SDP: Pass regulator_init_data " Mark Brown
2011-09-15 13:46           ` Mark Brown
2011-09-15 22:16           ` Grant Likely
2011-09-15 22:16             ` Grant Likely
2011-09-16  7:17           ` Rajendra Nayak
2011-09-16  7:17             ` Rajendra Nayak
2011-09-16  9:00             ` Mark Brown
2011-09-16  9:00               ` Mark Brown
2011-09-16  9:26               ` Rajendra Nayak
2011-09-16  9:26                 ` Rajendra Nayak
2011-09-15 22:15         ` Grant Likely
2011-09-15 22:15           ` Grant Likely
2011-09-15 13:44       ` [RFC PATCH 03/11] DT: regulator: Helper routine to extract regulator_init_data Mark Brown
2011-09-15 13:44         ` Mark Brown
2011-09-15 18:17         ` Rob Herring
2011-09-15 18:17           ` Rob Herring
2011-09-16  7:15         ` Rajendra Nayak
2011-09-16  7:15           ` Rajendra Nayak
2011-09-16  8:58           ` Mark Brown
2011-09-16  8:58             ` Mark Brown
2011-09-15 18:30       ` Rob Herring
2011-09-15 18:30         ` Rob Herring
2011-09-15 22:12       ` Grant Likely
2011-09-15 22:12         ` Grant Likely
2011-09-16  7:24         ` Rajendra Nayak
2011-09-16  7:24           ` Rajendra Nayak
2011-09-16  9:52           ` Mark Brown
2011-09-16  9:52             ` Mark Brown
2011-09-15 13:33     ` [RFC PATCH 02/11] regulator: Fix error check in set_consumer_device_supply Mark Brown
2011-09-15 13:33       ` Mark Brown
2011-09-16  7:12       ` Rajendra Nayak
2011-09-16  7:12         ` Rajendra Nayak
2011-09-15 13:32   ` [RFC PATCH 01/11] OMAP: TWL: Clean up mode and ops mask passed from board files Mark Brown
2011-09-15 13:32     ` Mark Brown
2011-09-16  7:11     ` Rajendra Nayak
2011-09-16  7:11       ` Rajendra Nayak
2011-09-16  8:57       ` Mark Brown
2011-09-16  8:57         ` Mark Brown
2011-09-16  9:25         ` Rajendra Nayak
2011-09-16  9:25           ` Rajendra Nayak

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=20110915135939.GO7988@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=b-cousson@ti.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=rnayak@ti.com \
    --cc=tony@atomide.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.