Re: [PATCH v4 4/5] platform/chrome: cros_kbd_led_backlight: support OF match

From: Matthias Kaehlcke
Date: Wed May 25 2022 - 11:12:23 EST


On Wed, May 25, 2022 at 11:33:25AM +0800, Tzung-Bi Shih wrote:
> On Tue, May 24, 2022 at 01:08:00PM -0700, Matthias Kaehlcke wrote:
> > On Mon, May 23, 2022 at 05:08:21PM +0800, Tzung-Bi Shih wrote:
> > > +#ifdef CONFIG_OF
> > > +static const struct of_device_id keyboard_led_of_match[] = {
> > > + {
> > > + .compatible = "google,cros-kbd-led-backlight",
> > > + },
> > > + {}
> > > +};
> > > +MODULE_DEVICE_TABLE(of, keyboard_led_of_match);
> > > +#endif
> > > +
> > > static struct platform_driver keyboard_led_driver = {
> > > .driver = {
> > > .name = "chromeos-keyboard-leds",
> > > .acpi_match_table = ACPI_PTR(keyboard_led_acpi_match),
> > > + .of_match_table = of_match_ptr(keyboard_led_of_match),
> >
> > You need to put this assignment inside an '#ifdef CONFIG_OF' block,
> > otherwise the compiler won't find 'keyboard_led_of_match' when
> > CONFIG_OF isn't set.
>
> It doesn't need as of_match_ptr() already guarded it.

I learned something new today :)

Reviewed-by: Matthias Kaehlcke <mka@xxxxxxxxxxxx>