* [PATCH] ALSA: hda: cs35l41: fix building without CONFIG_SPI
@ 2024-01-03 10:25 Arnd Bergmann
2024-01-03 10:50 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2024-01-03 10:25 UTC (permalink / raw)
To: James Schulman, David Rhodes, Richard Fitzgerald, Jaroslav Kysela,
Takashi Iwai, Stefan Binding
Cc: Arnd Bergmann, Dorian Cruveiller, Yang Yingliang, alsa-devel,
patches, linux-sound, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
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>
---
sound/pci/hda/cs35l41_hda_property.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
index 52820ca9c603..a51fb6b0f56d 100644
--- a/sound/pci/hda/cs35l41_hda_property.c
+++ b/sound/pci/hda/cs35l41_hda_property.c
@@ -215,7 +215,6 @@ static int generic_dsd_config(struct cs35l41_hda *cs35l41, struct device *physde
if (cs35l41->control_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
@@ -224,7 +223,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) {
@@ -255,7 +254,6 @@ static int generic_dsd_config(struct cs35l41_hda *cs35l41, struct device *physde
spi_setup(spi);
}
}
-#endif
} else {
if (cfg->num_amps > 2)
/*
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ALSA: hda: cs35l41: fix building without CONFIG_SPI
2024-01-03 10:25 [PATCH] ALSA: hda: cs35l41: fix building without CONFIG_SPI Arnd Bergmann
@ 2024-01-03 10:50 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2024-01-03 10:50 UTC (permalink / raw)
To: Arnd Bergmann
Cc: James Schulman, David Rhodes, Richard Fitzgerald, Jaroslav Kysela,
Takashi Iwai, Stefan Binding, Arnd Bergmann, Dorian Cruveiller,
Yang Yingliang, alsa-devel, patches, linux-sound, linux-kernel
On Wed, 03 Jan 2024 11:25:59 +0100,
Arnd Bergmann wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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>
Applied now. Thanks.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-03 10:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-03 10:25 [PATCH] ALSA: hda: cs35l41: fix building without CONFIG_SPI Arnd Bergmann
2024-01-03 10:50 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox