[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABXOdTeH-q=17QBnCn5NGT5V0QA5SOaTnrWaK+g5F3j4mVp8cA@mail.gmail.com>
Date: Sun, 17 Jul 2022 23:54:31 -0700
From: Guenter Roeck <groeck@...gle.com>
To: Tzung-Bi Shih <tzungbi@...nel.org>
Cc: Benson Leung <bleung@...omium.org>,
Guenter Roeck <groeck@...omium.org>,
"open list:CHROME HARDWARE PLATFORM SUPPORT"
<chrome-platform@...ts.linux.dev>,
linux-kernel <linux-kernel@...r.kernel.org>,
kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] platform/chrome: cros_kbd_led_backlight: fix build warning
On Sun, Jul 17, 2022 at 11:16 PM Tzung-Bi Shih <tzungbi@...nel.org> wrote:
>
> 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/
>
Have you tried the following ?
CONFIG_ACPI=y
CONFIG_CROS_EC=n
CONFIG_OF=y
That should be possible, but with your patch it should now result in a
build error because keyboard_led_drvdata_ec_pwm is no longer defined.
Also, with your patch, CONFIG_CROS_EC=y, CONFIG_ACPI=y, and
CONFIG_OF=n (ie Intel/AMD systems) would result in the code not being
compiled, which would be wrong.
Thanks,
Guenter
> Fix the warning by hardening the guard condition. 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: 40f58143745e ("platform/chrome: cros_kbd_led_backlight: support EC PWM backend")
> Reported-by: kernel test robot <lkp@...el.com>
> Signed-off-by: Tzung-Bi Shih <tzungbi@...nel.org>
> ---
> drivers/platform/chrome/cros_kbd_led_backlight.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/platform/chrome/cros_kbd_led_backlight.c b/drivers/platform/chrome/cros_kbd_led_backlight.c
> index 5ad41c10412d..4a0b2bd004d5 100644
> --- a/drivers/platform/chrome/cros_kbd_led_backlight.c
> +++ b/drivers/platform/chrome/cros_kbd_led_backlight.c
> @@ -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) && defined(CONFIG_OF)
>
> static int
> keyboard_led_set_brightness_ec_pwm(struct led_classdev *cdev,
> @@ -187,11 +187,7 @@ static const struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm = {
> .max_brightness = KEYBOARD_BACKLIGHT_MAX,
> };
>
> -#else /* CONFIG_CROS_EC */
> -
> -static const struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm = {};
> -
> -#endif /* CONFIG_CROS_EC */
> +#endif /* IS_ENABLED(CONFIG_CROS_EC) && defined(CONFIG_OF) */
>
> static int keyboard_led_probe(struct platform_device *pdev)
> {
> --
> 2.37.0.170.g444d1eabd0-goog
>
Powered by blists - more mailing lists