diff mbox series

[6/9] backports: virtio_config: Add virtio_find_vqs()

Message ID 20200420221615.14734-7-hauke@hauke-m.de (mailing list archive)
State New, archived
Headers show
Series backports: Update to version 5.7-rc2 | expand

Commit Message

Hauke Mehrtens April 20, 2020, 10:16 p.m. UTC
The virtio_find_vqs() function is now used by the mac80211_hwsim driver.
This is just a wrapper around the find_vqs callback. The find_vqs
callback changed over the time.
With kernel 4.10 the names parameter was changed from "const char
*names[]" to "const char * const names[]".
With kernel 4.11 the "struct irq_affinity *desc" was added. We have to
define struct irq_affinity here for older kernel versions, because it
is used in this new parameter in kernel >= 4.12 this is already done in
the upstream header file.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 .../backport-include/linux/virtio_config.h    | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 backport/backport-include/linux/virtio_config.h
diff mbox series

Patch

diff --git a/backport/backport-include/linux/virtio_config.h b/backport/backport-include/linux/virtio_config.h
new file mode 100644
index 00000000..aeb1ba10
--- /dev/null
+++ b/backport/backport-include/linux/virtio_config.h
@@ -0,0 +1,31 @@ 
+#ifndef _COMPAT_LINUX_VIRTIO_CONFIG_H
+#define _COMPAT_LINUX_VIRTIO_CONFIG_H
+#include_next <linux/virtio_config.h>
+
+#include <linux/version.h>
+
+#if LINUX_VERSION_IS_LESS(4,11,0)
+struct irq_affinity;
+#endif
+
+#if LINUX_VERSION_IS_LESS(4,12,0)
+static inline
+int virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs,
+			struct virtqueue *vqs[], vq_callback_t *callbacks[],
+#if LINUX_VERSION_IS_LESS(4,10,0)
+			const char * const names[],
+#else
+			const char *names[],
+#endif
+			struct irq_affinity *desc)
+{
+#if LINUX_VERSION_IS_LESS(4,11,0)
+	return vdev->config->find_vqs(vdev, nvqs, vqs, callbacks, names);
+#else
+	return vdev->config->find_vqs(vdev, nvqs, vqs, callbacks, names, desc);
+#endif
+}
+#endif /* < 4.12 */
+
+
+#endif	/* _COMPAT_LINUX_VIRTIO_CONFIG_H */