Commit adf5412d authored by Bartosz Golaszewski's avatar Bartosz Golaszewski
Browse files

gpio: altera: 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 driver to using
them.

Link: https://lore.kernel.org/r/20250303-gpiochip-set-conversion-v1-8-1d5cceeebf8b@linaro.org


Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent 65a0b13d
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ static int altera_gpio_get(struct gpio_chip *gc, unsigned offset)
	return !!(readl(altera_gc->regs + ALTERA_GPIO_DATA) & BIT(offset));
}

static void altera_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
static int altera_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
{
	struct altera_gpio_chip *altera_gc = gpiochip_get_data(gc);
	unsigned long flags;
@@ -127,6 +127,8 @@ static void altera_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
		data_reg &= ~BIT(offset);
	writel(data_reg, altera_gc->regs + ALTERA_GPIO_DATA);
	raw_spin_unlock_irqrestore(&altera_gc->gpio_lock, flags);

	return 0;
}

static int altera_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
@@ -257,7 +259,7 @@ static int altera_gpio_probe(struct platform_device *pdev)
	altera_gc->gc.direction_input	= altera_gpio_direction_input;
	altera_gc->gc.direction_output	= altera_gpio_direction_output;
	altera_gc->gc.get		= altera_gpio_get;
	altera_gc->gc.set		= altera_gpio_set;
	altera_gc->gc.set_rv		= altera_gpio_set;
	altera_gc->gc.owner		= THIS_MODULE;
	altera_gc->gc.parent		= &pdev->dev;
	altera_gc->gc.base		= -1;