From patchwork Wed Jan 25 20:10:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 48308 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp472630wrn; Wed, 25 Jan 2023 12:32:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXsJyGBvguUhdlsGonsroCfeBa6SQshfT/3JDemF7KhOEMzB5M1Y4JU5Ews9/IlUTHqznwvB X-Received: by 2002:a17:90a:199:b0:22b:b794:bb43 with SMTP id 25-20020a17090a019900b0022bb794bb43mr20608802pjc.38.1674678745583; Wed, 25 Jan 2023 12:32:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674678745; cv=none; d=google.com; s=arc-20160816; b=0uWtxnEHiDEKLmiQbcXC8XNfcJEcf40T+dPnFfonboix9F5E0lepN8a8D2PKtLxfGO otfPYDM+t2I3SMCmf1R9IVtI4b6qeGCuMU34v11uW1eK3D0WsWrDPDeBV9tEtvFZOCMh wIfAYS0ENp10qU6k1OCUqJ8GJlbWwyODORn4WN12VNmhqdY8zzmBnSdjWzWzp/lZ/nX6 QW1p6IG+F6OJ/5inH5pCc6KHm5JxXBWTbQu4+LNVOZSpo5NyTQCn9PqKsAvGLy4SPedE PIjFTR8DMJRyNFYNbg6GpwSUDdBM2G7WDhvHpV58ph2bYQ8B8NDr5WxWxulepuKRwDeP vspQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZYgc6RwvcpnihvTmkIyK0mMHhhnD6/qByl7dyE+zDvM=; b=RQNZJkhkBsZEk0KzQOZtQXi5X6cg8raQnPFuH7FRAVFHtVZpcIs9WUUz3yRCqd0klU kZWUO5RzZskbcHhEkHUZ69U8ghWm3ufinBiXkWXsgGr+QysQOg1dXLjcCVxkJW+inmsR 5SRQ9bl9zggGZ19PIXfU++PhaUZjF0dhlkgCcTNxAR5BPzAxHLFkfnqk1pl8u4OsKzzm ETvKAa4j6kO2SMnzlgcln94qKwsQxlVFJLgGigpQnt5m3gb1uHzU8MWQXL4e+yTES7Bq By3st1ubPYdRpoL7KLtPbVgVPpJLjrsiHxMmYNGYdyxLK78gSeaFWG+jWnhIaNS6IgsV YL0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="RYWrCao/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i185-20020a636dc2000000b004a03cdc3f29si6518750pgc.140.2023.01.25.12.32.12; Wed, 25 Jan 2023 12:32:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="RYWrCao/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236376AbjAYUMI (ORCPT + 99 others); Wed, 25 Jan 2023 15:12:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236353AbjAYUMD (ORCPT ); Wed, 25 Jan 2023 15:12:03 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6C795D90F; Wed, 25 Jan 2023 12:11:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674677495; x=1706213495; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=o+ZGOHz8ijK9H+L7WtFqSqHxlRgWx6avT4sRFNpRp9Y=; b=RYWrCao/9Oq9LHh3AJg9okif5Lrotr0WovidRrbRkOce7OtQiGQ4jC/5 G3GZnikn7iSLe9bUfkY/It2CspXOLSg31uvWr3Tyv177gjb9qQ11wb2WG nQdHbNsJllmVSJy0Evu1hCjVOJpxHGSYc89FQAXqIafDt63rSHedTzdJi lDkZ+cfWypyJo1AD1sakfsJAENOVzjtM9EqFKpZPlKyt1/wjBQ3FZTB72 9QwF5gTp6UvY8ybwRERvzJOBif/sWto5Kr45BiFQncB2X0sSJY8R6z9HT l19YpCXWo7pDTnjdxTDPnVnzTHRcmaomcDdVQ/4+vlkPsFIqiRV4fZH9f A==; X-IronPort-AV: E=McAfee;i="6500,9779,10601"; a="326694799" X-IronPort-AV: E=Sophos;i="5.97,246,1669104000"; d="scan'208";a="326694799" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2023 12:09:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10601"; a="770871663" X-IronPort-AV: E=Sophos;i="5.97,246,1669104000"; d="scan'208";a="770871663" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 25 Jan 2023 12:09:52 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 57E9636E; Wed, 25 Jan 2023 22:10:25 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Bartosz Golaszewski , Christophe Leroy , Dmitry Torokhov , linux-gpio@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Linus Walleij , Bartosz Golaszewski , Arnd Bergmann Subject: [PATCH v1 5/5] gpio: Clean up headers Date: Wed, 25 Jan 2023 22:10:20 +0200 Message-Id: <20230125201020.10948-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230125201020.10948-1-andriy.shevchenko@linux.intel.com> References: <20230125201020.10948-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756027939837214796?= X-GMAIL-MSGID: =?utf-8?q?1756027939837214796?= There is a few things done: - include only the headers we are direct user of - when pointer is in use, provide a forward declaration - add missing headers - group generic headers and subsystem headers - sort each group alphabetically Signed-off-by: Andy Shevchenko --- include/asm-generic/gpio.h | 8 -------- include/linux/gpio.h | 9 +++------ include/linux/gpio/consumer.h | 14 ++++++++++---- include/linux/gpio/driver.h | 34 ++++++++++++++++++++++++---------- 4 files changed, 37 insertions(+), 28 deletions(-) diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 22cb8c9efc1d..5d4d3529324c 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -3,11 +3,9 @@ #define _ASM_GENERIC_GPIO_H #include -#include #ifdef CONFIG_GPIOLIB -#include #include #include @@ -24,12 +22,7 @@ */ #define GPIO_DYNAMIC_BASE 512 -struct device; struct gpio; -struct seq_file; -struct module; -struct device_node; -struct gpio_desc; /* Always use the library code for GPIO management calls, * or when sleeping may be involved. @@ -60,7 +53,6 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value) return gpiod_set_raw_value_cansleep(gpio_to_desc(gpio), value); } - /* A platform's code may want to inline the I/O calls when * the GPIO is constant and refers to some always-present controller, * giving direct access to chip registers and tight bitbanging loops. diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 85beb236c925..cc28c8d5e93c 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h @@ -12,7 +12,7 @@ #ifndef __LINUX_GPIO_H #define __LINUX_GPIO_H -#include +struct device; /* see Documentation/driver-api/gpio/legacy.rst */ @@ -85,20 +85,17 @@ static inline int gpio_to_irq(unsigned int gpio) /* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */ -struct device; - int devm_gpio_request(struct device *dev, unsigned gpio, const char *label); int devm_gpio_request_one(struct device *dev, unsigned gpio, unsigned long flags, const char *label); #else /* ! CONFIG_GPIOLIB */ -#include #include #include -struct device; -struct gpio_chip; +#include +#include static inline bool gpio_is_valid(int number) { diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index 5432e5d5fbfb..1c4385a00f88 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -3,15 +3,14 @@ #define __LINUX_GPIO_CONSUMER_H #include -#include -#include -#include +#include struct acpi_device; struct device; struct fwnode_handle; -struct gpio_desc; + struct gpio_array; +struct gpio_desc; /** * struct gpio_descs - Struct containing an array of descriptors that can be @@ -185,8 +184,11 @@ struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev, #else /* CONFIG_GPIOLIB */ +#include #include +#include + static inline int gpiod_count(struct device *dev, const char *con_id) { return 0; @@ -616,6 +618,8 @@ struct gpio_desc *acpi_get_and_request_gpiod(char *path, unsigned int pin, char #else /* CONFIG_GPIOLIB && CONFIG_ACPI */ +#include + static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev, const struct acpi_gpio_mapping *gpios) { @@ -647,6 +651,8 @@ void gpiod_unexport(struct gpio_desc *desc); #else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */ +#include + static inline int gpiod_export(struct gpio_desc *desc, bool direction_may_change) { diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index caf2376dd98b..208c7cfeadb2 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -2,26 +2,29 @@ #ifndef __LINUX_GPIO_DRIVER_H #define __LINUX_GPIO_DRIVER_H -#include -#include -#include +#include #include +#include #include -#include #include #include +#include #include +#ifdef CONFIG_GENERIC_MSI_IRQ #include +#endif -struct gpio_desc; +struct device; +struct irq_chip; +struct irq_data; +struct module; struct of_phandle_args; +struct pinctrl_dev; struct seq_file; -struct gpio_device; -struct module; -enum gpiod_flags; -enum gpio_lookup_flags; +struct gpio_desc; +struct gpio_device; struct gpio_chip; union gpio_irq_fwspec { @@ -691,6 +694,10 @@ bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gc, int gpiochip_irqchip_add_domain(struct gpio_chip *gc, struct irq_domain *domain); #else + +#include +#include + static inline int gpiochip_irqchip_add_domain(struct gpio_chip *gc, struct irq_domain *domain) { @@ -752,6 +759,9 @@ gpiochip_remove_pin_ranges(struct gpio_chip *gc) #ifdef CONFIG_GPIOLIB +enum gpiod_flags; +enum gpio_lookup_flags; + struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *gc, unsigned int hwnum, const char *label, @@ -768,8 +778,12 @@ struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc); #else /* CONFIG_GPIOLIB */ -#include +#include + +#include + #include +#include static inline struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *gc, unsigned int hwnum,