gpio: bcm-kona: Include proper header
This driver has no business including <linux/gpio.h>, it is a driver so include <linux/gpio/driver.h>. GPIOF_DIR_IN/GPIOF_DIR_OUT are for consumers and should not be used in drivers to use just 1/0 instead. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
2e21ec4c40
commit
14ec018e15
|
@ -17,7 +17,7 @@
|
||||||
#include <linux/bitops.h>
|
#include <linux/bitops.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio/driver.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
#include <linux/of_irq.h>
|
#include <linux/of_irq.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
@ -127,7 +127,7 @@ static int bcm_kona_gpio_get_dir(struct gpio_chip *chip, unsigned gpio)
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
val = readl(reg_base + GPIO_CONTROL(gpio)) & GPIO_GPCTR0_IOTR_MASK;
|
val = readl(reg_base + GPIO_CONTROL(gpio)) & GPIO_GPCTR0_IOTR_MASK;
|
||||||
return val ? GPIOF_DIR_IN : GPIOF_DIR_OUT;
|
return !!val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bcm_kona_gpio_set(struct gpio_chip *chip, unsigned gpio, int value)
|
static void bcm_kona_gpio_set(struct gpio_chip *chip, unsigned gpio, int value)
|
||||||
|
@ -144,7 +144,7 @@ static void bcm_kona_gpio_set(struct gpio_chip *chip, unsigned gpio, int value)
|
||||||
raw_spin_lock_irqsave(&kona_gpio->lock, flags);
|
raw_spin_lock_irqsave(&kona_gpio->lock, flags);
|
||||||
|
|
||||||
/* this function only applies to output pin */
|
/* this function only applies to output pin */
|
||||||
if (bcm_kona_gpio_get_dir(chip, gpio) == GPIOF_DIR_IN)
|
if (bcm_kona_gpio_get_dir(chip, gpio) == 1)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
reg_offset = value ? GPIO_OUT_SET(bank_id) : GPIO_OUT_CLEAR(bank_id);
|
reg_offset = value ? GPIO_OUT_SET(bank_id) : GPIO_OUT_CLEAR(bank_id);
|
||||||
|
@ -170,7 +170,7 @@ static int bcm_kona_gpio_get(struct gpio_chip *chip, unsigned gpio)
|
||||||
reg_base = kona_gpio->reg_base;
|
reg_base = kona_gpio->reg_base;
|
||||||
raw_spin_lock_irqsave(&kona_gpio->lock, flags);
|
raw_spin_lock_irqsave(&kona_gpio->lock, flags);
|
||||||
|
|
||||||
if (bcm_kona_gpio_get_dir(chip, gpio) == GPIOF_DIR_IN)
|
if (bcm_kona_gpio_get_dir(chip, gpio) == 1)
|
||||||
reg_offset = GPIO_IN_STATUS(bank_id);
|
reg_offset = GPIO_IN_STATUS(bank_id);
|
||||||
else
|
else
|
||||||
reg_offset = GPIO_OUT_STATUS(bank_id);
|
reg_offset = GPIO_OUT_STATUS(bank_id);
|
||||||
|
|
Loading…
Reference in New Issue