From: Rob Herring <robherring2@gmail.com> To: Benoit Cousson <b-cousson@ti.com> Cc: grant.likely@secretlab.ca, devicetree-discuss@lists.ozlabs.org, tony@atomide.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 1/3] of/base: Take NULL string into account for property with multiple strings Date: Mon, 19 Dec 2011 08:02:41 -0600 [thread overview] Message-ID: <4EEF4401.1060303@gmail.com> (raw) In-Reply-To: <1323095036-3739-2-git-send-email-b-cousson@ti.com> On 12/05/2011 08:23 AM, Benoit Cousson wrote: > The current implementation just ignore any NULL string inserted in a > multiple strings property. > In some cases we can have a property with a fix number of strings but > not necessarily used, like for example in a list of valid pinmux modes. > > prop = "uart_rx", "uart_tx", "", "", "safe_mode"; > > Do no skip NULL string and take them into account in > of_property_read_string_index and of_property_count_strings. > > Reported-by: Tony Lindgren <tony@atomide.com> > Signed-off-by: Benoit Cousson <b-cousson@ti.com> > Cc: Grant Likely <grant.likely@secretlab.ca> > Cc: Rob Herring <rob.herring@calxeda.com> Applied. The others need Grant's agreement. Rob > --- > drivers/of/base.c | 8 +++----- > 1 files changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/of/base.c b/drivers/of/base.c > index 9b6588e..b707243 100644 > --- a/drivers/of/base.c > +++ b/drivers/of/base.c > @@ -752,7 +752,7 @@ int of_property_read_string_index(struct device_node *np, const char *propname, > > for (i = 0; total < prop->length; total += l, p += l) { > l = strlen(p) + 1; > - if ((*p != 0) && (i++ == index)) { > + if (i++ == index) { > *output = p; > return 0; > } > @@ -790,11 +790,9 @@ int of_property_count_strings(struct device_node *np, const char *propname) > > p = prop->value; > > - for (i = 0; total < prop->length; total += l, p += l) { > + for (i = 0; total < prop->length; total += l, p += l, i++) > l = strlen(p) + 1; > - if (*p != 0) > - i++; > - } > + > return i; > } > EXPORT_SYMBOL_GPL(of_property_count_strings);
WARNING: multiple messages have this Message-ID (diff)
From: robherring2@gmail.com (Rob Herring) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] of/base: Take NULL string into account for property with multiple strings Date: Mon, 19 Dec 2011 08:02:41 -0600 [thread overview] Message-ID: <4EEF4401.1060303@gmail.com> (raw) In-Reply-To: <1323095036-3739-2-git-send-email-b-cousson@ti.com> On 12/05/2011 08:23 AM, Benoit Cousson wrote: > The current implementation just ignore any NULL string inserted in a > multiple strings property. > In some cases we can have a property with a fix number of strings but > not necessarily used, like for example in a list of valid pinmux modes. > > prop = "uart_rx", "uart_tx", "", "", "safe_mode"; > > Do no skip NULL string and take them into account in > of_property_read_string_index and of_property_count_strings. > > Reported-by: Tony Lindgren <tony@atomide.com> > Signed-off-by: Benoit Cousson <b-cousson@ti.com> > Cc: Grant Likely <grant.likely@secretlab.ca> > Cc: Rob Herring <rob.herring@calxeda.com> Applied. The others need Grant's agreement. Rob > --- > drivers/of/base.c | 8 +++----- > 1 files changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/of/base.c b/drivers/of/base.c > index 9b6588e..b707243 100644 > --- a/drivers/of/base.c > +++ b/drivers/of/base.c > @@ -752,7 +752,7 @@ int of_property_read_string_index(struct device_node *np, const char *propname, > > for (i = 0; total < prop->length; total += l, p += l) { > l = strlen(p) + 1; > - if ((*p != 0) && (i++ == index)) { > + if (i++ == index) { > *output = p; > return 0; > } > @@ -790,11 +790,9 @@ int of_property_count_strings(struct device_node *np, const char *propname) > > p = prop->value; > > - for (i = 0; total < prop->length; total += l, p += l) { > + for (i = 0; total < prop->length; total += l, p += l, i++) > l = strlen(p) + 1; > - if (*p != 0) > - i++; > - } > + > return i; > } > EXPORT_SYMBOL_GPL(of_property_count_strings);
next prev parent reply other threads:[~2011-12-19 14:02 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-12-05 14:23 [PATCH 0/3] of: Add support for named irq and reg Benoit Cousson 2011-12-05 14:23 ` Benoit Cousson 2011-12-05 14:23 ` [PATCH 1/3] of/base: Take NULL string into account for property with multiple strings Benoit Cousson 2011-12-05 14:23 ` Benoit Cousson 2011-12-14 18:18 ` Tony Lindgren 2011-12-14 18:18 ` Tony Lindgren 2011-12-19 14:02 ` Rob Herring [this message] 2011-12-19 14:02 ` Rob Herring 2012-01-03 14:15 ` Cousson, Benoit 2012-01-03 14:15 ` Cousson, Benoit 2012-01-04 7:34 ` Grant Likely 2012-01-04 7:34 ` Grant Likely 2011-12-05 14:23 ` [PATCH 2/3] of/address: Add reg-names property to name an iomem resource Benoit Cousson 2011-12-05 14:23 ` Benoit Cousson 2011-12-05 14:23 ` [PATCH 3/3] of/irq: Add interrupts-names property to name an irq resource Benoit Cousson 2011-12-05 14:23 ` Benoit Cousson 2012-01-04 7:17 ` Grant Likely 2012-01-04 7:17 ` Grant Likely [not found] ` <20120104071749.GA15503-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org> 2012-01-04 14:15 ` Cousson, Benoit 2012-01-04 14:15 ` Cousson, Benoit 2011-12-19 13:50 ` [PATCH 0/3] of: Add support for named irq and reg Cousson, Benoit 2011-12-19 13:50 ` Cousson, Benoit
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=4EEF4401.1060303@gmail.com \ --to=robherring2@gmail.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=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: linkBe 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.