mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-15 18:03:30 +00:00
gpio-button-hotplug: sync upstream
This commit is contained in:
parent
19978f14dc
commit
171cb58c1d
@ -302,7 +302,7 @@ struct gpio_keys_button_dev {
|
||||
|
||||
struct device *dev;
|
||||
struct gpio_keys_platform_data *pdata;
|
||||
struct gpio_keys_button_data data[0];
|
||||
struct gpio_keys_button_data data[];
|
||||
};
|
||||
|
||||
static void gpio_keys_polled_queue_work(struct gpio_keys_button_dev *bdev)
|
||||
@ -373,7 +373,7 @@ gpio_keys_get_devtree_pdata(struct device *dev)
|
||||
if (!node)
|
||||
return NULL;
|
||||
|
||||
nbuttons = of_get_child_count(node);
|
||||
nbuttons = of_get_available_child_count(node);
|
||||
if (nbuttons == 0)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
@ -388,7 +388,7 @@ gpio_keys_get_devtree_pdata(struct device *dev)
|
||||
pdata->rep = !!of_get_property(node, "autorepeat", NULL);
|
||||
of_property_read_u32(node, "poll-interval", &pdata->poll_interval);
|
||||
|
||||
for_each_child_of_node(node, pp) {
|
||||
for_each_available_child_of_node(node, pp) {
|
||||
button = (struct gpio_keys_button *)(&pdata->buttons[i++]);
|
||||
|
||||
if (of_property_read_u32(pp, "linux,code", &button->code)) {
|
||||
@ -525,10 +525,9 @@ static int gpio_keys_button_probe(struct platform_device *pdev,
|
||||
button->active_low ? GPIOF_ACTIVE_LOW :
|
||||
0), desc);
|
||||
if (error) {
|
||||
if (error != -EPROBE_DEFER) {
|
||||
dev_err(dev, "unable to claim gpio %d, err=%d\n",
|
||||
button->gpio, error);
|
||||
}
|
||||
dev_err_probe(dev, error,
|
||||
"unable to claim gpio %d",
|
||||
button->gpio);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -679,7 +678,11 @@ static void gpio_keys_irq_close(struct gpio_keys_button_dev *bdev)
|
||||
}
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
|
||||
static int gpio_keys_remove(struct platform_device *pdev)
|
||||
#else
|
||||
static void gpio_keys_remove(struct platform_device *pdev)
|
||||
#endif
|
||||
{
|
||||
struct gpio_keys_button_dev *bdev = platform_get_drvdata(pdev);
|
||||
|
||||
@ -690,29 +693,25 @@ static int gpio_keys_remove(struct platform_device *pdev)
|
||||
else
|
||||
gpio_keys_irq_close(bdev);
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static struct platform_driver gpio_keys_driver = {
|
||||
.probe = gpio_keys_probe,
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6,12,0)
|
||||
.remove = gpio_keys_remove,
|
||||
#endif
|
||||
.driver = {
|
||||
.name = "gpio-keys",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = of_match_ptr(gpio_keys_of_match),
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_driver gpio_keys_polled_driver = {
|
||||
.probe = gpio_keys_polled_probe,
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6,12,0)
|
||||
.remove = gpio_keys_remove,
|
||||
#endif
|
||||
.driver = {
|
||||
.name = "gpio-keys-polled",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = of_match_ptr(gpio_keys_polled_of_match),
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user