Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1520208 > unrolled thread

[RFC 1/1 linux-next] ALSA: pci: declare SUPPORT_JOYSTICK in gameport.h

Started byFabian Frederick <fabf@skynet.be>
First post2016-11-12 09:50 +0100
Last post2016-11-12 10:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [RFC 1/1 linux-next] ALSA: pci: declare SUPPORT_JOYSTICK in gameport.h Fabian Frederick <fabf@skynet.be> - 2016-11-12 09:50 +0100
    Re: [RFC 1/1 linux-next] ALSA: pci: declare SUPPORT_JOYSTICK in gameport.h Takashi Iwai <tiwai@suse.de> - 2016-11-12 10:20 +0100

#1520208 — [RFC 1/1 linux-next] ALSA: pci: declare SUPPORT_JOYSTICK in gameport.h

FromFabian Frederick <fabf@skynet.be>
Date2016-11-12 09:50 +0100
Subject[RFC 1/1 linux-next] ALSA: pci: declare SUPPORT_JOYSTICK in gameport.h
Message-ID<sCCaB-86l-3@gated-at.bofh.it>
Currently, all gameport callsites declare SUPPORT_JOYSTICK
under opencoded IS_REACHABLE().
This patch moves definition in gameport.h and removes opencoding.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
This is untested

 include/linux/gameport.h    | 3 ++-
 sound/pci/als4000.c         | 4 ----
 sound/pci/cmipci.c          | 4 ----
 sound/pci/ens1370.c         | 4 ----
 sound/pci/es1938.c          | 4 ----
 sound/pci/es1968.c          | 4 ----
 sound/pci/riptide/riptide.c | 4 ----
 sound/pci/sonicvibes.c      | 4 ----
 sound/pci/via82xx.c         | 4 ----
 sound/pci/ymfpci/ymfpci.h   | 4 ----
 10 files changed, 2 insertions(+), 37 deletions(-)

diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index bb7de09..4dc20b3 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -67,7 +67,8 @@ struct gameport_driver {
 int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode);
 void gameport_close(struct gameport *gameport);
 
-#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
+#if IS_REACHABLE(CONFIG_GAMEPORT_MODULE)
+#define SUPPORT_JOYSTICK 1
 
 void __gameport_register_port(struct gameport *gameport, struct module *owner);
 /* use a define to avoid include chaining to get THIS_MODULE */
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index edabe13..7e7a5c2 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -84,10 +84,6 @@ MODULE_DESCRIPTION("Avance Logic ALS4000");
 MODULE_LICENSE("GPL");
 MODULE_SUPPORTED_DEVICE("{{Avance Logic,ALS4000}}");
 
-#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
-#define SUPPORT_JOYSTICK 1
-#endif
-
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 73f5935..36beed1 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -48,10 +48,6 @@ MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8738},"
 		"{C-Media,CMI8338A},"
 		"{C-Media,CMI8338B}}");
 
-#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
-#define SUPPORT_JOYSTICK 1
-#endif
-
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable switches */
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 7e760fe..8ef3c88 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -79,10 +79,6 @@ MODULE_SUPPORTED_DEVICE("{{Ensoniq,AudioPCI ES1371/73},"
 		"{Ectiva,EV1938}}");
 #endif
 
-#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
-#define SUPPORT_JOYSTICK
-#endif
-
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable switches */
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 6813558..4e2ece0 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -72,10 +72,6 @@ MODULE_SUPPORTED_DEVICE("{{ESS,ES1938},"
                 "{ESS,ES1969},"
 		"{TerraTec,128i PCI}}");
 
-#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
-#define SUPPORT_JOYSTICK 1
-#endif
-
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 8146fb7..7174b6b 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -126,10 +126,6 @@ MODULE_SUPPORTED_DEVICE("{{ESS,Maestro 2e},"
 		"{ESS,Maestro 1},"
 		"{TerraTec,DMX}}");
 
-#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
-#define SUPPORT_JOYSTICK 1
-#endif
-
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 1-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index ada5f01..4762971 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -110,10 +110,6 @@
 #include <sound/opl3.h>
 #include <sound/initval.h>
 
-#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
-#define SUPPORT_JOYSTICK 1
-#endif
-
 MODULE_AUTHOR("Peter Gruber <nokos@gmx.net>");
 MODULE_DESCRIPTION("riptide");
 MODULE_LICENSE("GPL");
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index e1a1387..4a9ca57 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -45,10 +45,6 @@ MODULE_DESCRIPTION("S3 SonicVibes PCI");
 MODULE_LICENSE("GPL");
 MODULE_SUPPORTED_DEVICE("{{S3,SonicVibes PCI}}");
 
-#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
-#define SUPPORT_JOYSTICK 1
-#endif
-
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 38a17b4..ac81321 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -72,10 +72,6 @@ MODULE_DESCRIPTION("VIA VT82xx audio");
 MODULE_LICENSE("GPL");
 MODULE_SUPPORTED_DEVICE("{{VIA,VT82C686A/B/C,pci},{VIA,VT8233A/C,8235}}");
 
-#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
-#define SUPPORT_JOYSTICK 1
-#endif
-
 static int index = SNDRV_DEFAULT_IDX1;	/* Index 0-MAX */
 static char *id = SNDRV_DEFAULT_STR1;	/* ID for this card */
 static long mpu_port;
diff --git a/sound/pci/ymfpci/ymfpci.h b/sound/pci/ymfpci/ymfpci.h
index 149d4cb..ba4b4c8 100644
--- a/sound/pci/ymfpci/ymfpci.h
+++ b/sound/pci/ymfpci/ymfpci.h
@@ -176,10 +176,6 @@
 #define YMFPCI_LEGACY2_IMOD	(1 << 15)	/* legacy IRQ mode */
 /* SIEN:IMOD 0:0 = legacy irq, 0:1 = INTA, 1:0 = serialized IRQ */
 
-#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
-#define SUPPORT_JOYSTICK
-#endif
-
 /*
  *
  */
-- 
2.7.4

[toc] | [next] | [standalone]


#1520211

FromTakashi Iwai <tiwai@suse.de>
Date2016-11-12 10:20 +0100
Message-ID<sCCDE-8uX-7@gated-at.bofh.it>
In reply to#1520208
On Sat, 12 Nov 2016 09:44:05 +0100,
Fabian Frederick wrote:
> 
> Currently, all gameport callsites declare SUPPORT_JOYSTICK
> under opencoded IS_REACHABLE().
> This patch moves definition in gameport.h and removes opencoding.

Not all callers.  azt3328 defines SUPPORT_GAMEPORT, for example.

SUPPORT_JOYSTICK is supposed to be a driver-local definition, and
never thought to be a global one.  Let's just clean up opencoded
IS_REACHABLE().


thanks,

Takashi

> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
> This is untested
> 
>  include/linux/gameport.h    | 3 ++-
>  sound/pci/als4000.c         | 4 ----
>  sound/pci/cmipci.c          | 4 ----
>  sound/pci/ens1370.c         | 4 ----
>  sound/pci/es1938.c          | 4 ----
>  sound/pci/es1968.c          | 4 ----
>  sound/pci/riptide/riptide.c | 4 ----
>  sound/pci/sonicvibes.c      | 4 ----
>  sound/pci/via82xx.c         | 4 ----
>  sound/pci/ymfpci/ymfpci.h   | 4 ----
>  10 files changed, 2 insertions(+), 37 deletions(-)
> 
> diff --git a/include/linux/gameport.h b/include/linux/gameport.h
> index bb7de09..4dc20b3 100644
> --- a/include/linux/gameport.h
> +++ b/include/linux/gameport.h
> @@ -67,7 +67,8 @@ struct gameport_driver {
>  int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode);
>  void gameport_close(struct gameport *gameport);
>  
> -#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
> +#if IS_REACHABLE(CONFIG_GAMEPORT_MODULE)
> +#define SUPPORT_JOYSTICK 1
>  
>  void __gameport_register_port(struct gameport *gameport, struct module *owner);
>  /* use a define to avoid include chaining to get THIS_MODULE */
> diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
> index edabe13..7e7a5c2 100644
> --- a/sound/pci/als4000.c
> +++ b/sound/pci/als4000.c
> @@ -84,10 +84,6 @@ MODULE_DESCRIPTION("Avance Logic ALS4000");
>  MODULE_LICENSE("GPL");
>  MODULE_SUPPORTED_DEVICE("{{Avance Logic,ALS4000}}");
>  
> -#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
> -#define SUPPORT_JOYSTICK 1
> -#endif
> -
>  static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
>  static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
>  static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
> diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
> index 73f5935..36beed1 100644
> --- a/sound/pci/cmipci.c
> +++ b/sound/pci/cmipci.c
> @@ -48,10 +48,6 @@ MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8738},"
>  		"{C-Media,CMI8338A},"
>  		"{C-Media,CMI8338B}}");
>  
> -#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
> -#define SUPPORT_JOYSTICK 1
> -#endif
> -
>  static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
>  static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
>  static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable switches */
> diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
> index 7e760fe..8ef3c88 100644
> --- a/sound/pci/ens1370.c
> +++ b/sound/pci/ens1370.c
> @@ -79,10 +79,6 @@ MODULE_SUPPORTED_DEVICE("{{Ensoniq,AudioPCI ES1371/73},"
>  		"{Ectiva,EV1938}}");
>  #endif
>  
> -#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
> -#define SUPPORT_JOYSTICK
> -#endif
> -
>  static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
>  static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
>  static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable switches */
> diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
> index 6813558..4e2ece0 100644
> --- a/sound/pci/es1938.c
> +++ b/sound/pci/es1938.c
> @@ -72,10 +72,6 @@ MODULE_SUPPORTED_DEVICE("{{ESS,ES1938},"
>                  "{ESS,ES1969},"
>  		"{TerraTec,128i PCI}}");
>  
> -#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
> -#define SUPPORT_JOYSTICK 1
> -#endif
> -
>  static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
>  static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
>  static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
> diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
> index 8146fb7..7174b6b 100644
> --- a/sound/pci/es1968.c
> +++ b/sound/pci/es1968.c
> @@ -126,10 +126,6 @@ MODULE_SUPPORTED_DEVICE("{{ESS,Maestro 2e},"
>  		"{ESS,Maestro 1},"
>  		"{TerraTec,DMX}}");
>  
> -#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
> -#define SUPPORT_JOYSTICK 1
> -#endif
> -
>  static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 1-MAX */
>  static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
>  static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
> diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
> index ada5f01..4762971 100644
> --- a/sound/pci/riptide/riptide.c
> +++ b/sound/pci/riptide/riptide.c
> @@ -110,10 +110,6 @@
>  #include <sound/opl3.h>
>  #include <sound/initval.h>
>  
> -#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
> -#define SUPPORT_JOYSTICK 1
> -#endif
> -
>  MODULE_AUTHOR("Peter Gruber <nokos@gmx.net>");
>  MODULE_DESCRIPTION("riptide");
>  MODULE_LICENSE("GPL");
> diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
> index e1a1387..4a9ca57 100644
> --- a/sound/pci/sonicvibes.c
> +++ b/sound/pci/sonicvibes.c
> @@ -45,10 +45,6 @@ MODULE_DESCRIPTION("S3 SonicVibes PCI");
>  MODULE_LICENSE("GPL");
>  MODULE_SUPPORTED_DEVICE("{{S3,SonicVibes PCI}}");
>  
> -#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
> -#define SUPPORT_JOYSTICK 1
> -#endif
> -
>  static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
>  static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
>  static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
> diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
> index 38a17b4..ac81321 100644
> --- a/sound/pci/via82xx.c
> +++ b/sound/pci/via82xx.c
> @@ -72,10 +72,6 @@ MODULE_DESCRIPTION("VIA VT82xx audio");
>  MODULE_LICENSE("GPL");
>  MODULE_SUPPORTED_DEVICE("{{VIA,VT82C686A/B/C,pci},{VIA,VT8233A/C,8235}}");
>  
> -#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
> -#define SUPPORT_JOYSTICK 1
> -#endif
> -
>  static int index = SNDRV_DEFAULT_IDX1;	/* Index 0-MAX */
>  static char *id = SNDRV_DEFAULT_STR1;	/* ID for this card */
>  static long mpu_port;
> diff --git a/sound/pci/ymfpci/ymfpci.h b/sound/pci/ymfpci/ymfpci.h
> index 149d4cb..ba4b4c8 100644
> --- a/sound/pci/ymfpci/ymfpci.h
> +++ b/sound/pci/ymfpci/ymfpci.h
> @@ -176,10 +176,6 @@
>  #define YMFPCI_LEGACY2_IMOD	(1 << 15)	/* legacy IRQ mode */
>  /* SIEN:IMOD 0:0 = legacy irq, 0:1 = INTA, 1:0 = serialized IRQ */
>  
> -#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
> -#define SUPPORT_JOYSTICK
> -#endif
> -
>  /*
>   *
>   */
> -- 
> 2.7.4
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web