Commit 046e14af authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Linus Walleij
Browse files

gpio: Avoid kernel.h inclusion where it's possible



Inclusion of kernel.h increases the mess with the header dependencies.
Avoid kernel.h inclusion where it's possible.

Besides that, clean up a bit other inclusions inside GPIO subsystem headers.
It includes:
 - removal pin control bits (forward declaration and header) from linux/gpio.h
 - removal of.h from asm-generic/gpio.h
 - use of explicit headers in gpio/consumer.h
 - add FIXME note with regard to gpio.h inclusion in of_gpio,h

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200205134336.20197-1-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent bb6d3fb3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2,10 +2,8 @@
#ifndef _ASM_GENERIC_GPIO_H
#define _ASM_GENERIC_GPIO_H

#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/of.h>

#ifdef CONFIG_GPIOLIB

@@ -140,6 +138,8 @@ static inline void gpio_unexport(unsigned gpio)

#else	/* !CONFIG_GPIOLIB */

#include <linux/kernel.h>

static inline bool gpio_is_valid(int number)
{
	/* only non-negative numbers are valid */
+0 −2
Original line number Diff line number Diff line
@@ -102,11 +102,9 @@ void devm_gpio_free(struct device *dev, unsigned int gpio);
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/bug.h>
#include <linux/pinctrl/pinctrl.h>

struct device;
struct gpio_chip;
struct pinctrl_dev;

static inline bool gpio_is_valid(int number)
{
+4 −1
Original line number Diff line number Diff line
@@ -2,9 +2,10 @@
#ifndef __LINUX_GPIO_CONSUMER_H
#define __LINUX_GPIO_CONSUMER_H

#include <linux/bits.h>
#include <linux/bug.h>
#include <linux/compiler_types.h>
#include <linux/err.h>
#include <linux/kernel.h>

struct device;

@@ -189,6 +190,8 @@ struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev,

#else /* CONFIG_GPIOLIB */

#include <linux/kernel.h>

static inline int gpiod_count(struct device *dev, const char *con_id)
{
	return 0;
+6 −3
Original line number Diff line number Diff line
@@ -11,9 +11,8 @@
#define __LINUX_OF_GPIO_H

#include <linux/compiler.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/gpio.h>
#include <linux/gpio/driver.h>
#include <linux/gpio.h>		/* FIXME: Shouldn't be here */
#include <linux/of.h>

struct device_node;
@@ -34,6 +33,8 @@ enum of_gpio_flags {

#ifdef CONFIG_OF_GPIO

#include <linux/kernel.h>

/*
 * OF GPIO chip for memory mapped banks
 */
@@ -63,6 +64,8 @@ extern void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc);

#else /* CONFIG_OF_GPIO */

#include <linux/errno.h>

/* Drivers may not strictly depend on the GPIO support, so let them link. */
static inline int of_get_named_gpio_flags(struct device_node *np,
		const char *list_name, int index, enum of_gpio_flags *flags)