All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/9] virtio: align virtio_config_ops::generation return type with Linux
@ 2021-02-28 19:08 Ahmad Fatoum
  2021-02-28 19:08 ` [PATCH 2/9] virtio: remove unused, left-over, virtio_config_ops::set_features Ahmad Fatoum
                   ` (8 more replies)
  0 siblings, 9 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2021-02-28 19:08 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The U-Boot return type for the function differs from Linux. We use
the Linux API elsewhere, so use it here as well.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 drivers/virtio/virtio_mmio.c  | 8 +++-----
 include/linux/virtio_config.h | 9 ++++-----
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index 821b43871a04..4a689495b8df 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -141,16 +141,14 @@ static int virtio_mmio_set_config(struct virtio_device *vdev, unsigned int offse
 	return 0;
 }
 
-static int virtio_mmio_generation(struct virtio_device *vdev, u32 *counter)
+static u32 virtio_mmio_generation(struct virtio_device *vdev)
 {
 	struct virtio_mmio_device *priv = to_virtio_mmio_device(vdev);
 
 	if (priv->version == 1)
-		*counter = 0;
-	else
-		*counter = readl(priv->base + VIRTIO_MMIO_CONFIG_GENERATION);
+		return 0;
 
-	return 0;
+	return readl(priv->base + VIRTIO_MMIO_CONFIG_GENERATION);
 }
 
 static int virtio_mmio_get_status(struct virtio_device *vdev)
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 5ee0807fb098..3ed7001f4800 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -49,10 +49,9 @@ struct virtio_config_ops {
 	 * generation() - config generation counter
 	 *
 	 * @vdev:	the real virtio device
-	 * @counter:	the returned config generation counter
-	 * @return 0 if OK, -ve on error
+	 * @return the config generation counter
 	 */
-	int (*generation)(struct virtio_device *vdev, u32 *counter);
+	u32 (*generation)(struct virtio_device *vdev);
 	/**
 	 * get_status() - read the status byte
 	 *
@@ -311,7 +310,7 @@ static inline void __virtio_cread_many(struct virtio_device *vdev,
 	int i;
 
 	/* no need to check return value as generation can be optional */
-	vdev->config->generation(vdev, &gen);
+	gen = vdev->config->generation(vdev);
 	do {
 		old = gen;
 
@@ -319,7 +318,7 @@ static inline void __virtio_cread_many(struct virtio_device *vdev,
 			virtio_get_config(vdev, offset + bytes * i,
 					  buf + i * bytes, bytes);
 
-		vdev->config->generation(vdev, &gen);
+		gen = vdev->config->generation(vdev);
 	} while (gen != old);
 }
 
-- 
2.30.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-03-04  0:03 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-28 19:08 [PATCH 1/9] virtio: align virtio_config_ops::generation return type with Linux Ahmad Fatoum
2021-02-28 19:08 ` [PATCH 2/9] virtio: remove unused, left-over, virtio_config_ops::set_features Ahmad Fatoum
2021-02-28 19:08 ` [PATCH 3/9] hw_random: virtio: simplify code Ahmad Fatoum
2021-02-28 19:08 ` [PATCH 4/9] dma: move dma_map/unmap_single from ARM to common code Ahmad Fatoum
2021-03-03 12:08   ` Sascha Hauer
2021-03-03 16:12   ` [PATCH] " Ahmad Fatoum
2021-02-28 19:08 ` [PATCH 5/9] virtio: ring: fix erroneous behavior around caches and MMU Ahmad Fatoum
2021-02-28 19:08 ` [PATCH 6/9] virtio: fix support for big-endian clients Ahmad Fatoum
2021-02-28 19:08 ` [PATCH 7/9] PCI: port Linux pci_find_capability Ahmad Fatoum
2021-02-28 19:08 ` [PATCH 8/9] virtio: support virtio-based device drivers over PCI Ahmad Fatoum
2021-02-28 19:08 ` [PATCH 9/9] virtio: virtio-pci: restrict MIPS support to MMU configuration Ahmad Fatoum
2021-03-02 14:28   ` Antony Pavlov
2021-03-03 17:10     ` Ahmad Fatoum
2021-03-01 16:29 ` [PATCH 1/9] virtio: align virtio_config_ops::generation return type with Linux Sascha Hauer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.