* [Qemu-devel] [PATCH] kvm: shoten the parameter list for get_real_device()
@ 2013-08-19 1:19 Wei Yang
2013-08-22 14:39 ` Alex Williamson
0 siblings, 1 reply; 3+ messages in thread
From: Wei Yang @ 2013-08-19 1:19 UTC (permalink / raw)
To: qemu-devel, alex.williamson, aliguori; +Cc: Wei Yang
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.
Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
---
hw/i386/kvm/pci-assign.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index 5618173..011764f 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.7.5.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] kvm: shoten the parameter list for get_real_device()
2013-08-19 1:19 [Qemu-devel] [PATCH] kvm: shoten the parameter list for get_real_device() Wei Yang
@ 2013-08-22 14:39 ` Alex Williamson
2013-08-22 16:41 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Alex Williamson @ 2013-08-22 14:39 UTC (permalink / raw)
To: Wei Yang; +Cc: aliguori, qemu-devel
On Mon, 2013-08-19 at 09:19 +0800, Wei Yang 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.
>
> Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Seems harmless enough
Acked-by: Alex Williamson <alex.williamson@redhat.com>
> ---
> hw/i386/kvm/pci-assign.c | 9 ++++-----
> 1 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
> index 5618173..011764f 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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] kvm: shoten the parameter list for get_real_device()
2013-08-22 14:39 ` Alex Williamson
@ 2013-08-22 16:41 ` Paolo Bonzini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2013-08-22 16:41 UTC (permalink / raw)
To: Alex Williamson; +Cc: Wei Yang, aliguori, qemu-devel
Il 22/08/2013 16:39, Alex Williamson ha scritto:
> On Mon, 2013-08-19 at 09:19 +0800, Wei Yang 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.
>>
>> Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
>
>
> Seems harmless enough
>
> Acked-by: Alex Williamson <alex.williamson@redhat.com>
Applying, thanks.
Paolo
>> ---
>> hw/i386/kvm/pci-assign.c | 9 ++++-----
>> 1 files changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
>> index 5618173..011764f 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;
>
>
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-22 19:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-19 1:19 [Qemu-devel] [PATCH] kvm: shoten the parameter list for get_real_device() Wei Yang
2013-08-22 14:39 ` Alex Williamson
2013-08-22 16:41 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).