gpio-button-hotplug: skip disabled buttons
authorThomas Richard <thomas.richard@bootlin.com>
Tue, 24 Sep 2024 16:13:00 +0000 (18:13 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Tue, 8 Oct 2024 20:32:43 +0000 (22:32 +0200)
Ignore buttons which are disabled in the devicetree.

Reviewed-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
Link: https://patchwork.ozlabs.org/project/openwrt/patch/mailman.117522.1727194512.1280.openwrt-devel@lists.openwrt.org/
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/kernel/gpio-button-hotplug/Makefile
package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c

index 5b4085887d4828dc06e9d808918ea071d9e295b7..caa3dce01e258ac24128c8b55c86a58651eed62d 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=gpio-button-hotplug
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 PKG_LICENSE:=GPL-2.0
 
 include $(INCLUDE_DIR)/package.mk
index de100777f240e432fe243fe7c23ed621a337b499..1dd0ff2a1a1abf09be4fd279771c2749c1e0c47e 100644 (file)
@@ -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)) {