Commit 7e76e4bc authored by Tzung-Bi Shih's avatar Tzung-Bi Shih

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/202207170538.MR39dw8m-lkp@intel.com/config

Fixes: 40f58143 ("platform/chrome: cros_kbd_led_backlight: support EC PWM backend")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarTzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: default avatarGuenter Roeck <groeck@chromium.org>
Link: https://lore.kernel.org/r/20220718105047.2356542-1-tzungbi@kernel.org
parent 9399b2cb
......@@ -119,7 +119,7 @@ static const struct keyboard_led_drvdata keyboard_led_drvdata_acpi = {
#endif /* CONFIG_ACPI */
#ifdef CONFIG_CROS_EC
#if IS_ENABLED(CONFIG_CROS_EC)
static int
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)
return 0;
}
static const struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm = {
static const __maybe_unused struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm = {
.init = keyboard_led_init_ec_pwm,
.brightness_set_blocking = keyboard_led_set_brightness_ec_pwm,
.brightness_get = keyboard_led_get_brightness_ec_pwm,
.max_brightness = KEYBOARD_BACKLIGHT_MAX,
};
#else /* CONFIG_CROS_EC */
#else /* IS_ENABLED(CONFIG_CROS_EC) */
static const struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm = {};
static const __maybe_unused struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm = {};
#endif /* CONFIG_CROS_EC */
#endif /* IS_ENABLED(CONFIG_CROS_EC) */
static int keyboard_led_probe(struct platform_device *pdev)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment