From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Guenter Roeck <groeck@google.com>
Cc: Benson Leung <bleung@chromium.org>,
Guenter Roeck <groeck@chromium.org>,
"open list:CHROME HARDWARE PLATFORM SUPPORT"
<chrome-platform@lists.linux.dev>,
linux-kernel <linux-kernel@vger.kernel.org>,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v2] platform/chrome: cros_kbd_led_backlight: fix build warning
Date: Tue, 19 Jul 2022 04:54:03 +0000 [thread overview]
Message-ID: <YtY460lI465ne00L@google.com> (raw)
In-Reply-To: <CABXOdTdKpqsqajhQzQ1aEp6bsa96ONN6nz9EWZv6jGSuN0_LTA@mail.gmail.com>
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@kernel.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
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?
next prev parent reply other threads:[~2022-07-19 4:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-18 10:50 [PATCH v2] platform/chrome: cros_kbd_led_backlight: fix build warning Tzung-Bi Shih
2022-07-18 13:28 ` Guenter Roeck
2022-07-19 4:54 ` Tzung-Bi Shih [this message]
2022-07-19 19:31 ` Guenter Roeck
2022-07-20 1:30 ` patchwork-bot+chrome-platform
2022-07-21 8:50 ` patchwork-bot+chrome-platform
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YtY460lI465ne00L@google.com \
--to=tzungbi@kernel.org \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=groeck@chromium.org \
--cc=groeck@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox