platform/x86: silicom: 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.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20250408-gpiochip-set-rv-platform-x86-v1-3-6f67e76a722c@linaro.org
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
Bartosz Golaszewski 2025-04-08 09:19:55 +02:00 committed by Ilpo Järvinen
parent e0071ad2ee
commit 88f67f2a99
No known key found for this signature in database
GPG Key ID: 59AC4F6153E5CE31

View File

@ -245,18 +245,19 @@ static int silicom_gpio_direction_input(struct gpio_chip *gc,
return direction == GPIO_LINE_DIRECTION_IN ? 0 : -EINVAL;
}
static void silicom_gpio_set(struct gpio_chip *gc,
unsigned int offset,
int value)
static int silicom_gpio_set(struct gpio_chip *gc, unsigned int offset,
int value)
{
int direction = silicom_gpio_get_direction(gc, offset);
u8 *channels = gpiochip_get_data(gc);
int channel = channels[offset];
if (direction == GPIO_LINE_DIRECTION_IN)
return;
return -EPERM;
silicom_mec_port_set(channel, !value);
return 0;
}
static int silicom_gpio_direction_output(struct gpio_chip *gc,
@ -469,7 +470,7 @@ static struct gpio_chip silicom_gpio_chip = {
.direction_input = silicom_gpio_direction_input,
.direction_output = silicom_gpio_direction_output,
.get = silicom_gpio_get,
.set = silicom_gpio_set,
.set_rv = silicom_gpio_set,
.base = -1,
.ngpio = ARRAY_SIZE(plat_0222_gpio_channels),
.names = plat_0222_gpio_names,