From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zm0a0-0002yy-Kw for qemu-devel@nongnu.org; Tue, 13 Oct 2015 10:29:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zm0Zz-0001cb-Ph for qemu-devel@nongnu.org; Tue, 13 Oct 2015 10:29:28 -0400 Received: from mail-pa0-x22c.google.com ([2607:f8b0:400e:c03::22c]:33387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zm0Zz-0001cX-L7 for qemu-devel@nongnu.org; Tue, 13 Oct 2015 10:29:27 -0400 Received: by pabrc13 with SMTP id rc13so23227151pab.0 for ; Tue, 13 Oct 2015 07:29:27 -0700 (PDT) Sender: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= From: marcandre.lureau@redhat.com Date: Tue, 13 Oct 2015 16:26:14 +0200 Message-Id: <1444746378-12338-48-git-send-email-marcandre.lureau@redhat.com> In-Reply-To: <1444746378-12338-1-git-send-email-marcandre.lureau@redhat.com> References: <1444746378-12338-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PULL v3 47/51] ivshmem: remove EventfdEntry.vector List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, drjones@redhat.com, claudio.fontana@huawei.com, stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , pbonzini@redhat.com, cam@cs.ualberta.ca From: Marc-André Lureau No need to store an extra int for the vector number when it can be computed easily by looking at the position in the array. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 2fdb92b..3283874 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -68,7 +68,6 @@ typedef struct Peer { typedef struct EventfdEntry { PCIDevice *pdev; - int vector; } EventfdEntry; typedef struct IVShmemState { @@ -287,9 +286,11 @@ static void fake_irqfd(void *opaque, const uint8_t *buf, int size) { EventfdEntry *entry = opaque; PCIDevice *pdev = entry->pdev; + IVShmemState *s = IVSHMEM(pdev); + int vector = entry - s->eventfd_table; - IVSHMEM_DPRINTF("interrupt on vector %p %d\n", pdev, entry->vector); - msix_notify(pdev, entry->vector); + IVSHMEM_DPRINTF("interrupt on vector %p %d\n", pdev, vector); + msix_notify(pdev, vector); } static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier *n, @@ -311,7 +312,6 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier * /* if MSI is supported we need multiple interrupts */ if (ivshmem_has_feature(s, IVSHMEM_MSI)) { s->eventfd_table[vector].pdev = PCI_DEVICE(s); - s->eventfd_table[vector].vector = vector; qemu_chr_add_handlers(chr, ivshmem_can_receive, fake_irqfd, ivshmem_event, &s->eventfd_table[vector]); -- 2.4.3