Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7038342rdb; Wed, 3 Jan 2024 02:26:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDagSwk8x90rN1KBCSh/0tuLPFl/rs4nY30gG/I+m7EX5x0teAfbOv1vkJOEMw1IiDsdz2 X-Received: by 2002:a2e:9655:0:b0:2cc:ec1d:bf29 with SMTP id z21-20020a2e9655000000b002ccec1dbf29mr3481701ljh.36.1704277578818; Wed, 03 Jan 2024 02:26:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704277578; cv=none; d=google.com; s=arc-20160816; b=lYnerkF+B0UgdkuNwt9HMFx3GvIhhzEZfv25vWFBVmb+X4X441dnI3Xix+yR4co/Sv RlrxLBNSnqwhaPW+4NT2t12Tr3tsaFXlzdgXIf5Y8CfnOqn5a1vY29Zz53B/8g+bIvoo P8ztQuDZGbSO8JUEyHI6El1LOWdSrirIAyooFWpRatYjGBUbU47JPPn5voAF6RpsF4um 0zxuhxbmSuQEesEL9jVrPv48R7X7PjKZppaiwrqC59VEeeb9Kv8sX5k79/TBSCMmD5Ks EgRp5UVGYhM5dTCclo3CRuGs74Lbx73fDlJfXZKxFy5yMfCjRHaiwqpqrGEVPsz5LNyB uiiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=OXy3lADQNODkYr1tcUkpzwgVQCYfGtQ5Th+Hc9HBlKc=; fh=OrwRZUOxCvTY7GQGQG6iVDq9f21PKrrZV09+aBhUQs8=; b=gjXPfenPfr7g2hzcu16hx8UPbVIg7wZGSbAFg5WDr73Ody74JcRRcaz0egcXT7ks9X 9hbyBHSWpyADRFiNzvSAzlgFMxpsatL0YPHpOQiq1Olzat00N8CEcXx9PnoNohgpVMw2 +1p9WqqyehFOzUjE8BnBj2CCaqwZ15igAAprmXBqowg6O0l1n8JnYS6XanjhqELqkKyR 9OT7+Bo2I7vgFpzsMWKCwcraytHhRHxS1bxZd2UciAvL0omrGv+w7JhXfGUvp0zSlOVB fQeb+0vlvap69apvQ6pvn+AKCCvKdR7wNeVcC1Dh8MW3ITyptlfF5xyL4V/ct0trbUs3 zuag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tQOV+NMa; spf=pass (google.com: domain of linux-kernel+bounces-15385-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15385-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bd19-20020a056402207300b00551acf6aaf6si11663193edb.265.2024.01.03.02.26.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 02:26:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15385-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tQOV+NMa; spf=pass (google.com: domain of linux-kernel+bounces-15385-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15385-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7FD8F1F2393F for ; Wed, 3 Jan 2024 10:26:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9488718B02; Wed, 3 Jan 2024 10:26:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tQOV+NMa" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE69B18AFA; Wed, 3 Jan 2024 10:26:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 941E3C433C7; Wed, 3 Jan 2024 10:26:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704277572; bh=B8LTWZaAeIbbuTZxZBAE3c2hb3WyYLM2mLYP5O3fdx8=; h=From:To:Cc:Subject:Date:From; b=tQOV+NMa5Ds7GmQ+XgOeCZs6na9Bdhl9C3je6Bs7yPrxzvv4ZV5TUxxowGlhJK8RT t8KqMQJsjx4+SkkH96llUoB1cBIDcZItBB4hS4FrZPTzcDEcN4zFOQLTXS2e+TE8h9 zNCUnzpqtDMtri1Tw3fp02p5OoDhbJ2S8d5dbA6Gf36LXYMybaCcZFYdMpP24VECjE HzPC0gbIW8FWuDn3CzkuMlRwxodvIqNw9aL57Gv+so14losMmhF21cx63o2vx48/Xo zgN6fALvX6vg4jkGlbrSl1NQX9XSCnU4gSMci4hI5HtDUpgsNENm5/v7JkXZ+PG8Um y244+T7nMQ2Zg== From: Arnd Bergmann To: James Schulman , David Rhodes , Richard Fitzgerald , Jaroslav Kysela , Takashi Iwai , Stefan Binding Cc: Arnd Bergmann , Dorian Cruveiller , Yang Yingliang , alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ALSA: hda: cs35l41: fix building without CONFIG_SPI Date: Wed, 3 Jan 2024 11:25:59 +0100 Message-Id: <20240103102606.3742476-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Arnd Bergmann 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 --- 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 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