From: Matthias Kaehlcke <mka@chromium.org>
To: Tzung-Bi Shih <tzungbi@kernel.org>
Cc: bleung@chromium.org, groeck@chromium.org, robh+dt@kernel.org,
chrome-platform@lists.linux.dev, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, Guenter Roeck <linux@roeck-us.net>
Subject: Re: [PATCH v3 4/5] platform/chrome: cros_kbd_led_backlight: support OF match
Date: Thu, 19 May 2022 15:49:48 -0700 [thread overview]
Message-ID: <YobJjMmVOv1lBI/y@google.com> (raw)
In-Reply-To: <20220321085547.1162312-5-tzungbi@kernel.org>
On Mon, Mar 21, 2022 at 04:55:46PM +0800, Tzung-Bi Shih wrote:
> For letting device tree based machines to use the driver, support OF match.
>
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
> ---
> Changes from v2:
> - Add commit message.
> - Add R-b tag.
>
> Changes from v1:
> (https://patchwork.kernel.org/project/chrome-platform/patch/20220214053646.3088298-5-tzungbi@google.com/)
> - Update email address accordingly.
> - Use device_get_match_data() per review comment in v1.
>
> drivers/platform/chrome/cros_kbd_led_backlight.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/chrome/cros_kbd_led_backlight.c b/drivers/platform/chrome/cros_kbd_led_backlight.c
> index 05b4f274086b..5cbe27cb4610 100644
> --- a/drivers/platform/chrome/cros_kbd_led_backlight.c
> +++ b/drivers/platform/chrome/cros_kbd_led_backlight.c
> @@ -10,7 +10,9 @@
> #include <linux/kernel.h>
> #include <linux/leds.h>
> #include <linux/module.h>
> +#include <linux/of.h>
> #include <linux/platform_device.h>
> +#include <linux/property.h>
> #include <linux/slab.h>
>
> /**
> @@ -127,7 +129,7 @@ static int keyboard_led_probe(struct platform_device *pdev)
> const struct keyboard_led_drvdata *drvdata;
> int error;
>
> - drvdata = acpi_device_get_match_data(&pdev->dev);
> + drvdata = device_get_match_data(&pdev->dev);
> if (!drvdata)
> return -EINVAL;
>
> @@ -163,10 +165,21 @@ static const struct acpi_device_id keyboard_led_acpi_match[] = {
> MODULE_DEVICE_TABLE(acpi, keyboard_led_acpi_match);
> #endif
>
> +#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),
In patch "[5/5] platform/chrome: cros_kbd_led_backlight: support EC PWM
backend" [1] you create the 'stubs' keyboard_led_init_ec_pwm_null() and
keyboard_led_drvdata_ec_pwm when CONFIG_CROS_KBD_LED_BACKLIGHT_EC_PWM
isn't set, only to have something to assign to keyboard_led_of_match.data.
Instead you could assign .of_match_table only if CONFIG_CROS_KBD_LED_BACKLIGHT_EC_PWM
is set.
[1] https://patchwork.kernel.org/project/chrome-platform/patch/20220321085547.1162312-6-tzungbi@kernel.org/
next prev parent reply other threads:[~2022-05-19 22:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-21 8:55 [PATCH v3 0/5] platform/chrome: cros_kbd_led_backlight: add EC PWM backend Tzung-Bi Shih
2022-03-21 8:55 ` [PATCH v3 1/5] platform/chrome: cros_kbd_led_backlight: sort headers alphabetically Tzung-Bi Shih
2022-03-21 8:55 ` [PATCH v3 2/5] platform/chrome: cros_kbd_led_backlight: separate ACPI backend Tzung-Bi Shih
2022-03-21 8:55 ` [PATCH v3 3/5] dt-bindings: add google,cros-kbd-led-backlight Tzung-Bi Shih
2022-03-21 8:55 ` [PATCH v3 4/5] platform/chrome: cros_kbd_led_backlight: support OF match Tzung-Bi Shih
2022-05-19 22:49 ` Matthias Kaehlcke [this message]
2022-03-21 8:55 ` [PATCH v3 5/5] platform/chrome: cros_kbd_led_backlight: support EC PWM backend Tzung-Bi Shih
2022-05-19 22:40 ` Matthias Kaehlcke
2022-05-20 4:53 ` Tzung-Bi Shih
2022-05-20 15:29 ` Matthias Kaehlcke
2022-05-23 5:34 ` Tzung-Bi Shih
2022-05-24 19:52 ` Matthias Kaehlcke
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=YobJjMmVOv1lBI/y@google.com \
--to=mka@chromium.org \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=devicetree@vger.kernel.org \
--cc=groeck@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=robh+dt@kernel.org \
--cc=tzungbi@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).