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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 .../backport-include/linux/virtio_config.h    | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 backport/backport-include/linux/virtio_config.h

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 */
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux