From patchwork Wed Mar 30 14:50:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12795938 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E817DC4321E for ; Wed, 30 Mar 2022 14:50:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qcr1pd/xROX9oNeGpHgZbaWySNrNlkSBEPJUlO7M2Is=; b=IEFYleXfwp9isp OhQIkq5HEE8oF1F7ghoftKUtvF3EFB2VSs9fiXuW0P38iRjNgTT5WrQk6OBApebsHjwoWhHcsa2Kj v8OzOsQGnzwy3tUH19v3KTDGumCSey5HEUsRCP2z2t3H7kam3U+0B2YKhNGVCHdeuG1dKHHt16Exc +lC7KC8t8HxrIe/Po/ijzMcWC6aJXmTN0bWCyAuH2AafxzK9HDyKmKC74qLOtwl1CLi4TNu/NvjwB SEkjMbQTunGTYwN3TusUlEhZch2Bv1M2ydMGv0zYsGAQ1soAVoWZCZo1lsYBp3H/cv0GrZkcVn3Ew Dr8XZaZrtH5qHTgmNfNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nZZeT-00GIb1-LQ; Wed, 30 Mar 2022 14:50:25 +0000 Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nZZeO-00GIXn-PK; Wed, 30 Mar 2022 14:50:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648651820; x=1680187820; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=m3ZHKE2qreMdK9+hlgzfsg822h8hNwlohIi/nUeWDvU=; b=cPs1NYpAJTaPP9zVNpB9Q7bUL0y8UtLOMozNBtXqpF1BbFzOXdchQEc4 F522qdBuKk/SB7zuxuYjLp43VkrIKxhw6j7FN1EIRms2D+NKTS7j+lz2Q EpWFYqRxR74ZAk9bKBi9Fzm6tK3tL9t9hYsZlhBvhGNS7nRLS1LAy8cqA JRIT0y1bM22QNssY8/S5Olvqswl/4CYnGxB7SXMahLmHdatAVMfonD93I Zm3cMX7YGOaKs+DxJjoVx8vUI+z92ok5GFXqCEAHrSdrXnuwVH/bCJff/ hnVCI+c5TG9Oo83sblePpPIn5CKZgEVPNyBlMZn4bBXYhUUfJllVUaRjG Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10301"; a="257139568" X-IronPort-AV: E=Sophos;i="5.90,222,1643702400"; d="scan'208";a="257139568" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 07:50:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,222,1643702400"; d="scan'208";a="837349185" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 30 Mar 2022 07:50:11 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 244049B; Wed, 30 Mar 2022 17:50:33 +0300 (EEST) From: Andy Shevchenko To: Qianggui Song , Andy Shevchenko , Geert Uytterhoeven , Krzysztof Kozlowski , Fabien Dessenne , Linus Walleij , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, linux-renesas-soc@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Cc: Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Tomasz Figa , Sylwester Nawrocki , Alim Akhtar , Maxime Coquelin , Alexandre Torgue , Bartosz Golaszewski , Philipp Zabel Subject: [PATCH v3 01/13] gpiolib: Introduce for_each_gpiochip_node() loop helper Date: Wed, 30 Mar 2022 17:50:18 +0300 Message-Id: <20220330145030.1562-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220330145030.1562-1-andriy.shevchenko@linux.intel.com> References: <20220330145030.1562-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220330_075020_901959_C4068885 X-CRM114-Status: GOOD ( 12.28 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Introduce for_each_gpiochip_node() loop helper which iterates over the GPIO controller child nodes of a given device. Signed-off-by: Andy Shevchenko Reviewed-by: Geert Uytterhoeven Tested-by: Geert Uytterhoeven --- include/linux/gpio/driver.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index b0728c8ad90c..2142ffc7338c 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -3,13 +3,14 @@ #define __LINUX_GPIO_DRIVER_H #include -#include #include #include #include #include #include #include +#include +#include struct gpio_desc; struct of_phandle_args; @@ -747,4 +748,8 @@ static inline void gpiochip_unlock_as_irq(struct gpio_chip *gc, } #endif /* CONFIG_GPIOLIB */ +#define for_each_gpiochip_node(dev, child) \ + device_for_each_child_node(dev, child) \ + if (!fwnode_property_present(child, "gpio-controller")) {} else + #endif /* __LINUX_GPIO_DRIVER_H */