Skip to content

Commit 7e76e4b

Browse files
author
Tzung-Bi Shih
committed
platform/chrome: cros_kbd_led_backlight: fix build warning
drivers/platform/chrome/cros_kbd_led_backlight.c got a new build warning when using the randconfig in [1]: >>> warning: unused variable 'keyboard_led_drvdata_ec_pwm' The warning happens when CONFIG_CROS_EC is set but CONFIG_OF is not set. Reproduce: - mkdir build_dir - wget [1] -O build_dir/.config - COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 \ O=build_dir ARCH=s390 SHELL=/bin/bash drivers/platform/chrome/ Fix the warning by using __maybe_unused. Also use IS_ENABLED() because CROS_EC is a tristate. [1]: https://download.01.org/0day-ci/archive/20220717/[email protected]/config Fixes: 40f5814 ("platform/chrome: cros_kbd_led_backlight: support EC PWM backend") Reported-by: kernel test robot <[email protected]> Signed-off-by: Tzung-Bi Shih <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9399b2c commit 7e76e4b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/platform/chrome/cros_kbd_led_backlight.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static const struct keyboard_led_drvdata keyboard_led_drvdata_acpi = {
119119

120120
#endif /* CONFIG_ACPI */
121121

122-
#ifdef CONFIG_CROS_EC
122+
#if IS_ENABLED(CONFIG_CROS_EC)
123123

124124
static int
125125
keyboard_led_set_brightness_ec_pwm(struct led_classdev *cdev,
@@ -180,18 +180,18 @@ static int keyboard_led_init_ec_pwm(struct platform_device *pdev)
180180
return 0;
181181
}
182182

183-
static const struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm = {
183+
static const __maybe_unused struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm = {
184184
.init = keyboard_led_init_ec_pwm,
185185
.brightness_set_blocking = keyboard_led_set_brightness_ec_pwm,
186186
.brightness_get = keyboard_led_get_brightness_ec_pwm,
187187
.max_brightness = KEYBOARD_BACKLIGHT_MAX,
188188
};
189189

190-
#else /* CONFIG_CROS_EC */
190+
#else /* IS_ENABLED(CONFIG_CROS_EC) */
191191

192-
static const struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm = {};
192+
static const __maybe_unused struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm = {};
193193

194-
#endif /* CONFIG_CROS_EC */
194+
#endif /* IS_ENABLED(CONFIG_CROS_EC) */
195195

196196
static int keyboard_led_probe(struct platform_device *pdev)
197197
{

0 commit comments

Comments
 (0)