All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabriel Fernandez <gabriel.fernandez@linaro.org>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Gabriel FERNANDEZ <gabriel.fernandez@st.com>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Srinivas Kandagatla <srinivas.kandagatla@gmail.com>,
	Maxime Coquelin <maxime.coquelin@st.com>,
	Patrice Chotard <patrice.chotard@st.com>,
	Russell King <linux@arm.linux.org.uk>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Grant Likely <grant.likely@linaro.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	alexandre torgue <alexandre.torgue@st.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	"kernel@stlinux.com" <kernel@stlinux.com>
Subject: Re: [PATCH 3/5] phy: miphy28lp: Provide support for the MiPHY28lp Generic PHY
Date: Thu, 14 Aug 2014 14:37:06 +0200	[thread overview]
Message-ID: <CAG374jDFbXi+LEyXbqu_YgXT1Opp-Mb5Pp_5Jbug5Y9zEeSyYQ@mail.gmail.com> (raw)
In-Reply-To: <53ECA866.2080306@linaro.org>

Hi Srini,


On 14 August 2014 14:15, Srinivas Kandagatla
<srinivas.kandagatla@linaro.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

WARNING: multiple messages have this Message-ID (diff)
From: gabriel.fernandez@linaro.org (Gabriel Fernandez)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/5] phy: miphy28lp: Provide support for the MiPHY28lp Generic PHY
Date: Thu, 14 Aug 2014 14:37:06 +0200	[thread overview]
Message-ID: <CAG374jDFbXi+LEyXbqu_YgXT1Opp-Mb5Pp_5Jbug5Y9zEeSyYQ@mail.gmail.com> (raw)
In-Reply-To: <53ECA866.2080306@linaro.org>

Hi Srini,


On 14 August 2014 14:15, Srinivas Kandagatla
<srinivas.kandagatla@linaro.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

  reply	other threads:[~2014-08-14 12:37 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13 15:34 [PATCH 0/5] phy: miphy28lp: Introduce support for MiPHY28lp Gabriel FERNANDEZ
2014-08-13 15:34 ` Gabriel FERNANDEZ
2014-08-13 15:34 ` Gabriel FERNANDEZ
2014-08-13 15:34 ` [PATCH 1/5] phy: miphy28lp: Add Device Tree bindings for the MiPHY28lp Gabriel FERNANDEZ
2014-08-13 15:34   ` Gabriel FERNANDEZ
2014-08-20 14:56   ` Kishon Vijay Abraham I
2014-08-20 14:56     ` Kishon Vijay Abraham I
2014-08-20 14:56     ` Kishon Vijay Abraham I
2014-08-21  7:12     ` Gabriel Fernandez
2014-08-21  7:12       ` Gabriel Fernandez
2014-08-21  7:12       ` Gabriel Fernandez
2014-08-13 15:34 ` [PATCH 2/5] phy: miphy28lp: Add MiPHY28lp header file for DT x Driver defines Gabriel FERNANDEZ
2014-08-13 15:34   ` Gabriel FERNANDEZ
2014-08-13 15:34   ` Gabriel FERNANDEZ
2014-08-20 14:53   ` Kishon Vijay Abraham I
2014-08-20 14:53     ` Kishon Vijay Abraham I
2014-08-20 14:53     ` Kishon Vijay Abraham I
2014-08-21  7:12     ` Gabriel Fernandez
2014-08-21  7:12       ` Gabriel Fernandez
2014-08-21  7:12       ` Gabriel Fernandez
2014-08-13 15:34 ` [PATCH 3/5] phy: miphy28lp: Provide support for the MiPHY28lp Generic PHY Gabriel FERNANDEZ
2014-08-13 15:34   ` Gabriel FERNANDEZ
2014-08-14 12:15   ` Srinivas Kandagatla
2014-08-14 12:15     ` Srinivas Kandagatla
2014-08-14 12:37     ` Gabriel Fernandez [this message]
2014-08-14 12:37       ` Gabriel Fernandez
2014-08-14 12:37       ` Gabriel Fernandez
2014-08-20 14:58   ` Kishon Vijay Abraham I
2014-08-20 14:58     ` Kishon Vijay Abraham I
2014-08-20 14:58     ` Kishon Vijay Abraham I
2014-08-21  7:12     ` Gabriel Fernandez
2014-08-21  7:12       ` Gabriel Fernandez
2014-08-21  7:12       ` Gabriel Fernandez
2014-08-13 15:34 ` [PATCH 4/5] ARM: DT: STi: STiH407: Add DT node for MiPHY28lp Gabriel FERNANDEZ
2014-08-13 15:34   ` Gabriel FERNANDEZ
2014-08-13 15:34   ` Gabriel FERNANDEZ
2014-08-13 15:34 ` [PATCH 5/5] ARM: multi_v7_defconfig: Enable MiPHY28lp - ST's Generic (SATA, PCIe & USB3) PHY Gabriel FERNANDEZ
2014-08-13 15:34   ` Gabriel FERNANDEZ
2014-08-13 15:34   ` Gabriel FERNANDEZ

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=CAG374jDFbXi+LEyXbqu_YgXT1Opp-Mb5Pp_5Jbug5Y9zEeSyYQ@mail.gmail.com \
    --to=gabriel.fernandez@linaro.org \
    --cc=alexandre.torgue@st.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gabriel.fernandez@st.com \
    --cc=galak@codeaurora.org \
    --cc=grant.likely@linaro.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=kernel@stlinux.com \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=maxime.coquelin@st.com \
    --cc=patrice.chotard@st.com \
    --cc=pawel.moll@arm.com \
    --cc=peppe.cavallaro@st.com \
    --cc=robh+dt@kernel.org \
    --cc=srinivas.kandagatla@gmail.com \
    --cc=srinivas.kandagatla@linaro.org \
    /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.