* [PATCH] of: fix of_update_property [v2]
@ 2014-04-01 5:51 Xiubo Li
[not found] ` <1396331486-29354-1-git-send-email-Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
[not found] ` < 20140401091920.E8E45C408A6@trevor.secretlab.ca>
0 siblings, 2 replies; 8+ messages in thread
From: Xiubo Li @ 2014-04-01 5:51 UTC (permalink / raw)
To: grant.likely-QSEj5FYQhm4dnm+yROfE0A,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: Xiubo Li
The of_update_property() is intented to update a property in a node
and if the property does not exist, will add it.
The second search of the property is possibly won't be found, that
maybe removed by other thread just before the second search begain.
Using the __of_find_property() and __of_add_property() instead and
move them into lock operations.
Signed-off-by: Xiubo Li <Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
---
drivers/of/base.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 418a4ff9..34acb37 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1767,7 +1767,7 @@ int of_update_property(struct device_node *np, struct property *newprop)
{
struct property **next, *oldprop;
unsigned long flags;
- int rc, found = 0;
+ int rc;
rc = of_property_notify(OF_RECONFIG_UPDATE_PROPERTY, np, newprop);
if (rc)
@@ -1776,25 +1776,26 @@ int of_update_property(struct device_node *np, struct property *newprop)
if (!newprop->name)
return -EINVAL;
- oldprop = of_find_property(np, newprop->name, NULL);
- if (!oldprop)
- return of_add_property(np, newprop);
-
raw_spin_lock_irqsave(&devtree_lock, flags);
- next = &np->properties;
- while (*next) {
+ oldprop = __of_find_property(np, newprop->name, NULL);
+ if (!oldprop) {
+ /* add the node */
+ rc = __of_add_property(np, newprop);
+ } else {
+ next = &np->properties;
+ while (*next && *next != oldprop)
+ next = &(*next)->next;
+
if (*next == oldprop) {
/* found the node */
newprop->next = oldprop->next;
*next = newprop;
oldprop->next = np->deadprops;
np->deadprops = oldprop;
- found = 1;
- break;
}
- next = &(*next)->next;
}
raw_spin_unlock_irqrestore(&devtree_lock, flags);
+
if (rc)
return rc;
@@ -1803,9 +1804,6 @@ int of_update_property(struct device_node *np, struct property *newprop)
sysfs_remove_bin_file(&np->kobj, &oldprop->attr);
__of_add_property_sysfs(np, newprop);
- if (!found)
- return -ENODEV;
-
return 0;
}
--
1.8.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] of: fix of_update_property [v2]
[not found] ` <1396331486-29354-1-git-send-email-Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
@ 2014-04-01 9:19 ` Grant Likely
[not found] ` <20140401091920.E8E45C408A6-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Grant Likely @ 2014-04-01 9:19 UTC (permalink / raw)
To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: Xiubo Li
On Tue, 1 Apr 2014 13:51:26 +0800, Xiubo Li <Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote:
> The of_update_property() is intented to update a property in a node
> and if the property does not exist, will add it.
>
> The second search of the property is possibly won't be found, that
> maybe removed by other thread just before the second search begain.
>
> Using the __of_find_property() and __of_add_property() instead and
> move them into lock operations.
>
> Signed-off-by: Xiubo Li <Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> ---
> drivers/of/base.c | 24 +++++++++++-------------
> 1 file changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 418a4ff9..34acb37 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1767,7 +1767,7 @@ int of_update_property(struct device_node *np, struct property *newprop)
> {
> struct property **next, *oldprop;
> unsigned long flags;
> - int rc, found = 0;
> + int rc;
>
> rc = of_property_notify(OF_RECONFIG_UPDATE_PROPERTY, np, newprop);
> if (rc)
> @@ -1776,25 +1776,26 @@ int of_update_property(struct device_node *np, struct property *newprop)
> if (!newprop->name)
> return -EINVAL;
>
> - oldprop = of_find_property(np, newprop->name, NULL);
> - if (!oldprop)
> - return of_add_property(np, newprop);
> -
> raw_spin_lock_irqsave(&devtree_lock, flags);
> - next = &np->properties;
> - while (*next) {
> + oldprop = __of_find_property(np, newprop->name, NULL);
> + if (!oldprop) {
> + /* add the node */
> + rc = __of_add_property(np, newprop);
> + } else {
if you changed this line to:
} else while (*next) {
then most of the other changes go away. You don't need the separate
while loop and the function remains largely identical aside from moving
the __of_find_property() into the spinlock.
> + next = &np->properties;
> + while (*next && *next != oldprop)
> + next = &(*next)->next;
> +
> if (*next == oldprop) {
> /* found the node */
> newprop->next = oldprop->next;
> *next = newprop;
> oldprop->next = np->deadprops;
> np->deadprops = oldprop;
> - found = 1;
> - break;
> }
> - next = &(*next)->next;
> }
> raw_spin_unlock_irqrestore(&devtree_lock, flags);
> +
> if (rc)
> return rc;
>
> @@ -1803,9 +1804,6 @@ int of_update_property(struct device_node *np, struct property *newprop)
> sysfs_remove_bin_file(&np->kobj, &oldprop->attr);
> __of_add_property_sysfs(np, newprop);
>
> - if (!found)
> - return -ENODEV;
> -
> return 0;
> }
>
> --
> 1.8.4
>
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] of: fix of_update_property [v2]
[not found] ` <20140401091920.E8E45C408A6-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
@ 2014-04-02 5:29 ` Li.Xiubo-KZfg59tc24xl57MIdRCFDg
0 siblings, 0 replies; 8+ messages in thread
From: Li.Xiubo-KZfg59tc24xl57MIdRCFDg @ 2014-04-02 5:29 UTC (permalink / raw)
To: Grant Likely, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > @@ -1776,25 +1776,26 @@ int of_update_property(struct device_node *np,
> struct property *newprop)
> > if (!newprop->name)
> > return -EINVAL;
> >
> > - oldprop = of_find_property(np, newprop->name, NULL);
> > - if (!oldprop)
> > - return of_add_property(np, newprop);
> > -
> > raw_spin_lock_irqsave(&devtree_lock, flags);
> > - next = &np->properties;
> > - while (*next) {
> > + oldprop = __of_find_property(np, newprop->name, NULL);
> > + if (!oldprop) {
> > + /* add the node */
> > + rc = __of_add_property(np, newprop);
> > + } else {
>
> if you changed this line to:
> } else while (*next) {
> then most of the other changes go away. You don't need the separate
> while loop
Yes, I will fix this.
> and the function remains largely identical aside from moving
> the __of_find_property() into the spinlock.
>
But, from the following codes, we can see that, if oldprop != NULL
Meaning that we have found it, and should just do the updatation later:
+++++++++++++++
oldprop = of_find_property(np, newprop->name, NULL);
if (!oldprop)
return of_add_property(np, newprop);
---------------
> > /* found the node */
> > newprop->next = oldprop->next;
> > *next = newprop;
> > oldprop->next = np->deadprops;
> > np->deadprops = oldprop;
> > - found = 1;
And why the 'found' flag is here is that the oldprop maybe removed
just before the spin_lock and after of_find_property().
And so use and move __of_find_property() and __of_add_property() into
the spinlock could avoid this...
Thanks,
--
BRs,
Xiubo
> > - break;
> > }
> > - next = &(*next)->next;
> > }
> > raw_spin_unlock_irqrestore(&devtree_lock, flags);
> > +
> > if (rc)
> > return rc;
> >
> > @@ -1803,9 +1804,6 @@ int of_update_property(struct device_node *np, struct
> property *newprop)
> > sysfs_remove_bin_file(&np->kobj, &oldprop->attr);
> > __of_add_property_sysfs(np, newprop);
> >
> > - if (!found)
> > - return -ENODEV;
> > -
> > return 0;
> > }
> >
> > --
> > 1.8.4
> >
> >
>
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] of: fix of_update_property [v2]
[not found] ` <9622800c30f5412a9bbb9dfd95def751-+7O3WWA3DPshjIn37xzcLOO6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
@ 2014-04-03 17:51 ` Grant Likely
[not found] ` <20140403175112.DF1FFC4200D-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Grant Likely @ 2014-04-03 17:51 UTC (permalink / raw)
To: Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Wed, 2 Apr 2014 05:29:53 +0000, "Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org" <Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote:
>
>
> > > @@ -1776,25 +1776,26 @@ int of_update_property(struct device_node *np,
> > struct property *newprop)
> > > if (!newprop->name)
> > > return -EINVAL;
> > >
> > > - oldprop = of_find_property(np, newprop->name, NULL);
> > > - if (!oldprop)
> > > - return of_add_property(np, newprop);
> > > -
> > > raw_spin_lock_irqsave(&devtree_lock, flags);
> > > - next = &np->properties;
> > > - while (*next) {
> > > + oldprop = __of_find_property(np, newprop->name, NULL);
> > > + if (!oldprop) {
> > > + /* add the node */
> > > + rc = __of_add_property(np, newprop);
> > > + } else {
> >
> > if you changed this line to:
> > } else while (*next) {
> > then most of the other changes go away. You don't need the separate
> > while loop
>
> Yes, I will fix this.
>
>
> > and the function remains largely identical aside from moving
> > the __of_find_property() into the spinlock.
> >
>
> But, from the following codes, we can see that, if oldprop != NULL
> Meaning that we have found it, and should just do the updatation later:
> +++++++++++++++
> oldprop = of_find_property(np, newprop->name, NULL);
> if (!oldprop)
> return of_add_property(np, newprop);
> ---------------
>
>
>
> > > /* found the node */
> > > newprop->next = oldprop->next;
> > > *next = newprop;
> > > oldprop->next = np->deadprops;
> > > np->deadprops = oldprop;
> > > - found = 1;
>
> And why the 'found' flag is here is that the oldprop maybe removed
> just before the spin_lock and after of_find_property().
>
> And so use and move __of_find_property() and __of_add_property() into
> the spinlock could avoid this...
Isn't that what I said?
g.
>
>
> Thanks,
> --
>
> BRs,
> Xiubo
>
>
> > > - break;
> > > }
> > > - next = &(*next)->next;
> > > }
> > > raw_spin_unlock_irqrestore(&devtree_lock, flags);
> > > +
> > > if (rc)
> > > return rc;
> > >
> > > @@ -1803,9 +1804,6 @@ int of_update_property(struct device_node *np, struct
> > property *newprop)
> > > sysfs_remove_bin_file(&np->kobj, &oldprop->attr);
> > > __of_add_property_sysfs(np, newprop);
> > >
> > > - if (!found)
> > > - return -ENODEV;
> > > -
> > > return 0;
> > > }
> > >
> > > --
> > > 1.8.4
> > >
> > >
> >
> >
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] of: fix of_update_property [v2]
[not found] ` <20140403175112.DF1FFC4200D-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
@ 2014-04-04 8:00 ` Li.Xiubo-KZfg59tc24xl57MIdRCFDg
2014-04-04 8:30 ` Li.Xiubo-KZfg59tc24xl57MIdRCFDg
1 sibling, 0 replies; 8+ messages in thread
From: Li.Xiubo-KZfg59tc24xl57MIdRCFDg @ 2014-04-04 8:00 UTC (permalink / raw)
To: Grant Likely, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > > and the function remains largely identical aside from moving
> > > the __of_find_property() into the spinlock.
> > >
> >
> > But, from the following codes, we can see that, if oldprop != NULL
> > Meaning that we have found it, and should just do the updatation later:
> > +++++++++++++++
> > oldprop = of_find_property(np, newprop->name, NULL);
> > if (!oldprop)
> > return of_add_property(np, newprop);
> > ---------------
> >
> >
> >
> > > > /* found the node */
> > > > newprop->next = oldprop->next;
> > > > *next = newprop;
> > > > oldprop->next = np->deadprops;
> > > > np->deadprops = oldprop;
> > > > - found = 1;
> >
> > And why the 'found' flag is here is that the oldprop maybe removed
> > just before the spin_lock and after of_find_property().
> >
> > And so use and move __of_find_property() and __of_add_property() into
> > the spinlock could avoid this...
>
> Isn't that what I said?
Yes, maybe my not thoroughly understanding of your last mail before.
Thanks,
BRs
Xiubo
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] of: fix of_update_property [v2]
[not found] ` <20140403175112.DF1FFC4200D-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2014-04-04 8:00 ` Li.Xiubo-KZfg59tc24xl57MIdRCFDg
@ 2014-04-04 8:30 ` Li.Xiubo-KZfg59tc24xl57MIdRCFDg
1 sibling, 0 replies; 8+ messages in thread
From: Li.Xiubo-KZfg59tc24xl57MIdRCFDg @ 2014-04-04 8:30 UTC (permalink / raw)
To: Grant Likely, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Subject: RE: [PATCH] of: fix of_update_property [v2]
>
> On Wed, 2 Apr 2014 05:29:53 +0000, "Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org"
> <Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote:
> >
> >
> > > > @@ -1776,25 +1776,26 @@ int of_update_property(struct device_node *np,
> > > struct property *newprop)
> > > > if (!newprop->name)
> > > > return -EINVAL;
> > > >
> > > > - oldprop = of_find_property(np, newprop->name, NULL);
> > > > - if (!oldprop)
> > > > - return of_add_property(np, newprop);
> > > > -
> > > > raw_spin_lock_irqsave(&devtree_lock, flags);
> > > > - next = &np->properties;
> > > > - while (*next) {
> > > > + oldprop = __of_find_property(np, newprop->name, NULL);
> > > > + if (!oldprop) {
> > > > + /* add the node */
> > > > + rc = __of_add_property(np, newprop);
> > > > + } else {
> > >
> > > if you changed this line to:
> > > } else while (*next) {
> > > then most of the other changes go away. You don't need the separate
> > > while loop
> >
Well, this will output some errors by using the './scripts/checkpatch.pl'
Checking.
$ ./scripts/checkpatch.pl
ERROR: trailing statements should be on next line
#1785: FILE: of/base.c:1785:
+ else while (*next) {
ERROR: trailing statements should be on next line
#1785: FILE: of/base.c:1785:
+ else while (*next) {
Should be split into two lines...
Thanks,
BRs
Xiubo
> > Yes, I will fix this.
> >
> >
> > > and the function remains largely identical aside from moving
> > > the __of_find_property() into the spinlock.
> > >
> >
> > But, from the following codes, we can see that, if oldprop != NULL
> > Meaning that we have found it, and should just do the updatation later:
> > +++++++++++++++
> > oldprop = of_find_property(np, newprop->name, NULL);
> > if (!oldprop)
> > return of_add_property(np, newprop);
> > ---------------
> >
> >
> >
> > > > /* found the node */
> > > > newprop->next = oldprop->next;
> > > > *next = newprop;
> > > > oldprop->next = np->deadprops;
> > > > np->deadprops = oldprop;
> > > > - found = 1;
> >
> > And why the 'found' flag is here is that the oldprop maybe removed
> > just before the spin_lock and after of_find_property().
> >
> > And so use and move __of_find_property() and __of_add_property() into
> > the spinlock could avoid this...
>
> Isn't that what I said?
>
> g.
>
> >
> >
> > Thanks,
> > --
> >
> > BRs,
> > Xiubo
> >
> >
> > > > - break;
> > > > }
> > > > - next = &(*next)->next;
> > > > }
> > > > raw_spin_unlock_irqrestore(&devtree_lock, flags);
> > > > +
> > > > if (rc)
> > > > return rc;
> > > >
> > > > @@ -1803,9 +1804,6 @@ int of_update_property(struct device_node *np,
> struct
> > > property *newprop)
> > > > sysfs_remove_bin_file(&np->kobj, &oldprop->attr);
> > > > __of_add_property_sysfs(np, newprop);
> > > >
> > > > - if (!found)
> > > > - return -ENODEV;
> > > > -
> > > > return 0;
> > > > }
> > > >
> > > > --
> > > > 1.8.4
> > > >
> > > >
> > >
> > >
> >
>
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] of: fix of_update_property [v2]
[not found] ` <179ad743feea49bb946a3b31a629e229-+7O3WWA3DPshjIn37xzcLOO6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
@ 2014-04-04 14:28 ` Grant Likely
[not found] ` <20140404142855.D6C42C41E5F-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Grant Likely @ 2014-04-04 14:28 UTC (permalink / raw)
To: Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Fri, 4 Apr 2014 08:30:42 +0000, "Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org" <Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote:
> > Subject: RE: [PATCH] of: fix of_update_property [v2]
> >
> > On Wed, 2 Apr 2014 05:29:53 +0000, "Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org"
> > <Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote:
> > >
> > >
> > > > > @@ -1776,25 +1776,26 @@ int of_update_property(struct device_node *np,
> > > > struct property *newprop)
> > > > > if (!newprop->name)
> > > > > return -EINVAL;
> > > > >
> > > > > - oldprop = of_find_property(np, newprop->name, NULL);
> > > > > - if (!oldprop)
> > > > > - return of_add_property(np, newprop);
> > > > > -
> > > > > raw_spin_lock_irqsave(&devtree_lock, flags);
> > > > > - next = &np->properties;
> > > > > - while (*next) {
> > > > > + oldprop = __of_find_property(np, newprop->name, NULL);
> > > > > + if (!oldprop) {
> > > > > + /* add the node */
> > > > > + rc = __of_add_property(np, newprop);
> > > > > + } else {
> > > >
> > > > if you changed this line to:
> > > > } else while (*next) {
> > > > then most of the other changes go away. You don't need the separate
> > > > while loop
> > >
>
> Well, this will output some errors by using the './scripts/checkpatch.pl'
> Checking.
>
> $ ./scripts/checkpatch.pl
>
> ERROR: trailing statements should be on next line
> #1785: FILE: of/base.c:1785:
> + else while (*next) {
>
> ERROR: trailing statements should be on next line
> #1785: FILE: of/base.c:1785:
> + else while (*next) {
>
> Should be split into two lines...
Checkpatch is wrong. I won't reject that approach.
g.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] of: fix of_update_property [v2]
[not found] ` <20140404142855.D6C42C41E5F-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
@ 2014-04-08 1:57 ` Li.Xiubo-KZfg59tc24xl57MIdRCFDg
0 siblings, 0 replies; 8+ messages in thread
From: Li.Xiubo-KZfg59tc24xl57MIdRCFDg @ 2014-04-08 1:57 UTC (permalink / raw)
To: Grant Likely, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Subject: RE: [PATCH] of: fix of_update_property [v2]
>
> On Fri, 4 Apr 2014 08:30:42 +0000, "Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org"
> <Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote:
> > > Subject: RE: [PATCH] of: fix of_update_property [v2]
> > >
> > > On Wed, 2 Apr 2014 05:29:53 +0000, "Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org"
> > > <Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org> wrote:
> > > >
> > > >
> > > > > > @@ -1776,25 +1776,26 @@ int of_update_property(struct device_node
> *np,
> > > > > struct property *newprop)
> > > > > > if (!newprop->name)
> > > > > > return -EINVAL;
> > > > > >
> > > > > > - oldprop = of_find_property(np, newprop->name, NULL);
> > > > > > - if (!oldprop)
> > > > > > - return of_add_property(np, newprop);
> > > > > > -
> > > > > > raw_spin_lock_irqsave(&devtree_lock, flags);
> > > > > > - next = &np->properties;
> > > > > > - while (*next) {
> > > > > > + oldprop = __of_find_property(np, newprop->name, NULL);
> > > > > > + if (!oldprop) {
> > > > > > + /* add the node */
> > > > > > + rc = __of_add_property(np, newprop);
> > > > > > + } else {
> > > > >
> > > > > if you changed this line to:
> > > > > } else while (*next) {
> > > > > then most of the other changes go away. You don't need the separate
> > > > > while loop
> > > >
> >
> > Well, this will output some errors by using the './scripts/checkpatch.pl'
> > Checking.
> >
> > $ ./scripts/checkpatch.pl
> >
> > ERROR: trailing statements should be on next line
> > #1785: FILE: of/base.c:1785:
> > + else while (*next) {
> >
> > ERROR: trailing statements should be on next line
> > #1785: FILE: of/base.c:1785:
> > + else while (*next) {
> >
> > Should be split into two lines...
>
> Checkpatch is wrong. I won't reject that approach.
>
Okey, I have sent one version, should I send it again ?
Thanks,
Brs
Xiubo
> g.
>
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-04-08 1:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-01 5:51 [PATCH] of: fix of_update_property [v2] Xiubo Li
[not found] ` <1396331486-29354-1-git-send-email-Li.Xiubo-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2014-04-01 9:19 ` Grant Likely
[not found] ` <20140401091920.E8E45C408A6-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2014-04-02 5:29 ` Li.Xiubo-KZfg59tc24xl57MIdRCFDg
[not found] ` < 20140401091920.E8E45C408A6@trevor.secretlab.ca>
[not found] ` < 9622800c30f5412a9bbb9dfd95def751@BY2PR03MB505.namprd03.prod.outlook.com>
[not found] ` <9622800c30f5412a9bbb9dfd95def751-+7O3WWA3DPshjIn37xzcLOO6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
2014-04-03 17:51 ` Grant Likely
[not found] ` <20140403175112.DF1FFC4200D-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2014-04-04 8:00 ` Li.Xiubo-KZfg59tc24xl57MIdRCFDg
2014-04-04 8:30 ` Li.Xiubo-KZfg59tc24xl57MIdRCFDg
[not found] ` < 20140403175112.DF1FFC4200D@trevor.secretlab.ca>
[not found] ` < 179ad743feea49bb946a3b31a629e229@BY2PR03MB505.namprd03.prod.outlook.com>
[not found] ` <179ad743feea49bb946a3b31a629e229-+7O3WWA3DPshjIn37xzcLOO6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
2014-04-04 14:28 ` Grant Likely
[not found] ` <20140404142855.D6C42C41E5F-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2014-04-08 1:57 ` Li.Xiubo-KZfg59tc24xl57MIdRCFDg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).