gpio-button-hotplug: fix kernel 5.4 support

This commit is contained in:
coolsnowwolf 2024-01-13 13:50:40 +08:00
parent ce521963da
commit b1816c7d0c
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2008-2012 OpenWrt.org
# Copyright (C) 2008-2024 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.

View File

@ -538,10 +538,14 @@ static int gpio_keys_button_probe(struct platform_device *pdev,
struct device_node *child =
of_get_next_child(dev->of_node, prev);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
bdata->gpiod = devm_fwnode_gpiod_get(dev,
of_fwnode_handle(child), "gpios", GPIOD_IN,
desc);
#else
bdata->gpiod = devm_gpiod_get_from_of_node(dev,
child, "gpios", 0, GPIOD_IN, desc);
#endif
prev = child;
}