diff options
| author | saturneric <[email protected]> | 2025-10-16 21:50:56 +0000 |
|---|---|---|
| committer | saturneric <[email protected]> | 2025-10-16 21:50:56 +0000 |
| commit | 5293dcd7ffda472dbf326c81877bb63d2bfcbd10 (patch) | |
| tree | da3be05c4aa1646e5f26a84cd75d83fe866c5358 /drivers/gpio/gpio-virtio.c | |
| parent | Merge tag 'v6.16' (diff) | |
| parent | Linux 6.17 (diff) | |
| download | kernel-5293dcd7ffda472dbf326c81877bb63d2bfcbd10.tar.gz kernel-5293dcd7ffda472dbf326c81877bb63d2bfcbd10.zip | |
Merge tag 'v6.17'
Linux 6.17
Diffstat (limited to 'drivers/gpio/gpio-virtio.c')
| -rw-r--r-- | drivers/gpio/gpio-virtio.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/gpio/gpio-virtio.c b/drivers/gpio/gpio-virtio.c index ac39da17a29b..17e040991e46 100644 --- a/drivers/gpio/gpio-virtio.c +++ b/drivers/gpio/gpio-virtio.c @@ -194,11 +194,12 @@ static int virtio_gpio_get(struct gpio_chip *gc, unsigned int gpio) return ret ? ret : value; } -static void virtio_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value) +static int virtio_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value) { struct virtio_gpio *vgpio = gpiochip_get_data(gc); - virtio_gpio_req(vgpio, VIRTIO_GPIO_MSG_SET_VALUE, gpio, value, NULL); + return virtio_gpio_req(vgpio, VIRTIO_GPIO_MSG_SET_VALUE, gpio, value, + NULL); } /* Interrupt handling */ @@ -526,7 +527,6 @@ static const char **virtio_gpio_get_names(struct virtio_gpio *vgpio, static int virtio_gpio_probe(struct virtio_device *vdev) { - struct virtio_gpio_config config; struct device *dev = &vdev->dev; struct virtio_gpio *vgpio; struct irq_chip *gpio_irq_chip; @@ -539,9 +539,11 @@ static int virtio_gpio_probe(struct virtio_device *vdev) return -ENOMEM; /* Read configuration */ - virtio_cread_bytes(vdev, 0, &config, sizeof(config)); - gpio_names_size = le32_to_cpu(config.gpio_names_size); - ngpio = le16_to_cpu(config.ngpio); + gpio_names_size = + virtio_cread32(vdev, offsetof(struct virtio_gpio_config, + gpio_names_size)); + ngpio = virtio_cread16(vdev, offsetof(struct virtio_gpio_config, + ngpio)); if (!ngpio) { dev_err(dev, "Number of GPIOs can't be zero\n"); return -EINVAL; |
