mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
MIPS: txx9: gpio: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the drivers to using them. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
This commit is contained in:
parent
68bdc4dc11
commit
37022f745b
2 changed files with 10 additions and 6 deletions
|
@ -32,14 +32,16 @@ static void txx9_gpio_set_raw(unsigned int offset, int value)
|
|||
__raw_writel(val, &txx9_pioptr->dout);
|
||||
}
|
||||
|
||||
static void txx9_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||
int value)
|
||||
static int txx9_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||
int value)
|
||||
{
|
||||
unsigned long flags;
|
||||
spin_lock_irqsave(&txx9_gpio_lock, flags);
|
||||
txx9_gpio_set_raw(offset, value);
|
||||
mmiowb();
|
||||
spin_unlock_irqrestore(&txx9_gpio_lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int txx9_gpio_dir_in(struct gpio_chip *chip, unsigned int offset)
|
||||
|
@ -68,7 +70,7 @@ static int txx9_gpio_dir_out(struct gpio_chip *chip, unsigned int offset,
|
|||
|
||||
static struct gpio_chip txx9_gpio_chip = {
|
||||
.get = txx9_gpio_get,
|
||||
.set = txx9_gpio_set,
|
||||
.set_rv = txx9_gpio_set,
|
||||
.direction_input = txx9_gpio_dir_in,
|
||||
.direction_output = txx9_gpio_dir_out,
|
||||
.label = "TXx9",
|
||||
|
|
|
@ -603,8 +603,8 @@ static int txx9_iocled_get(struct gpio_chip *chip, unsigned int offset)
|
|||
return !!(data->cur_val & (1 << offset));
|
||||
}
|
||||
|
||||
static void txx9_iocled_set(struct gpio_chip *chip, unsigned int offset,
|
||||
int value)
|
||||
static int txx9_iocled_set(struct gpio_chip *chip, unsigned int offset,
|
||||
int value)
|
||||
{
|
||||
struct txx9_iocled_data *data = gpiochip_get_data(chip);
|
||||
unsigned long flags;
|
||||
|
@ -616,6 +616,8 @@ static void txx9_iocled_set(struct gpio_chip *chip, unsigned int offset,
|
|||
writeb(data->cur_val, data->mmioaddr);
|
||||
mmiowb();
|
||||
spin_unlock_irqrestore(&txx9_iocled_lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int txx9_iocled_dir_in(struct gpio_chip *chip, unsigned int offset)
|
||||
|
@ -653,7 +655,7 @@ void __init txx9_iocled_init(unsigned long baseaddr,
|
|||
if (!iocled->mmioaddr)
|
||||
goto out_free;
|
||||
iocled->chip.get = txx9_iocled_get;
|
||||
iocled->chip.set = txx9_iocled_set;
|
||||
iocled->chip.set_rv = txx9_iocled_set;
|
||||
iocled->chip.direction_input = txx9_iocled_dir_in;
|
||||
iocled->chip.direction_output = txx9_iocled_dir_out;
|
||||
iocled->chip.label = "iocled";
|
||||
|
|
Loading…
Add table
Reference in a new issue