mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
platform/chrome: cros_kbd_led_backlight: support OF match
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> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Link: https://lore.kernel.org/r/20220523090822.3035189-5-tzungbi@kernel.org
This commit is contained in:
parent
20f370efdd
commit
fd1e8054ff
@ -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>
|
||||
|
||||
/**
|
||||
@ -116,7 +118,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;
|
||||
|
||||
@ -152,10 +154,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),
|
||||
},
|
||||
.probe = keyboard_led_probe,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user