gpio: loongson: Use right include
The driver includes <linux/gpio.h> which is wrong, rely on <linux/gpio/driver.h> and remove to call to gpio_set_value() in favor of calling the internal function. Move functions around to avoid forward declarations. Cc: Keguang Zhang <keguang.zhang@gmail.com> Cc: Jiaxun Yang <jiaxun.yang@flygoat.com> Cc: Huacai Chen <chenhc@lemote.com> Cc: linux-mips@linux-mips.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
@@ -17,9 +17,9 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
|
#include <linux/gpio/driver.h>
|
||||||
#include <asm/types.h>
|
#include <asm/types.h>
|
||||||
#include <loongson.h>
|
#include <loongson.h>
|
||||||
#include <linux/gpio.h>
|
|
||||||
|
|
||||||
#define STLS2F_N_GPIO 4
|
#define STLS2F_N_GPIO 4
|
||||||
#define STLS3A_N_GPIO 16
|
#define STLS3A_N_GPIO 16
|
||||||
@@ -34,38 +34,6 @@
|
|||||||
|
|
||||||
static DEFINE_SPINLOCK(gpio_lock);
|
static DEFINE_SPINLOCK(gpio_lock);
|
||||||
|
|
||||||
static int loongson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
|
|
||||||
{
|
|
||||||
u32 temp;
|
|
||||||
u32 mask;
|
|
||||||
|
|
||||||
spin_lock(&gpio_lock);
|
|
||||||
mask = 1 << gpio;
|
|
||||||
temp = LOONGSON_GPIOIE;
|
|
||||||
temp |= mask;
|
|
||||||
LOONGSON_GPIOIE = temp;
|
|
||||||
spin_unlock(&gpio_lock);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int loongson_gpio_direction_output(struct gpio_chip *chip,
|
|
||||||
unsigned gpio, int level)
|
|
||||||
{
|
|
||||||
u32 temp;
|
|
||||||
u32 mask;
|
|
||||||
|
|
||||||
gpio_set_value(gpio, level);
|
|
||||||
spin_lock(&gpio_lock);
|
|
||||||
mask = 1 << gpio;
|
|
||||||
temp = LOONGSON_GPIOIE;
|
|
||||||
temp &= (~mask);
|
|
||||||
LOONGSON_GPIOIE = temp;
|
|
||||||
spin_unlock(&gpio_lock);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int loongson_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
|
static int loongson_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
|
||||||
{
|
{
|
||||||
u32 val;
|
u32 val;
|
||||||
@@ -97,6 +65,38 @@ static void loongson_gpio_set_value(struct gpio_chip *chip,
|
|||||||
spin_unlock(&gpio_lock);
|
spin_unlock(&gpio_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int loongson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
|
||||||
|
{
|
||||||
|
u32 temp;
|
||||||
|
u32 mask;
|
||||||
|
|
||||||
|
spin_lock(&gpio_lock);
|
||||||
|
mask = 1 << gpio;
|
||||||
|
temp = LOONGSON_GPIOIE;
|
||||||
|
temp |= mask;
|
||||||
|
LOONGSON_GPIOIE = temp;
|
||||||
|
spin_unlock(&gpio_lock);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int loongson_gpio_direction_output(struct gpio_chip *chip,
|
||||||
|
unsigned gpio, int level)
|
||||||
|
{
|
||||||
|
u32 temp;
|
||||||
|
u32 mask;
|
||||||
|
|
||||||
|
loongson_gpio_set_value(chip, gpio, level);
|
||||||
|
spin_lock(&gpio_lock);
|
||||||
|
mask = 1 << gpio;
|
||||||
|
temp = LOONGSON_GPIOIE;
|
||||||
|
temp &= (~mask);
|
||||||
|
LOONGSON_GPIOIE = temp;
|
||||||
|
spin_unlock(&gpio_lock);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static struct gpio_chip loongson_chip = {
|
static struct gpio_chip loongson_chip = {
|
||||||
.label = "Loongson-gpio-chip",
|
.label = "Loongson-gpio-chip",
|
||||||
.direction_input = loongson_gpio_direction_input,
|
.direction_input = loongson_gpio_direction_input,
|
||||||
|
Reference in New Issue
Block a user