kvm: shorten the parameter list for get_real_device()
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 <alex.williamson@redhat.com> Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
7477cd3897
commit
867c47cbba
|
@ -568,8 +568,7 @@ static int get_real_device_id(const char *devpath, uint16_t *val)
|
||||||
return get_real_id(devpath, "device", val);
|
return get_real_id(devpath, "device", val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_real_device(AssignedDevice *pci_dev, uint16_t r_seg,
|
static int get_real_device(AssignedDevice *pci_dev)
|
||||||
uint8_t r_bus, uint8_t r_dev, uint8_t r_func)
|
|
||||||
{
|
{
|
||||||
char dir[128], name[128];
|
char dir[128], name[128];
|
||||||
int fd, r = 0, v;
|
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;
|
dev->region_number = 0;
|
||||||
|
|
||||||
snprintf(dir, sizeof(dir), "/sys/bus/pci/devices/%04x:%02x:%02x.%x/",
|
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);
|
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,
|
memcpy(dev->emulate_config_write, dev->emulate_config_read,
|
||||||
sizeof(dev->emulate_config_read));
|
sizeof(dev->emulate_config_read));
|
||||||
|
|
||||||
if (get_real_device(dev, dev->host.domain, dev->host.bus,
|
if (get_real_device(dev)) {
|
||||||
dev->host.slot, dev->host.function)) {
|
|
||||||
error_report("pci-assign: Error: Couldn't get real device (%s)!",
|
error_report("pci-assign: Error: Couldn't get real device (%s)!",
|
||||||
dev->dev.qdev.id);
|
dev->dev.qdev.id);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
Loading…
Reference in New Issue