[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120412155917.GC3195@opensource.wolfsonmicro.com>
Date: Thu, 12 Apr 2012 16:59:18 +0100
From: Mark Brown <broonie@...nsource.wolfsonmicro.com>
To: "Ying-Chun Liu (PaulLiu)" <paul.liu@...aro.org>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linaro-dev@...ts.linaro.org, patches@...aro.org,
Liam Girdwood <lrg@...com>,
Samuel Ortiz <sameo@...ux.intel.com>,
Shawn Guo <shawn.guo@...aro.org>,
Ashish Jangam <ashish.jangam@...tcummins.com>
Subject: Re: [PATCH 2/2] regulator: da9052: add device tree support
On Thu, Apr 12, 2012 at 11:39:42PM +0800, Ying-Chun Liu (PaulLiu) wrote:
> +#ifdef CONFIG_OF
> + struct device_node *nproot = da9052->dev->of_node;
> + struct device_node *np;
> + int c;
> +
> + if (!nproot) {
> + ret = -ENODEV;
> + goto err;
> + }
> +
> + nproot = of_find_node_by_name(nproot, "regulators");
> + if (!nproot) {
> + ret = -ENODEV;
> + goto err;
> + }
> +
> + c = 0;
> + for (np = of_get_next_child(nproot, NULL);
> + np != NULL;
> + np = of_get_next_child(nproot, np)) {
> + if (c == pdev->id) {
> + initdata = of_get_regulator_init_data(
> + &pdev->dev, np);
> + break;
> + }
> + c++;
> + }
This is really quite unclear but it looks like this is relying on the
order of regulators in the OF table to match things. As I said in my
reply to the first patch this is really poor for usability and it's
also making the code here more obscure - we should be looking for the
regulator nodes by name.
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists