linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mpc85xx_ads: add in missing of_node_put()
@ 2007-12-21 15:40 Paul Gortmaker
  2007-12-22 22:50 ` Stephen Rothwell
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Gortmaker @ 2007-12-21 15:40 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: sfr

cpm2_pic_init() does its own of_node_get() so we should do an of_node_put()
before calling it. This and other coding style cleanups as suggested by
Stephen Rothwell.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 arch/powerpc/platforms/85xx/mpc85xx_ads.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index bccdc25..ea4886f 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -52,9 +52,9 @@ static void cpm2_cascade(unsigned int irq, struct irq_desc *desc)
 {
 	int cascade_irq;
 
-	while ((cascade_irq = cpm2_get_irq()) >= 0) {
+	while ((cascade_irq = cpm2_get_irq()) >= 0)
 		generic_handle_irq(cascade_irq);
-	}
+
 	desc->chip->eoi(irq);
 }
 
@@ -70,13 +70,12 @@ static void __init mpc85xx_ads_pic_init(void)
 #endif
 
 	np = of_find_node_by_type(np, "open-pic");
-
-	if (np == NULL) {
+	if (!np) {
 		printk(KERN_ERR "Could not find open-pic node\n");
 		return;
 	}
 
-	if(of_address_to_resource(np, 0, &r)) {
+	if (of_address_to_resource(np, 0, &r)) {
 		printk(KERN_ERR "Could not map mpic register space\n");
 		of_node_put(np);
 		return;
@@ -98,6 +97,7 @@ static void __init mpc85xx_ads_pic_init(void)
 		return;
 	}
 	irq = irq_of_parse_and_map(np, 0);
+	of_node_put(np);
 
 	cpm2_pic_init(np);
 	set_irq_chained_handler(irq, cpm2_cascade);
@@ -112,7 +112,7 @@ struct cpm_pin {
 	int port, pin, flags;
 };
 
-static struct cpm_pin mpc8560_ads_pins[] = {
+static const struct cpm_pin mpc8560_ads_pins[] = {
 	/* SCC1 */
 	{3, 29, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
 	{3, 30, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
-- 
1.5.0.rc1.gf4b6c

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mpc85xx_ads: add in missing of_node_put()
  2007-12-21 15:40 [PATCH] mpc85xx_ads: add in missing of_node_put() Paul Gortmaker
@ 2007-12-22 22:50 ` Stephen Rothwell
  2008-01-02 17:50   ` Paul Gortmaker
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2007-12-22 22:50 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 473 bytes --]

On Fri, 21 Dec 2007 10:40:09 -0500 Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
>
> cpm2_pic_init() does its own of_node_get() so we should do an of_node_put()
> before calling it.

The of_node_put() should really go after the call to cpm2_pic_init(), that
way you retain a raised ref count at all times.  Sorry fo not being
entirely clear before.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mpc85xx_ads: add in missing of_node_put()
  2007-12-22 22:50 ` Stephen Rothwell
@ 2008-01-02 17:50   ` Paul Gortmaker
  2008-01-18  6:52     ` Kumar Gala
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Gortmaker @ 2008-01-02 17:50 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linuxppc-dev

In message: Re: [PATCH] mpc85xx_ads: add in missing of_node_put()
on 23/12/2007 Stephen Rothwell wrote:

> On Fri, 21 Dec 2007 10:40:09 -0500 Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
> >
> > cpm2_pic_init() does its own of_node_get() so we should do an of_node_put()
> > before calling it.
> 
> The of_node_put() should really go after the call to cpm2_pic_init(), that
> way you retain a raised ref count at all times.  Sorry fo not being
> entirely clear before.

No problem.  Updated version below.

Thanks,
Paul.


>From eea2826182b4b732ded224240ef9dc89a881ce4b Mon Sep 17 00:00:00 2001
From: Paul Gortmaker <paul.gortmaker@windriver.com>
Date: Fri, 21 Dec 2007 10:12:38 -0500
Subject: [PATCH] mpc85xx_ads: add in missing of_node_put()

Add in missing of_node_put() after cpm2_pic_init(). This and other coding
style cleanups as suggested by Stephen Rothwell.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 arch/powerpc/platforms/85xx/mpc85xx_ads.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index bccdc25..91781a9 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -52,9 +52,9 @@ static void cpm2_cascade(unsigned int irq, struct irq_desc *desc)
 {
 	int cascade_irq;
 
-	while ((cascade_irq = cpm2_get_irq()) >= 0) {
+	while ((cascade_irq = cpm2_get_irq()) >= 0)
 		generic_handle_irq(cascade_irq);
-	}
+
 	desc->chip->eoi(irq);
 }
 
@@ -70,13 +70,12 @@ static void __init mpc85xx_ads_pic_init(void)
 #endif
 
 	np = of_find_node_by_type(np, "open-pic");
-
-	if (np == NULL) {
+	if (!np) {
 		printk(KERN_ERR "Could not find open-pic node\n");
 		return;
 	}
 
-	if(of_address_to_resource(np, 0, &r)) {
+	if (of_address_to_resource(np, 0, &r)) {
 		printk(KERN_ERR "Could not map mpic register space\n");
 		of_node_put(np);
 		return;
@@ -100,6 +99,7 @@ static void __init mpc85xx_ads_pic_init(void)
 	irq = irq_of_parse_and_map(np, 0);
 
 	cpm2_pic_init(np);
+	of_node_put(np);
 	set_irq_chained_handler(irq, cpm2_cascade);
 #endif
 }
@@ -112,7 +112,7 @@ struct cpm_pin {
 	int port, pin, flags;
 };
 
-static struct cpm_pin mpc8560_ads_pins[] = {
+static const struct cpm_pin mpc8560_ads_pins[] = {
 	/* SCC1 */
 	{3, 29, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
 	{3, 30, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
-- 
1.5.0.rc1.gf4b6c

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mpc85xx_ads: add in missing of_node_put()
  2008-01-02 17:50   ` Paul Gortmaker
@ 2008-01-18  6:52     ` Kumar Gala
  0 siblings, 0 replies; 4+ messages in thread
From: Kumar Gala @ 2008-01-18  6:52 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Stephen Rothwell, linuxppc-dev

> From: Paul Gortmaker <paul.gortmaker@windriver.com>
> Date: Fri, 21 Dec 2007 10:12:38 -0500
> Subject: [PATCH] mpc85xx_ads: add in missing of_node_put()
>
> Add in missing of_node_put() after cpm2_pic_init(). This and other coding
> style cleanups as suggested by Stephen Rothwell.
>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>  arch/powerpc/platforms/85xx/mpc85xx_ads.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)

applied.

- k

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-01-18  6:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-21 15:40 [PATCH] mpc85xx_ads: add in missing of_node_put() Paul Gortmaker
2007-12-22 22:50 ` Stephen Rothwell
2008-01-02 17:50   ` Paul Gortmaker
2008-01-18  6:52     ` Kumar Gala

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).