[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAG374jDFbXi+LEyXbqu_YgXT1Opp-Mb5Pp_5Jbug5Y9zEeSyYQ@mail.gmail.com>
Date: Thu, 14 Aug 2014 14:37:06 +0200
From: Gabriel Fernandez <gabriel.fernandez@...aro.org>
To: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Cc: Gabriel FERNANDEZ <gabriel.fernandez@...com>,
Rob Herring <robh+dt@...nel.org>,
Pawel Moll <pawel.moll@....com>,
Mark Rutland <mark.rutland@....com>,
Ian Campbell <ijc+devicetree@...lion.org.uk>,
Kumar Gala <galak@...eaurora.org>,
Srinivas Kandagatla <srinivas.kandagatla@...il.com>,
Maxime Coquelin <maxime.coquelin@...com>,
Patrice Chotard <patrice.chotard@...com>,
Russell King <linux@....linux.org.uk>,
Kishon Vijay Abraham I <kishon@...com>,
Grant Likely <grant.likely@...aro.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
alexandre torgue <alexandre.torgue@...com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
Giuseppe Cavallaro <peppe.cavallaro@...com>,
"kernel@...inux.com" <kernel@...inux.com>
Subject: Re: [PATCH 3/5] phy: miphy28lp: Provide support for the MiPHY28lp
Generic PHY
Hi Srini,
On 14 August 2014 14:15, Srinivas Kandagatla
<srinivas.kandagatla@...aro.org> wrote:
> Hi Gabi,
>
> I did not review the full patchset but this function caught my attention..
>
>
>> +};
>> +
>> +static int miphy28lp_get_ressource_byname(struct device_node *child,
>> + char *name, struct resource
>> *res)
>> +{
>
>
> s/miphy28lp_get_ressource_byname/miphy28lp_get_resource_byname
ok
>
>
>> + int index, ret = 0, count = 0;
>> + int reg_tuple_size;
>> + const __be32 *p;
>> +
>> + reg_tuple_size = (of_n_addr_cells(child) +
>> + of_n_size_cells(child)) * sizeof(u32);
>> +
>> + p = of_get_property(child, "reg", &count);
>> + if (count % reg_tuple_size != 0)
>> + ret = -EINVAL;
>> +
>> + count /= reg_tuple_size;
>> +
>> + for (index = 0; index < count; index++) {
>> + const char *rname = NULL;
>> +
>> + ret = of_property_read_string_index(child, "reg-names",
>> + index, &rname);
>> + if (!strcmp(name, rname))
>> + return of_address_to_resource(child, index, res);
>> + }
>> +
>> + return 1;
>
> This function looks bit complicated, can't we just use:
>
> index = of_property_match_string(np, "reg-names", rname);
> if (index < 0)
> return -ENODEV;
>
> return of_address_to_resource(child, index, res);
Indeed it's a little bit simpler... :)
>
>
>
> --srini
Thanks a lot Srini
Best Regards
Gabriel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists