diff options
author | Arnd Bergmann <arnd@arndb.de> | 2024-01-03 13:25:59 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2024-01-03 13:48:30 +0300 |
commit | 8c14dbf36424eb751d70c15f9a671549390057b2 (patch) | |
tree | 866b68f7e613c9c277c1f0a6ed0e5841dd25d5ce /sound | |
parent | 18a434f32fa61b3fda8ddcd9a63d5274569c6a41 (diff) | |
download | linux-8c14dbf36424eb751d70c15f9a671549390057b2.tar.xz |
ALSA: hda: cs35l41: fix building without CONFIG_SPI
When CONFIG_SPI is disabled, the driver produces unused-variable warning:
sound/pci/hda/cs35l41_hda_property.c: In function 'generic_dsd_config':
sound/pci/hda/cs35l41_hda_property.c:181:28: error: unused variable 'spi' [-Werror=unused-variable]
181 | struct spi_device *spi;
| ^~~
sound/pci/hda/cs35l41_hda_property.c:180:27: error: unused variable 'cs_gpiod' [-Werror=unused-variable]
180 | struct gpio_desc *cs_gpiod;
| ^~~~~~~~
Avoid these by turning the preprocessor contionals into equivalent C code,
which also helps readability.
Fixes: 916d051730ae ("ALSA: hda: cs35l41: Only add SPI CS GPIO if SPI is enabled in kernel")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240103102606.3742476-1-arnd@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/cs35l41_hda_property.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c index 194e1179a253..c1afb721b4c6 100644 --- a/sound/pci/hda/cs35l41_hda_property.c +++ b/sound/pci/hda/cs35l41_hda_property.c @@ -211,7 +211,6 @@ static int generic_dsd_config(struct cs35l41_hda *cs35l41, struct device *physde if (cfg->bus == SPI) { cs35l41->index = id; -#if IS_ENABLED(CONFIG_SPI) /* * Manually set the Chip Select for the second amp <cs_gpio_index> in the node. * This is only supported for systems with 2 amps, since we cannot expand the @@ -220,7 +219,7 @@ static int generic_dsd_config(struct cs35l41_hda *cs35l41, struct device *physde * uses a native chip select), to ensure the second amp does not clash with the * first. */ - if (cfg->cs_gpio_index >= 0) { + if (IS_ENABLED(CONFIG_SPI) && cfg->cs_gpio_index >= 0) { spi = to_spi_device(cs35l41->dev); if (cfg->num_amps != 2) { @@ -251,7 +250,6 @@ static int generic_dsd_config(struct cs35l41_hda *cs35l41, struct device *physde spi_setup(spi); } } -#endif } else { if (cfg->num_amps > 2) /* |