From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zgvwx-0005AL-2i for qemu-devel@nongnu.org; Tue, 29 Sep 2015 10:32:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zgvwt-0003Cx-06 for qemu-devel@nongnu.org; Tue, 29 Sep 2015 10:32:11 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:8698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zgvws-0003Co-OH for qemu-devel@nongnu.org; Tue, 29 Sep 2015 10:32:06 -0400 References: <1443094669-4144-1-git-send-email-marcandre.lureau@redhat.com> <1443094669-4144-45-git-send-email-marcandre.lureau@redhat.com> From: Claudio Fontana Message-ID: <560AA0E2.9050105@huawei.com> Date: Tue, 29 Sep 2015 16:32:02 +0200 MIME-Version: 1.0 In-Reply-To: <1443094669-4144-45-git-send-email-marcandre.lureau@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v4 44/47] ivshmem: remove EventfdEntry.vector List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org Cc: pbonzini@redhat.com, drjones@redhat.com, cam@cs.ualberta.ca, stefanha@redhat.com On 24.09.2015 13:37, marcandre.lureau@redhat.com wrote: > 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 > --- > 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 9628e14..619947e 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]); > Reviewed-by: Claudio Fontana