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

gpio: mc33880: use new GPIO 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/20250506-gpiochip-set-rv-gpio-part3-v1-11-0fbdea5a9667@linaro.org


Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent dff5a31d
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -57,15 +57,18 @@ static int __mc33880_set(struct mc33880 *mc, unsigned offset, int value)
}


static void mc33880_set(struct gpio_chip *chip, unsigned offset, int value)
static int mc33880_set(struct gpio_chip *chip, unsigned int offset, int value)
{
	struct mc33880 *mc = gpiochip_get_data(chip);
	int ret;

	mutex_lock(&mc->lock);

	__mc33880_set(mc, offset, value);
	ret = __mc33880_set(mc, offset, value);

	mutex_unlock(&mc->lock);

	return ret;
}

static int mc33880_probe(struct spi_device *spi)
@@ -100,7 +103,7 @@ static int mc33880_probe(struct spi_device *spi)
	mc->spi = spi;

	mc->chip.label = DRIVER_NAME;
	mc->chip.set = mc33880_set;
	mc->chip.set_rv = mc33880_set;
	mc->chip.base = pdata->base;
	mc->chip.ngpio = PIN_NUMBER;
	mc->chip.can_sleep = true;