Commit 37022f74 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Thomas Bogendoerfer
Browse files

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: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
parent 68bdc4dc
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ 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,
static int txx9_gpio_set(struct gpio_chip *chip, unsigned int offset,
			 int value)
{
	unsigned long flags;
@@ -40,6 +40,8 @@ static void txx9_gpio_set(struct gpio_chip *chip, unsigned int offset,
	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",
+5 −3
Original line number Diff line number Diff line
@@ -603,7 +603,7 @@ 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,
static int txx9_iocled_set(struct gpio_chip *chip, unsigned int offset,
			   int value)
{
	struct txx9_iocled_data *data = gpiochip_get_data(chip);
@@ -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";