[PATCH 10/17] kvm tools: irq: remove remaining parameters to irq__register_device

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

 



With the removal of the x86 irq rbtree, the only parameter used by
irq__register_device is actually used to return the new line.

This patch removes all of the parameters from irq__register_device and
returns the allocated line directly.

Signed-off-by: Will Deacon <will.deacon@xxxxxxx>
---
 tools/kvm/arm/irq.c         | 5 ++---
 tools/kvm/hw/pci-shmem.c    | 7 +------
 tools/kvm/hw/vesa.c         | 7 +------
 tools/kvm/include/kvm/irq.h | 2 +-
 tools/kvm/powerpc/irq.c     | 5 ++---
 tools/kvm/virtio/mmio.c     | 7 ++-----
 tools/kvm/virtio/pci.c      | 7 +------
 tools/kvm/x86/irq.c         | 5 ++---
 8 files changed, 12 insertions(+), 33 deletions(-)

diff --git a/tools/kvm/arm/irq.c b/tools/kvm/arm/irq.c
index dd53f1216c51..39d4fbc23314 100644
--- a/tools/kvm/arm/irq.c
+++ b/tools/kvm/arm/irq.c
@@ -4,10 +4,9 @@
 
 #include "arm-common/gic.h"
 
-int irq__register_device(u32 dev, u8 *line)
+int irq__register_device(void)
 {
-	*line = gic__alloc_irqnum();
-	return 0;
+	return gic__alloc_irqnum();
 }
 
 int irq__add_msix_route(struct kvm *kvm, struct msi_msg *msg)
diff --git a/tools/kvm/hw/pci-shmem.c b/tools/kvm/hw/pci-shmem.c
index d0d88f821aba..c0c63223e6d9 100644
--- a/tools/kvm/hw/pci-shmem.c
+++ b/tools/kvm/hw/pci-shmem.c
@@ -352,7 +352,6 @@ int shmem_parser(const struct option *opt, const char *arg, int unset)
 
 int pci_shmem__init(struct kvm *kvm)
 {
-	u8 line;
 	char *mem;
 	int r;
 
@@ -360,12 +359,8 @@ int pci_shmem__init(struct kvm *kvm)
 		return 0;
 
 	/* Register good old INTx */
-	r = irq__register_device(PCI_DEVICE_ID_PCI_SHMEM, &line);
-	if (r < 0)
-		return r;
-
 	pci_shmem_pci_device.irq_pin = 1;
-	pci_shmem_pci_device.irq_line = line;
+	pci_shmem_pci_device.irq_line = irq__register_device();
 
 	/* Register MMIO space for MSI-X */
 	r = ioport__register(kvm, IOPORT_EMPTY, &shmem_pci__io_ops, IOPORT_SIZE, NULL);
diff --git a/tools/kvm/hw/vesa.c b/tools/kvm/hw/vesa.c
index 07c3978c785e..f033ebed0790 100644
--- a/tools/kvm/hw/vesa.c
+++ b/tools/kvm/hw/vesa.c
@@ -55,23 +55,18 @@ static struct framebuffer vesafb;
 struct framebuffer *vesa__init(struct kvm *kvm)
 {
 	u16 vesa_base_addr;
-	u8 line;
 	char *mem;
 	int r;
 
 	if (!kvm->cfg.vnc && !kvm->cfg.sdl && !kvm->cfg.gtk)
 		return NULL;
 
-	r = irq__register_device(PCI_DEVICE_ID_VESA, &line);
-	if (r < 0)
-		return ERR_PTR(r);
-
 	r = ioport__register(kvm, IOPORT_EMPTY, &vesa_io_ops, IOPORT_SIZE, NULL);
 	if (r < 0)
 		return ERR_PTR(r);
 
 	vesa_pci_device.irq_pin		= 1;
-	vesa_pci_device.irq_line	= line;
+	vesa_pci_device.irq_line	= irq__register_device();
 	vesa_base_addr			= (u16)r;
 	vesa_pci_device.bar[0]		= cpu_to_le32(vesa_base_addr | PCI_BASE_ADDRESS_SPACE_IO);
 	device__register(&vesa_device);
diff --git a/tools/kvm/include/kvm/irq.h b/tools/kvm/include/kvm/irq.h
index 7652b8587464..14cf574849b3 100644
--- a/tools/kvm/include/kvm/irq.h
+++ b/tools/kvm/include/kvm/irq.h
@@ -10,7 +10,7 @@
 
 struct kvm;
 
-int irq__register_device(u32 dev, u8 *line);
+int irq__register_device(void);
 
 int irq__init(struct kvm *kvm);
 int irq__exit(struct kvm *kvm);
diff --git a/tools/kvm/powerpc/irq.c b/tools/kvm/powerpc/irq.c
index d906bb2840bc..3436ae85027f 100644
--- a/tools/kvm/powerpc/irq.c
+++ b/tools/kvm/powerpc/irq.c
@@ -32,14 +32,13 @@
  * generic & cope with multiple PPC platform types.
  */
 
-int irq__register_device(u32 dev, u8 *line)
+int irq__register_device(void)
 {
 	/*
 	 * Have I said how nasty I find this?  Line should be dontcare... PHB
 	 * should determine which CPU/XICS IRQ to fire.
 	 */
-	*line = xics_alloc_irqnum();
-	return 0;
+	return xics_alloc_irqnum();
 }
 
 int irq__add_msix_route(struct kvm *kvm, struct msi_msg *msg)
diff --git a/tools/kvm/virtio/mmio.c b/tools/kvm/virtio/mmio.c
index 90f90ede3c1f..a8212bacd599 100644
--- a/tools/kvm/virtio/mmio.c
+++ b/tools/kvm/virtio/mmio.c
@@ -260,7 +260,6 @@ int virtio_mmio_init(struct kvm *kvm, void *dev, struct virtio_device *vdev,
 		     int device_id, int subsys_id, int class)
 {
 	struct virtio_mmio *vmmio = vdev->virtio;
-	u8 line;
 
 	vmmio->addr	= virtio_mmio_get_io_space_block(VIRTIO_MMIO_IO_SIZE);
 	vmmio->kvm	= kvm;
@@ -277,9 +276,7 @@ int virtio_mmio_init(struct kvm *kvm, void *dev, struct virtio_device *vdev,
 		.queue_num_max	= 256,
 	};
 
-	if (irq__register_device(subsys_id, &line) < 0)
-		return -1;
-	vmmio->irq = line;
+	vmmio->irq = irq__register_device();
 	vmmio->dev_hdr = (struct device_header) {
 		.bus_type	= DEVICE_BUS_MMIO,
 		.data		= generate_virtio_mmio_fdt_node,
@@ -293,7 +290,7 @@ int virtio_mmio_init(struct kvm *kvm, void *dev, struct virtio_device *vdev,
 	 *
 	 * virtio_mmio.devices=0x200@0xd2000000:5,0x200@0xd2000200:6
 	 */
-	pr_info("virtio-mmio.devices=0x%x@0x%x:%d\n", VIRTIO_MMIO_IO_SIZE, vmmio->addr, line);
+	pr_info("virtio-mmio.devices=0x%x@0x%x:%d\n", VIRTIO_MMIO_IO_SIZE, vmmio->addr, vmmio->irq);
 
 	return 0;
 }
diff --git a/tools/kvm/virtio/pci.c b/tools/kvm/virtio/pci.c
index 77dde3bee741..8005e17195d9 100644
--- a/tools/kvm/virtio/pci.c
+++ b/tools/kvm/virtio/pci.c
@@ -335,7 +335,6 @@ int virtio_pci__init(struct kvm *kvm, void *dev, struct virtio_device *vdev,
 		     int device_id, int subsys_id, int class)
 {
 	struct virtio_pci *vpci = vdev->virtio;
-	u8 line;
 	int r;
 
 	vpci->kvm = kvm;
@@ -406,15 +405,11 @@ int virtio_pci__init(struct kvm *kvm, void *dev, struct virtio_device *vdev,
 	vpci->pci_hdr.msix.pba_offset = cpu_to_le32(2 | PCI_IO_SIZE);
 	vpci->config_vector = 0;
 
-	r = irq__register_device(subsys_id, &line);
-	if (r < 0)
-		goto free_msix_mmio;
-
 	if (kvm__supports_extension(kvm, KVM_CAP_SIGNAL_MSI))
 		vpci->features |= VIRTIO_PCI_F_SIGNAL_MSI;
 
 	vpci->pci_hdr.irq_pin	= 1;
-	vpci->pci_hdr.irq_line	= line;
+	vpci->pci_hdr.irq_line	= irq__register_device();
 	r = device__register(&vpci->dev_hdr);
 	if (r < 0)
 		goto free_msix_mmio;
diff --git a/tools/kvm/x86/irq.c b/tools/kvm/x86/irq.c
index ef5ec34aebff..2c7606998926 100644
--- a/tools/kvm/x86/irq.c
+++ b/tools/kvm/x86/irq.c
@@ -39,10 +39,9 @@ static int irq__add_routing(u32 gsi, u32 type, u32 irqchip, u32 pin)
 	return 0;
 }
 
-int irq__register_device(u32 dev, u8 *line)
+int irq__register_device(void)
 {
-	*line = next_line++;
-	return 0;
+	return next_line++;
 }
 
 int irq__init(struct kvm *kvm)
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux