public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/9] sound/oss/dmasound/dmasound_awacs.c: ioremap balanced with iounmap
@ 2006-10-06  5:38 Amol Lad
  2006-10-06 20:54 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Amol Lad @ 2006-10-06  5:38 UTC (permalink / raw)
  To: linux kernel; +Cc: Andrew Morton

Signed-off-by: Amol Lad <amol@verismonetworks.com>
---
 dmasound_awacs.c |   39 +++++++++++++++++++++++++++++++++++----
 1 files changed, 35 insertions(+), 4 deletions(-)
---
diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/oss/dmasound/dmasound_awacs.c linux-2.6.19-rc1/sound/oss/dmasound/dmasound_awacs.c
--- linux-2.6.19-rc1-orig/sound/oss/dmasound/dmasound_awacs.c	2006-10-05 14:01:04.000000000 +0530
+++ linux-2.6.19-rc1/sound/oss/dmasound/dmasound_awacs.c	2006-10-05 17:34:42.000000000 +0530
@@ -3067,8 +3067,9 @@ printk("dmasound_pmac: Awacs/Screamer Co
 		udelay(1);
 
 	/* Initialize beep stuff */
-	if ((res=setup_beep()))
-		return res ;
+	res=setup_beep();
+	if (res)
+		goto out_unmap;
 
 #ifdef CONFIG_PM
 	pmu_register_sleep_notifier(&awacs_sleep_notifier);
@@ -3160,7 +3161,26 @@ printk("dmasound_pmac: Awacs/Screamer Co
 	 */
 	input_register_device(awacs_beep_dev);
 
-	return dmasound_init();
+	res = dmasound_init();
+	if (res)
+		goto out_unmap1;
+
+	return 0;
+	
+out_unmap1:
+	if (is_pbook_3X00)
+		iounmap(latch_base);
+	else if (is_pbook_g3)
+		iounmap(macio_base);
+out_unmap:
+	if (i2s_node)
+		iounmap(i2s);
+	else
+		iounmap(awacs);
+	iounmap(awacs_txdma);
+	iounmap(awacs_rxdma);
+
+	return res;
 }
 
 static void __exit dmasound_awacs_cleanup(void)
@@ -3177,8 +3197,19 @@ static void __exit dmasound_awacs_cleanu
 			daca_cleanup();
 			break;
 	}
-	dmasound_deinit();
 
+	if (is_pbook_3X00)
+		iounmap(latch_base);
+	else if (is_pbook_g3)
+		iounmap(macio_base);
+	if (i2s_node)
+		iounmap(i2s);
+	else
+		iounmap(awacs);
+	iounmap(awacs_txdma);
+	iounmap(awacs_rxdma);
+
+	dmasound_deinit();
 }
 
 MODULE_DESCRIPTION("PowerMac built-in audio driver.");



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

* Re: [PATCH 2/9] sound/oss/dmasound/dmasound_awacs.c: ioremap balanced with iounmap
  2006-10-06  5:38 [PATCH 2/9] sound/oss/dmasound/dmasound_awacs.c: ioremap balanced with iounmap Amol Lad
@ 2006-10-06 20:54 ` Andrew Morton
  2006-10-07  5:46   ` Amol Lad
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2006-10-06 20:54 UTC (permalink / raw)
  To: Amol Lad; +Cc: linux kernel

On Fri, 06 Oct 2006 11:08:53 +0530
Amol Lad <amol@verismonetworks.com> wrote:

> Signed-off-by: Amol Lad <amol@verismonetworks.com>
> ---
>  dmasound_awacs.c |   39 +++++++++++++++++++++++++++++++++++----
>  1 files changed, 35 insertions(+), 4 deletions(-)
> ---
> diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/sound/oss/dmasound/dmasound_awacs.c linux-2.6.19-rc1/sound/oss/dmasound/dmasound_awacs.c
> --- linux-2.6.19-rc1-orig/sound/oss/dmasound/dmasound_awacs.c	2006-10-05 14:01:04.000000000 +0530
> +++ linux-2.6.19-rc1/sound/oss/dmasound/dmasound_awacs.c	2006-10-05 17:34:42.000000000 +0530
> @@ -3067,8 +3067,9 @@ printk("dmasound_pmac: Awacs/Screamer Co
>  		udelay(1);
>  
>  	/* Initialize beep stuff */
> -	if ((res=setup_beep()))
> -		return res ;
> +	res=setup_beep();
> +	if (res)
> +		goto out_unmap;
>  
>  #ifdef CONFIG_PM
>  	pmu_register_sleep_notifier(&awacs_sleep_notifier);
> @@ -3160,7 +3161,26 @@ printk("dmasound_pmac: Awacs/Screamer Co
>  	 */
>  	input_register_device(awacs_beep_dev);
>  
> -	return dmasound_init();
> +	res = dmasound_init();
> +	if (res)
> +		goto out_unmap1;
> +
> +	return 0;
> +	
> +out_unmap1:
> +	if (is_pbook_3X00)
> +		iounmap(latch_base);
> +	else if (is_pbook_g3)
> +		iounmap(macio_base);
> +out_unmap:
> +	if (i2s_node)
> +		iounmap(i2s);
> +	else
> +		iounmap(awacs);
> +	iounmap(awacs_txdma);
> +	iounmap(awacs_rxdma);
> +
> +	return res;
>  }
>  
>  static void __exit dmasound_awacs_cleanup(void)
> @@ -3177,8 +3197,19 @@ static void __exit dmasound_awacs_cleanu
>  			daca_cleanup();
>  			break;
>  	}
> -	dmasound_deinit();
>  
> +	if (is_pbook_3X00)
> +		iounmap(latch_base);
> +	else if (is_pbook_g3)
> +		iounmap(macio_base);
> +	if (i2s_node)
> +		iounmap(i2s);
> +	else
> +		iounmap(awacs);
> +	iounmap(awacs_txdma);
> +	iounmap(awacs_rxdma);
> +
> +	dmasound_deinit();
>  }
>  

man, this is taxing my attention span to the limit.  It'd be nice if
someone else could help out with the reviewing here..

This one could benefit from having a helper function which is called from
both places.



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

* Re: [PATCH 2/9] sound/oss/dmasound/dmasound_awacs.c: ioremap balanced with iounmap
  2006-10-06 20:54 ` Andrew Morton
@ 2006-10-07  5:46   ` Amol Lad
  0 siblings, 0 replies; 3+ messages in thread
From: Amol Lad @ 2006-10-07  5:46 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux kernel


> >  
> >  #ifdef CONFIG_PM
> >  	pmu_register_sleep_notifier(&awacs_sleep_notifier);
> > @@ -3160,7 +3161,26 @@ printk("dmasound_pmac: Awacs/Screamer Co
> >  	 */
> >  	input_register_device(awacs_beep_dev);
> >  
> > -	return dmasound_init();
> > +	res = dmasound_init();
> > +	if (res)
> > +		goto out_unmap1;
> > +
> > +	return 0;
> > +	
> > +out_unmap1:
> > +	if (is_pbook_3X00)
> > +		iounmap(latch_base);
> > +	else if (is_pbook_g3)
> > +		iounmap(macio_base);
> > +out_unmap:
> > +	if (i2s_node)
> > +		iounmap(i2s);
> > +	else
> > +		iounmap(awacs);
> > +	iounmap(awacs_txdma);
> > +	iounmap(awacs_rxdma);
> > +
> > +	return res;
> >  }
> >  
> >  static void __exit dmasound_awacs_cleanup(void)
> > @@ -3177,8 +3197,19 @@ static void __exit dmasound_awacs_cleanu
> >  			daca_cleanup();
> >  			break;
> >  	}
> > -	dmasound_deinit();
> >  
> > +	if (is_pbook_3X00)
> > +		iounmap(latch_base);
> > +	else if (is_pbook_g3)
> > +		iounmap(macio_base);
> > +	if (i2s_node)
> > +		iounmap(i2s);
> > +	else
> > +		iounmap(awacs);
> > +	iounmap(awacs_txdma);
> > +	iounmap(awacs_rxdma);
> > +
> > +	dmasound_deinit();
> >  }
> >  
> 
> man, this is taxing my attention span to the limit.  It'd be nice if
> someone else could help out with the reviewing here..
> 
> This one could benefit from having a helper function which is called from
> both places.
> 

Sorry for that.

Including a better version

Signed-off-by: Amol Lad <amol@verismonetworks.com>
---
 dmasound_awacs.c |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)
---
--- linux-2.6.19-rc1-orig/sound/oss/dmasound/dmasound_awacs.c	2006-10-05 14:01:04.000000000 +0530
+++ linux-2.6.19-rc1/sound/oss/dmasound/dmasound_awacs.c	2006-10-07 11:08:54.000000000 +0530
@@ -308,6 +308,9 @@ extern void daca_get_volume(uint * left_
 extern int daca_enter_sleep(void);
 extern int daca_leave_sleep(void);
 
+/*** cleanup ***/
+static void iounmap_awacs(void);
+
 #define TRY_LOCK()	\
 	if ((rc = mutex_lock_interruptible(&dmasound_mutex)) != 0)	\
 		return rc;
@@ -3067,8 +3070,9 @@ printk("dmasound_pmac: Awacs/Screamer Co
 		udelay(1);
 
 	/* Initialize beep stuff */
-	if ((res=setup_beep()))
-		return res ;
+	res=setup_beep();
+	if (res)
+		goto out_unmap;
 
 #ifdef CONFIG_PM
 	pmu_register_sleep_notifier(&awacs_sleep_notifier);
@@ -3160,7 +3164,32 @@ printk("dmasound_pmac: Awacs/Screamer Co
 	 */
 	input_register_device(awacs_beep_dev);
 
-	return dmasound_init();
+	res = dmasound_init();
+	if (res)
+		goto out_unmap;
+
+	return 0;
+
+out_unmap:
+	iounmap_awacs();
+
+	return res;
+}
+
+static void iounmap_awacs(void)
+{
+	if (is_pbook_3X00 && latch_base)
+		iounmap(latch_base);
+	else if (is_pbook_g3 && macio_base)
+		iounmap(macio_base);
+	if (i2s_node)
+		iounmap(i2s);
+	else
+		iounmap(awacs);
+	iounmap(awacs_txdma);
+	iounmap(awacs_rxdma);
+
+	return;
 }
 
 static void __exit dmasound_awacs_cleanup(void)
@@ -3177,6 +3206,7 @@ static void __exit dmasound_awacs_cleanu
 			daca_cleanup();
 			break;
 	}
+	iounmap_awacs();
 	dmasound_deinit();
 
 }



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

end of thread, other threads:[~2006-10-07  5:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-06  5:38 [PATCH 2/9] sound/oss/dmasound/dmasound_awacs.c: ioremap balanced with iounmap Amol Lad
2006-10-06 20:54 ` Andrew Morton
2006-10-07  5:46   ` Amol Lad

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox