* [PATCH] Use of_get_next_child() in k2_sata_proc_info()
@ 2007-10-24 4:25 Michael Ellerman
2007-10-24 5:01 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2007-10-24 4:25 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, jgarzik
k2_sata_proc_info() uses its own hand-rolled loop to check a nodes
children for a property, this is not safe WRT refcounting, so fix it
to use of_get_next_child().
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
drivers/ata/sata_svw.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index 12d613c..64c3812 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -289,7 +289,10 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
/* Match it to a port node */
index = (ap == ap->host->ports[0]) ? 0 : 1;
- for (np = np->child; np != NULL; np = np->sibling) {
+
+ for (np = of_get_next_child(np, NULL);
+ np != NULL;
+ np = of_get_next_child(np, np)) {
const u32 *reg = of_get_property(np, "reg", NULL);
if (!reg)
continue;
--
1.5.1.3.g7a33b
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Use of_get_next_child() in k2_sata_proc_info()
2007-10-24 4:25 [PATCH] Use of_get_next_child() in k2_sata_proc_info() Michael Ellerman
@ 2007-10-24 5:01 ` Benjamin Herrenschmidt
2007-10-24 5:31 ` Michael Ellerman
2007-10-24 6:04 ` Jeff Garzik
0 siblings, 2 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2007-10-24 5:01 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, jgarzik
On Wed, 2007-10-24 at 14:25 +1000, Michael Ellerman wrote:
> k2_sata_proc_info() uses its own hand-rolled loop to check a nodes
> children for a property, this is not safe WRT refcounting, so fix it
> to use of_get_next_child().
>
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
(Pending you test boot it on one of our G5s first !)
> ---
> drivers/ata/sata_svw.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
> index 12d613c..64c3812 100644
> --- a/drivers/ata/sata_svw.c
> +++ b/drivers/ata/sata_svw.c
> @@ -289,7 +289,10 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
>
> /* Match it to a port node */
> index = (ap == ap->host->ports[0]) ? 0 : 1;
> - for (np = np->child; np != NULL; np = np->sibling) {
> +
> + for (np = of_get_next_child(np, NULL);
> + np != NULL;
> + np = of_get_next_child(np, np)) {
> const u32 *reg = of_get_property(np, "reg", NULL);
> if (!reg)
> continue;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Use of_get_next_child() in k2_sata_proc_info()
2007-10-24 5:01 ` Benjamin Herrenschmidt
@ 2007-10-24 5:31 ` Michael Ellerman
2007-10-24 6:04 ` Jeff Garzik
1 sibling, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2007-10-24 5:31 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, jgarzik
[-- Attachment #1: Type: text/plain, Size: 845 bytes --]
On Wed, 2007-10-24 at 15:01 +1000, Benjamin Herrenschmidt wrote:
> On Wed, 2007-10-24 at 14:25 +1000, Michael Ellerman wrote:
> > k2_sata_proc_info() uses its own hand-rolled loop to check a nodes
> > children for a property, this is not safe WRT refcounting, so fix it
> > to use of_get_next_child().
> >
> > Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
>
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> (Pending you test boot it on one of our G5s first !)
As if I'd send untested patches !!
...
It just booted and seems happy.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Use of_get_next_child() in k2_sata_proc_info()
2007-10-24 5:01 ` Benjamin Herrenschmidt
2007-10-24 5:31 ` Michael Ellerman
@ 2007-10-24 6:04 ` Jeff Garzik
2007-10-24 6:23 ` Michael Ellerman
1 sibling, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2007-10-24 6:04 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev
Benjamin Herrenschmidt wrote:
> On Wed, 2007-10-24 at 14:25 +1000, Michael Ellerman wrote:
>> k2_sata_proc_info() uses its own hand-rolled loop to check a nodes
>> children for a property, this is not safe WRT refcounting, so fix it
>> to use of_get_next_child().
>>
>> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
>
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> (Pending you test boot it on one of our G5s first !)
>
>> ---
>> drivers/ata/sata_svw.c | 5 ++++-
>> 1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
>> index 12d613c..64c3812 100644
>> --- a/drivers/ata/sata_svw.c
>> +++ b/drivers/ata/sata_svw.c
>> @@ -289,7 +289,10 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
>>
>> /* Match it to a port node */
>> index = (ap == ap->host->ports[0]) ? 0 : 1;
>> - for (np = np->child; np != NULL; np = np->sibling) {
>> +
>> + for (np = of_get_next_child(np, NULL);
>> + np != NULL;
>> + np = of_get_next_child(np, np)) {
>> const u32 *reg = of_get_property(np, "reg", NULL);
This sort of thing I would prefer to ACK (ACK!), and let it go upstream
via the powerpc tree.
Jeff
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Use of_get_next_child() in k2_sata_proc_info()
2007-10-24 6:04 ` Jeff Garzik
@ 2007-10-24 6:23 ` Michael Ellerman
0 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2007-10-24 6:23 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 1743 bytes --]
On Wed, 2007-10-24 at 02:04 -0400, Jeff Garzik wrote:
> Benjamin Herrenschmidt wrote:
> > On Wed, 2007-10-24 at 14:25 +1000, Michael Ellerman wrote:
> >> k2_sata_proc_info() uses its own hand-rolled loop to check a nodes
> >> children for a property, this is not safe WRT refcounting, so fix it
> >> to use of_get_next_child().
> >>
> >> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> >
> > Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >
> > (Pending you test boot it on one of our G5s first !)
> >
> >> ---
> >> drivers/ata/sata_svw.c | 5 ++++-
> >> 1 files changed, 4 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
> >> index 12d613c..64c3812 100644
> >> --- a/drivers/ata/sata_svw.c
> >> +++ b/drivers/ata/sata_svw.c
> >> @@ -289,7 +289,10 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
> >>
> >> /* Match it to a port node */
> >> index = (ap == ap->host->ports[0]) ? 0 : 1;
> >> - for (np = np->child; np != NULL; np = np->sibling) {
> >> +
> >> + for (np = of_get_next_child(np, NULL);
> >> + np != NULL;
> >> + np = of_get_next_child(np, np)) {
> >> const u32 *reg = of_get_property(np, "reg", NULL);
>
> This sort of thing I would prefer to ACK (ACK!), and let it go upstream
> via the powerpc tree.
Sure thing, just ACK (ACK!) (ACK?) it, and I'll pester paulus to merge
it via his tree.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-10-24 6:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-24 4:25 [PATCH] Use of_get_next_child() in k2_sata_proc_info() Michael Ellerman
2007-10-24 5:01 ` Benjamin Herrenschmidt
2007-10-24 5:31 ` Michael Ellerman
2007-10-24 6:04 ` Jeff Garzik
2007-10-24 6:23 ` Michael Ellerman
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).