From patchwork Tue Sep 24 16:13:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Richard X-Patchwork-Id: 1989002 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=JP3wd27d; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XClNh1HYLz1xst for ; Wed, 25 Sep 2024 02:16:36 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type:List-Help: Reply-To:List-Archive:List-Unsubscribe:List-Subscribe:From:List-Post:List-Id: Message-ID:MIME-Version:Date:Subject:To:Cc:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=ku7OMFYSME9A3jHMg8o9nf/JetOX9153D5O08rLYKKY=; b=JP3wd27dJ8fn/7voIbcYkj6lPu 8gs1pCfxQO1zfEXgRDJRNB/01Gjit2e4Qyk/F7W0erJg4kEM3+x7SI6BzNZUBdP2+fohd4j3+C+wN q6pizrifvOAFqP//lRvwntt54WUGMbBebp0q7exAk1/zsZO1wEgmTkdRxSRcdy9QG5s7fQcO90uTt +C0C5tnF+W8a0p78kBt1zBj8wxkFnZTSdVsxSRRv7j79YXioh3E3nFo2erBjND1gu22kF7ta8XUxn YdAABBnAclc5Z/7/RBfmg7KzYg4SCKRMTj9JCVQp7bu5WRgd6kXlpAaYlqE+j8gMlGQf5N/z1YeyZ LEGUduRw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1st8C1-00000002mlt-3v8T; Tue, 24 Sep 2024 16:15:13 +0000 To: openwrt-devel@lists.openwrt.org Subject: [PATCH v2] gpio-button-hotplug: skip disabled buttons Date: Tue, 24 Sep 2024 18:13:00 +0200 MIME-Version: 1.0 Message-ID: List-Id: OpenWrt Development List List-Post: X-Patchwork-Original-From: Thomas Richard via openwrt-devel From: Thomas Richard Precedence: list X-Mailman-Version: 2.1.34 X-BeenThere: openwrt-devel@lists.openwrt.org List-Subscribe: , List-Unsubscribe: , List-Archive: Reply-To: Thomas Richard List-Help: Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software. Ignore buttons which are disabled in the devicetree. Reviewed-by: Rosen Penev Signed-off-by: Thomas Richard --- Changes in v2: - take Reviewed-by: Rosen Penev -- package/kernel/gpio-button-hotplug/Makefile | 2 +- package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/gpio-button-hotplug/Makefile b/package/kernel/gpio-button-hotplug/Makefile index 04cbb69ada..5b4085887d 100644 --- a/package/kernel/gpio-button-hotplug/Makefile +++ b/package/kernel/gpio-button-hotplug/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=gpio-button-hotplug -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_LICENSE:=GPL-2.0 include $(INCLUDE_DIR)/package.mk diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c index 17748219e8..a73e5c4e5a 100644 --- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c +++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c @@ -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)) {