diff mbox series

macintosh/ams: Fix unused variable warning

Message ID 20240507140150.54630-1-mpe@ellerman.id.au (mailing list archive)
State Accepted
Commit bc8744c6bf0d487dcb7911d093fce60a62cc2654
Headers show
Series macintosh/ams: Fix unused variable warning | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_kernel_qemu success Successfully ran 23 jobs.
snowpatch_ozlabs/github-powerpc_sparse success Successfully ran 4 jobs.
snowpatch_ozlabs/github-powerpc_clang success Successfully ran 6 jobs.

Commit Message

Michael Ellerman May 7, 2024, 2:01 p.m. UTC
If both CONFIG_SENSORS_AMS_PMU and CONFIG_SENSORS_AMS_I2C are unset,
there is an unused variable warning in the ams driver:

  drivers/macintosh/ams/ams-core.c: In function 'ams_init':
  drivers/macintosh/ams/ams-core.c:181:29: warning: unused variable 'np'
    181 |         struct device_node *np;

The driver needs at least one of the configs enabled in order to
actually function. So fix the compiler warning by ensuring at least one
of the configs is enabled.

Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 drivers/macintosh/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Ellerman May 8, 2024, 1:39 p.m. UTC | #1
On Wed, 08 May 2024 00:01:50 +1000, Michael Ellerman wrote:
> If both CONFIG_SENSORS_AMS_PMU and CONFIG_SENSORS_AMS_I2C are unset,
> there is an unused variable warning in the ams driver:
> 
>   drivers/macintosh/ams/ams-core.c: In function 'ams_init':
>   drivers/macintosh/ams/ams-core.c:181:29: warning: unused variable 'np'
>     181 |         struct device_node *np;
> 
> [...]

Applied to powerpc/next.

[1/1] macintosh/ams: Fix unused variable warning
      https://git.kernel.org/powerpc/c/bc8744c6bf0d487dcb7911d093fce60a62cc2654

cheers
diff mbox series

Patch

diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index a0e717a986dc..fb38f684444f 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -262,7 +262,7 @@  config SENSORS_AMS
 	  will be called ams.
 
 config SENSORS_AMS_PMU
-	bool "PMU variant"
+	bool "PMU variant" if SENSORS_AMS_I2C
 	depends on SENSORS_AMS && ADB_PMU
 	default y
 	help