From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCnoI-0003Ty-U5 for qemu-devel@nongnu.org; Fri, 23 Aug 2013 05:37:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCno9-0003Fo-NU for qemu-devel@nongnu.org; Fri, 23 Aug 2013 05:37:38 -0400 Received: from e23smtp02.au.ibm.com ([202.81.31.144]:33705) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCno9-0003Dx-4k for qemu-devel@nongnu.org; Fri, 23 Aug 2013 05:37:29 -0400 Received: from /spool/local by e23smtp02.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 23 Aug 2013 19:26:05 +1000 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [9.190.235.21]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id CCB6A2CE8056 for ; Fri, 23 Aug 2013 19:37:19 +1000 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r7N9b3lL9634086 for ; Fri, 23 Aug 2013 19:37:08 +1000 Received: from d23av01.au.ibm.com (localhost [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r7N9bEQT018462 for ; Fri, 23 Aug 2013 19:37:14 +1000 Date: Fri, 23 Aug 2013 17:37:12 +0800 From: Wei Yang Message-ID: <20130823093712.GA32232@weiyang.vnet.ibm.com> References: <1377248615-23039-1-git-send-email-pbonzini@redhat.com> <1377248615-23039-10-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1377248615-23039-10-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PULL 9/9] kvm: shorten the parameter list for get_real_device() Reply-To: Wei Yang List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: anthony@codemonkey.ws, Wei Yang , qemu-devel@nongnu.org, gleb@redhat.com Paolo, Is it necessary to add this? From: Wei Yang On Fri, Aug 23, 2013 at 11:03:35AM +0200, Paolo Bonzini wrote: >get_real_device() has 5 parameters with the last 4 is contained in the first >structure. > >This patch removes the last 4 parameters and directly use them from the first >parameter. > >Acked-by: Alex Williamson >Signed-off-by: Wei Yang >Signed-off-by: Paolo Bonzini >--- > hw/i386/kvm/pci-assign.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > >diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c >index ff33dc8..73941b2 100644 >--- a/hw/i386/kvm/pci-assign.c >+++ b/hw/i386/kvm/pci-assign.c >@@ -568,8 +568,7 @@ static int get_real_device_id(const char *devpath, uint16_t *val) > return get_real_id(devpath, "device", val); > } > >-static int get_real_device(AssignedDevice *pci_dev, uint16_t r_seg, >- uint8_t r_bus, uint8_t r_dev, uint8_t r_func) >+static int get_real_device(AssignedDevice *pci_dev) > { > char dir[128], name[128]; > int fd, r = 0, v; >@@ -582,7 +581,8 @@ static int get_real_device(AssignedDevice *pci_dev, uint16_t r_seg, > dev->region_number = 0; > > snprintf(dir, sizeof(dir), "/sys/bus/pci/devices/%04x:%02x:%02x.%x/", >- r_seg, r_bus, r_dev, r_func); >+ pci_dev->host.domain, pci_dev->host.bus, >+ pci_dev->host.slot, pci_dev->host.function); > > snprintf(name, sizeof(name), "%sconfig", dir); > >@@ -1769,8 +1769,7 @@ static int assigned_initfn(struct PCIDevice *pci_dev) > memcpy(dev->emulate_config_write, dev->emulate_config_read, > sizeof(dev->emulate_config_read)); > >- if (get_real_device(dev, dev->host.domain, dev->host.bus, >- dev->host.slot, dev->host.function)) { >+ if (get_real_device(dev)) { > error_report("pci-assign: Error: Couldn't get real device (%s)!", > dev->dev.qdev.id); > goto out; >-- >1.8.3.1 -- Richard Yang Help you, Help me