Commit 380c7ba3 authored by Andy Shevchenko's avatar Andy Shevchenko

gpiolib: Clean up headers

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent 5b191197
...@@ -7,17 +7,19 @@ ...@@ -7,17 +7,19 @@
* Mika Westerberg <mika.westerberg@linux.intel.com> * Mika Westerberg <mika.westerberg@linux.intel.com>
*/ */
#include <linux/acpi.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
#include <linux/gpio/machine.h>
#include <linux/export.h> #include <linux/export.h>
#include <linux/acpi.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/pinctrl.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
#include <linux/gpio/machine.h>
#include "gpiolib.h" #include "gpiolib.h"
#include "gpiolib-acpi.h" #include "gpiolib-acpi.h"
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#define GPIOLIB_ACPI_H #define GPIOLIB_ACPI_H
#include <linux/err.h> #include <linux/err.h>
#include <linux/errno.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
......
...@@ -10,14 +10,16 @@ ...@@ -10,14 +10,16 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/module.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/gpio/consumer.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
#include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/pinctrl.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/string.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/machine.h> #include <linux/gpio/machine.h>
#include "gpiolib.h" #include "gpiolib.h"
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#define GPIOLIB_OF_H #define GPIOLIB_OF_H
#include <linux/err.h> #include <linux/err.h>
#include <linux/errno.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/notifier.h> #include <linux/notifier.h>
......
...@@ -6,13 +6,14 @@ ...@@ -6,13 +6,14 @@
*/ */
#include <linux/err.h> #include <linux/err.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/printk.h> #include <linux/printk.h>
#include <linux/property.h> #include <linux/property.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
#include "gpiolib.h" #include "gpiolib.h"
#include "gpiolib-swnode.h" #include "gpiolib-swnode.h"
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include <linux/bitops.h>
#include <linux/device.h>
#include <linux/idr.h> #include <linux/idr.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kdev_t.h>
#include <linux/kstrtox.h>
#include <linux/list.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/device.h> #include <linux/printk.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/string.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
#include <linux/types.h>
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h> #include <linux/gpio/driver.h>
#include <linux/interrupt.h>
#include <linux/kdev_t.h>
#include <linux/slab.h>
#include <linux/ctype.h>
#include "gpiolib.h" #include "gpiolib.h"
#include "gpiolib-sysfs.h" #include "gpiolib-sysfs.h"
struct kernfs_node;
#define GPIO_IRQF_TRIGGER_NONE 0 #define GPIO_IRQF_TRIGGER_NONE 0
#define GPIO_IRQF_TRIGGER_FALLING BIT(0) #define GPIO_IRQF_TRIGGER_FALLING BIT(0)
#define GPIO_IRQF_TRIGGER_RISING BIT(1) #define GPIO_IRQF_TRIGGER_RISING BIT(1)
......
...@@ -6,22 +6,25 @@ ...@@ -6,22 +6,25 @@
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/errno.h>
#include <linux/file.h> #include <linux/file.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/gpio.h>
#include <linux/gpio/driver.h>
#include <linux/gpio/machine.h>
#include <linux/idr.h> #include <linux/idr.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h>
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/gpio.h>
#include <linux/gpio/driver.h>
#include <linux/gpio/machine.h>
#include <uapi/linux/gpio.h> #include <uapi/linux/gpio.h>
#include "gpiolib-acpi.h" #include "gpiolib-acpi.h"
......
...@@ -12,9 +12,10 @@ ...@@ -12,9 +12,10 @@
#ifndef __LINUX_GPIO_H #ifndef __LINUX_GPIO_H
#define __LINUX_GPIO_H #define __LINUX_GPIO_H
#include <linux/errno.h>
#include <linux/types.h> #include <linux/types.h>
struct device;
/* see Documentation/driver-api/gpio/legacy.rst */ /* see Documentation/driver-api/gpio/legacy.rst */
/* make these flag values available regardless of GPIO kconfig options */ /* make these flag values available regardless of GPIO kconfig options */
...@@ -134,19 +135,16 @@ void gpio_free_array(const struct gpio *array, size_t num); ...@@ -134,19 +135,16 @@ void gpio_free_array(const struct gpio *array, size_t num);
/* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */ /* 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(struct device *dev, unsigned gpio, const char *label);
int devm_gpio_request_one(struct device *dev, unsigned gpio, int devm_gpio_request_one(struct device *dev, unsigned gpio,
unsigned long flags, const char *label); unsigned long flags, const char *label);
#else /* ! CONFIG_GPIOLIB */ #else /* ! CONFIG_GPIOLIB */
#include <linux/bug.h>
#include <linux/kernel.h> #include <linux/kernel.h>
struct device; #include <asm/bug.h>
struct gpio_chip; #include <asm/errno.h>
static inline bool gpio_is_valid(int number) static inline bool gpio_is_valid(int number)
{ {
......
...@@ -3,15 +3,14 @@ ...@@ -3,15 +3,14 @@
#define __LINUX_GPIO_CONSUMER_H #define __LINUX_GPIO_CONSUMER_H
#include <linux/bits.h> #include <linux/bits.h>
#include <linux/bug.h> #include <linux/types.h>
#include <linux/compiler_types.h>
#include <linux/err.h>
struct acpi_device; struct acpi_device;
struct device; struct device;
struct fwnode_handle; struct fwnode_handle;
struct gpio_desc;
struct gpio_array; struct gpio_array;
struct gpio_desc;
/** /**
* struct gpio_descs - Struct containing an array of descriptors that can be * 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, ...@@ -185,8 +184,11 @@ struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev,
#else /* CONFIG_GPIOLIB */ #else /* CONFIG_GPIOLIB */
#include <linux/err.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <asm/bug.h>
static inline int gpiod_count(struct device *dev, const char *con_id) static inline int gpiod_count(struct device *dev, const char *con_id)
{ {
return 0; return 0;
...@@ -616,6 +618,8 @@ struct gpio_desc *acpi_get_and_request_gpiod(char *path, unsigned int pin, char ...@@ -616,6 +618,8 @@ struct gpio_desc *acpi_get_and_request_gpiod(char *path, unsigned int pin, char
#else /* CONFIG_GPIOLIB && CONFIG_ACPI */ #else /* CONFIG_GPIOLIB && CONFIG_ACPI */
#include <linux/err.h>
static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev, static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev,
const struct acpi_gpio_mapping *gpios) const struct acpi_gpio_mapping *gpios)
{ {
...@@ -647,6 +651,8 @@ void gpiod_unexport(struct gpio_desc *desc); ...@@ -647,6 +651,8 @@ void gpiod_unexport(struct gpio_desc *desc);
#else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */ #else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */
#include <asm/errno.h>
static inline int gpiod_export(struct gpio_desc *desc, static inline int gpiod_export(struct gpio_desc *desc,
bool direction_may_change) bool direction_may_change)
{ {
......
...@@ -2,27 +2,35 @@ ...@@ -2,27 +2,35 @@
#ifndef __LINUX_GPIO_DRIVER_H #ifndef __LINUX_GPIO_DRIVER_H
#define __LINUX_GPIO_DRIVER_H #define __LINUX_GPIO_DRIVER_H
#include <linux/device.h> #include <linux/bits.h>
#include <linux/irq.h>
#include <linux/irqchip/chained_irq.h> #include <linux/irqchip/chained_irq.h>
#include <linux/irqdomain.h> #include <linux/irqdomain.h>
#include <linux/irqhandler.h>
#include <linux/lockdep.h> #include <linux/lockdep.h>
#include <linux/pinctrl/pinconf-generic.h> #include <linux/pinctrl/pinconf-generic.h>
#include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/pinctrl.h>
#include <linux/property.h> #include <linux/property.h>
#include <linux/spinlock_types.h>
#include <linux/types.h> #include <linux/types.h>
#ifdef CONFIG_GENERIC_MSI_IRQ
#include <asm/msi.h> #include <asm/msi.h>
#endif
struct gpio_desc; struct device;
struct irq_chip;
struct irq_data;
struct module;
struct of_phandle_args; struct of_phandle_args;
struct pinctrl_dev;
struct seq_file; struct seq_file;
struct gpio_device;
struct module;
enum gpiod_flags;
enum gpio_lookup_flags;
struct gpio_chip; struct gpio_chip;
struct gpio_desc;
struct gpio_device;
enum gpio_lookup_flags;
enum gpiod_flags;
union gpio_irq_fwspec { union gpio_irq_fwspec {
struct irq_fwspec fwspec; struct irq_fwspec fwspec;
...@@ -679,6 +687,10 @@ bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gc, ...@@ -679,6 +687,10 @@ bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gc,
int gpiochip_irqchip_add_domain(struct gpio_chip *gc, int gpiochip_irqchip_add_domain(struct gpio_chip *gc,
struct irq_domain *domain); struct irq_domain *domain);
#else #else
#include <asm/bug.h>
#include <asm/errno.h>
static inline int gpiochip_irqchip_add_domain(struct gpio_chip *gc, static inline int gpiochip_irqchip_add_domain(struct gpio_chip *gc,
struct irq_domain *domain) struct irq_domain *domain)
{ {
...@@ -756,6 +768,10 @@ struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc); ...@@ -756,6 +768,10 @@ struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);
#else /* CONFIG_GPIOLIB */ #else /* CONFIG_GPIOLIB */
#include <linux/err.h>
#include <asm/bug.h>
static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
{ {
/* GPIO can never have been requested */ /* GPIO can never have been requested */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment