From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC837C0650F for ; Thu, 8 Aug 2019 13:25:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B590D21880 for ; Thu, 8 Aug 2019 13:25:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728327AbfHHNZw (ORCPT ); Thu, 8 Aug 2019 09:25:52 -0400 Received: from mx2.mailbox.org ([80.241.60.215]:58686 "EHLO mx2.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389561AbfHHNZw (ORCPT ); Thu, 8 Aug 2019 09:25:52 -0400 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id D7266A177B; Thu, 8 Aug 2019 15:25:49 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter04.heinlein-hosting.de (spamfilter04.heinlein-hosting.de [80.241.56.122]) (amavisd-new, port 10030) with ESMTP id XI5cvFhH_S4H; Thu, 8 Aug 2019 15:25:44 +0200 (CEST) From: Stefan Roese To: linux-serial@vger.kernel.org, linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Geert Uytterhoeven , Pavel Machek , Linus Walleij , Greg Kroah-Hartman Subject: [PATCH 1/2] gpiolib: Add for_each_gpio_suffix() helper Date: Thu, 8 Aug 2019 15:25:42 +0200 Message-Id: <20190808132543.26274-1-sr@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Add a helper macro to enable the interation over all supported GPIO suffixes (currently "gpios" & "gpio"). This will be used by the serial mctrl code to check, if a GPIO property exists before requesting it. Signed-off-by: Stefan Roese Suggested-by: Andy Shevchenko Cc: Andy Shevchenko Cc: Geert Uytterhoeven Cc: Pavel Machek Cc: Linus Walleij Cc: Greg Kroah-Hartman --- drivers/gpio/gpiolib.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 7c52c2442173..a3add73f99d6 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -92,6 +92,12 @@ struct acpi_gpio_info { /* gpio suffixes used for ACPI and device tree lookup */ static __maybe_unused const char * const gpio_suffixes[] = { "gpios", "gpio" }; +#define for_each_gpio_suffix(idx, suffix) \ + for (idx = 0; \ + idx < ARRAY_SIZE(gpio_suffixes) && \ + (suffix = gpio_suffixes[idx]) != NULL; \ + idx++) + #ifdef CONFIG_OF_GPIO struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, -- 2.22.0