lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 19 Jul 2022 12:31:40 -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 v2] platform/chrome: cros_kbd_led_backlight: fix build warning

On Mon, Jul 18, 2022 at 9:54 PM Tzung-Bi Shih <tzungbi@...nel.org> wrote:
>
> On Mon, Jul 18, 2022 at 06:28:22AM -0700, Guenter Roeck wrote:
> > On Mon, Jul 18, 2022 at 3:51 AM 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/
> > >
> > > Fix the warning by using __maybe_unused.  Also use IS_ENABLED() because
> > > CROS_EC is a tristate.
> >
> > Is that sufficient ? What happens if CROS_KBD_LED_BACKLIGHT=y and
> > CROS_EC=m ? I suspect you might need IS_REACHABLE() instead of
> > IS_ENABLED().
>
> For current code, it's impossible to set CROS_KBD_LED_BACKLIGHT=y and
> CROS_EC=m without setting ACPI=y.  Given that the dependencies:
> CHROME_PLATFORMS [=y] && LEDS_CLASS [=y] && (ACPI [=n] || CROS_EC [=m]).
>
> $ ./scripts/kconfig/merge_config.sh -n <(cat <<EOF
> CONFIG_MODULES=y
>
> CONFIG_NEW_LEDS=y
> CONFIG_LEDS_CLASS=y
>
> CONFIG_CHROME_PLATFORMS=y
> CONFIG_CROS_EC=m
> CONFIG_CROS_KBD_LED_BACKLIGHT=y
> EOF
> )
> [...]
> Value requested for CONFIG_CROS_KBD_LED_BACKLIGHT not in final .config
> Requested value:  CONFIG_CROS_KBD_LED_BACKLIGHT=y
> Actual value:     CONFIG_CROS_KBD_LED_BACKLIGHT=m
>

It is actually possible to configure CONFIG_CROS_KBD_LED_BACKLIGHT=y
with CONFIG_CROS_EC=m, by also setting CONFIG_LEDS_CLASS=y. However,
that doesn't seem to matter since the critical symbol is CROS_EC_PROTO
which is boolean.
Given that, IS_ENABLED should be fine.

Reviewed-by: Guenter Roeck <groeck@...omium.org>

Thanks,
Guenter

> However, when ACPI=y, `keyboard_led_drvdata_ec_pwm` is unused.  Instead, it
> uses `keyboard_led_drvdata_acpi` for current code.
>
> I guess IS_ENABLED() is sufficient.  Does it make sense?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ