alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* Move snd_legacy_find_free_ioport to initval.h
@ 2012-08-01 14:05 Ondrej Zary
  2012-08-03 13:13 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Ondrej Zary @ 2012-08-01 14:05 UTC (permalink / raw)
  To: alsa-devel; +Cc: Kernel development list

Move snd_legacy_find_free_ioport() function back to initval.h as it is used
by two drivers.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>

diff --git a/include/sound/initval.h b/include/sound/initval.h
index f99a0d2..ac62c67 100644
--- a/include/sound/initval.h
+++ b/include/sound/initval.h
@@ -50,6 +50,20 @@
 #define SNDRV_DEFAULT_DMA_SIZE	{ [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE }
 #define SNDRV_DEFAULT_PTR	SNDRV_DEFAULT_STR
 
+#ifdef SNDRV_LEGACY_FIND_FREE_IOPORT
+static long snd_legacy_find_free_ioport(long *port_table, long size)
+{
+	while (*port_table != -1) {
+		if (request_region(*port_table, size, "ALSA test")) {
+			release_region(*port_table, size);
+			return *port_table;
+		}
+		port_table++;
+	}
+	return -1;
+}
+#endif
+
 #ifdef SNDRV_LEGACY_FIND_FREE_IRQ
 #include <linux/interrupt.h>
 
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c
index c24594c..3d1afb6 100644
--- a/sound/isa/opti9xx/miro.c
+++ b/sound/isa/opti9xx/miro.c
@@ -37,6 +37,7 @@
 #include <sound/opl4.h>
 #include <sound/control.h>
 #include <sound/info.h>
+#define SNDRV_LEGACY_FIND_FREE_IOPORT
 #define SNDRV_LEGACY_FIND_FREE_IRQ
 #define SNDRV_LEGACY_FIND_FREE_DMA
 #include <sound/initval.h>
@@ -770,20 +771,6 @@ static int __devinit snd_miro_mixer(struct snd_card *card,
 	return 0;
 }
 
-static long snd_legacy_find_free_ioport(long *port_table, long size)
-{
-	while (*port_table != -1) {
-		struct resource *res;
-		if ((res = request_region(*port_table, size, 
-					  "ALSA test")) != NULL) {
-			release_and_free_resource(res);
-			return *port_table;
-		}
-		port_table++;
-	}
-	return -1;
-}
-
 static int __devinit snd_miro_init(struct snd_miro *chip,
 				   unsigned short hardware)
 {
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index f8fbe22..2899c9f 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -39,6 +39,7 @@
 #ifndef OPTi93X
 #include <sound/opl4.h>
 #endif
+#define SNDRV_LEGACY_FIND_FREE_IOPORT
 #define SNDRV_LEGACY_FIND_FREE_IRQ
 #define SNDRV_LEGACY_FIND_FREE_DMA
 #include <sound/initval.h>
@@ -185,19 +186,6 @@ static char * snd_opti9xx_names[] = {
 	"82C930",	"82C931",	"82C933"
 };
 
-
-static long __devinit snd_legacy_find_free_ioport(long *port_table, long size)
-{
-	while (*port_table != -1) {
-		if (request_region(*port_table, size, "ALSA test")) {
-			release_region(*port_table, size);
-			return *port_table;
-		}
-		port_table++;
-	}
-	return -1;
-}
-
 static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip,
 				      unsigned short hardware)
 {


-- 
Ondrej Zary

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

* Re: Move snd_legacy_find_free_ioport to initval.h
  2012-08-01 14:05 Move snd_legacy_find_free_ioport to initval.h Ondrej Zary
@ 2012-08-03 13:13 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2012-08-03 13:13 UTC (permalink / raw)
  To: Ondrej Zary; +Cc: alsa-devel, Kernel development list

At Wed, 1 Aug 2012 16:05:39 +0200,
Ondrej Zary wrote:
> 
> Move snd_legacy_find_free_ioport() function back to initval.h as it is used
> by two drivers.
> 
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>

Applied now (for 3.7).  Thanks.


Takashi

> 
> diff --git a/include/sound/initval.h b/include/sound/initval.h
> index f99a0d2..ac62c67 100644
> --- a/include/sound/initval.h
> +++ b/include/sound/initval.h
> @@ -50,6 +50,20 @@
>  #define SNDRV_DEFAULT_DMA_SIZE	{ [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE }
>  #define SNDRV_DEFAULT_PTR	SNDRV_DEFAULT_STR
>  
> +#ifdef SNDRV_LEGACY_FIND_FREE_IOPORT
> +static long snd_legacy_find_free_ioport(long *port_table, long size)
> +{
> +	while (*port_table != -1) {
> +		if (request_region(*port_table, size, "ALSA test")) {
> +			release_region(*port_table, size);
> +			return *port_table;
> +		}
> +		port_table++;
> +	}
> +	return -1;
> +}
> +#endif
> +
>  #ifdef SNDRV_LEGACY_FIND_FREE_IRQ
>  #include <linux/interrupt.h>
>  
> diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c
> index c24594c..3d1afb6 100644
> --- a/sound/isa/opti9xx/miro.c
> +++ b/sound/isa/opti9xx/miro.c
> @@ -37,6 +37,7 @@
>  #include <sound/opl4.h>
>  #include <sound/control.h>
>  #include <sound/info.h>
> +#define SNDRV_LEGACY_FIND_FREE_IOPORT
>  #define SNDRV_LEGACY_FIND_FREE_IRQ
>  #define SNDRV_LEGACY_FIND_FREE_DMA
>  #include <sound/initval.h>
> @@ -770,20 +771,6 @@ static int __devinit snd_miro_mixer(struct snd_card *card,
>  	return 0;
>  }
>  
> -static long snd_legacy_find_free_ioport(long *port_table, long size)
> -{
> -	while (*port_table != -1) {
> -		struct resource *res;
> -		if ((res = request_region(*port_table, size, 
> -					  "ALSA test")) != NULL) {
> -			release_and_free_resource(res);
> -			return *port_table;
> -		}
> -		port_table++;
> -	}
> -	return -1;
> -}
> -
>  static int __devinit snd_miro_init(struct snd_miro *chip,
>  				   unsigned short hardware)
>  {
> diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
> index f8fbe22..2899c9f 100644
> --- a/sound/isa/opti9xx/opti92x-ad1848.c
> +++ b/sound/isa/opti9xx/opti92x-ad1848.c
> @@ -39,6 +39,7 @@
>  #ifndef OPTi93X
>  #include <sound/opl4.h>
>  #endif
> +#define SNDRV_LEGACY_FIND_FREE_IOPORT
>  #define SNDRV_LEGACY_FIND_FREE_IRQ
>  #define SNDRV_LEGACY_FIND_FREE_DMA
>  #include <sound/initval.h>
> @@ -185,19 +186,6 @@ static char * snd_opti9xx_names[] = {
>  	"82C930",	"82C931",	"82C933"
>  };
>  
> -
> -static long __devinit snd_legacy_find_free_ioport(long *port_table, long size)
> -{
> -	while (*port_table != -1) {
> -		if (request_region(*port_table, size, "ALSA test")) {
> -			release_region(*port_table, size);
> -			return *port_table;
> -		}
> -		port_table++;
> -	}
> -	return -1;
> -}
> -
>  static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip,
>  				      unsigned short hardware)
>  {
> 
> 
> -- 
> Ondrej Zary
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

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

end of thread, other threads:[~2012-08-03 13:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-01 14:05 Move snd_legacy_find_free_ioport to initval.h Ondrej Zary
2012-08-03 13:13 ` Takashi Iwai

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