Skip to contentSkip to conversation

thinkpad_acpi: Fix build error when CONFIG_SND_MAX_CARDS > 32

PATCH Applied Takashi Iwai 3 participants 3 messages Oct 24, 2013 – Nov 20, 2013 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thinkpad_acpi: Fix build error when CONFIG_SND_MAX_CARDS > 32

SNDRV_CARDS can be specified via Kconfig since 3.11 kernel, so this can be over 32bit integer range, which leads to a build error.

---
 drivers/platform/x86/thinkpad_acpi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/platform/x86/thinkpad_acpi.c +6 -1
index 0b7efb2..79f77a7 100644
@@ -6421,7 +6421,12 @@ static struct ibm_struct brightness_driver_data = {
 #define TPACPI_ALSA_SHRTNAME "ThinkPad Console Audio Control"
 #define TPACPI_ALSA_MIXERNAME TPACPI_ALSA_SHRTNAME
 
-static int alsa_index = ~((1 << (SNDRV_CARDS - 3)) - 1); /* last three slots */
+#if SNDRV_CARDS <= 32
+#define DEFAULT_ALSA_IDX		~((1 << (SNDRV_CARDS - 3)) - 1)
+#else
+#define DEFAULT_ALSA_IDX		~((1 << (32 - 3)) - 1)
+#endif
+static int alsa_index = DEFAULT_ALSA_IDX; /* last three slots */
 static char *alsa_id = "ThinkPadEC";
 static bool alsa_enable = SNDRV_DEFAULT_ENABLE1;
 
Signature · 1 line
1.8.4
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Takashi Iwai

SNDRV_CARDS can be specified via Kconfig since 3.11 kernel, so this can be over 32bit integer range, which leads to a build error.

Signature · 4 lines
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh