提交 74de5504 编写于 作者: S Shmulik Ladkani 提交者: Michael S. Tsirkin

pci: Don't register a specialized 'config_write' if default behavior is intended

Few devices have their specialized 'config_write' methods which simply
call 'pci_default_write_config' followed by a 'msix_write_config' or
'msi_write_config' calls, using exact same arguments.

This is unnecessary as 'pci_default_write_config' already invokes
'msi_write_config' and 'msix_write_config'.

Also, since 'pci_default_write_config' is the default 'config_write'
handler, we can simply avoid the registration of these specialized
versions.

Cc: Leonid Shatz <leonid.shatz@ravellosystems.com>
Signed-off-by: NShmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
上级 5ba03e2d
...@@ -698,7 +698,6 @@ static void ivshmem_write_config(PCIDevice *pci_dev, uint32_t address, ...@@ -698,7 +698,6 @@ static void ivshmem_write_config(PCIDevice *pci_dev, uint32_t address,
uint32_t val, int len) uint32_t val, int len)
{ {
pci_default_write_config(pci_dev, address, val, len); pci_default_write_config(pci_dev, address, val, len);
msix_write_config(pci_dev, address, val, len);
} }
static int pci_ivshmem_init(PCIDevice *dev) static int pci_ivshmem_init(PCIDevice *dev)
......
...@@ -2481,14 +2481,6 @@ static const VMStateDescription vmstate_vmxnet3 = { ...@@ -2481,14 +2481,6 @@ static const VMStateDescription vmstate_vmxnet3 = {
} }
}; };
static void
vmxnet3_write_config(PCIDevice *pci_dev, uint32_t addr, uint32_t val, int len)
{
pci_default_write_config(pci_dev, addr, val, len);
msix_write_config(pci_dev, addr, val, len);
msi_write_config(pci_dev, addr, val, len);
}
static Property vmxnet3_properties[] = { static Property vmxnet3_properties[] = {
DEFINE_NIC_PROPERTIES(VMXNET3State, conf), DEFINE_NIC_PROPERTIES(VMXNET3State, conf),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
...@@ -2507,7 +2499,6 @@ static void vmxnet3_class_init(ObjectClass *class, void *data) ...@@ -2507,7 +2499,6 @@ static void vmxnet3_class_init(ObjectClass *class, void *data)
c->class_id = PCI_CLASS_NETWORK_ETHERNET; c->class_id = PCI_CLASS_NETWORK_ETHERNET;
c->subsystem_vendor_id = PCI_VENDOR_ID_VMWARE; c->subsystem_vendor_id = PCI_VENDOR_ID_VMWARE;
c->subsystem_id = PCI_DEVICE_ID_VMWARE_VMXNET3; c->subsystem_id = PCI_DEVICE_ID_VMWARE_VMXNET3;
c->config_write = vmxnet3_write_config,
dc->desc = "VMWare Paravirtualized Ethernet v3"; dc->desc = "VMWare Paravirtualized Ethernet v3";
dc->reset = vmxnet3_qdev_reset; dc->reset = vmxnet3_qdev_reset;
dc->vmsd = &vmstate_vmxnet3; dc->vmsd = &vmstate_vmxnet3;
......
...@@ -2407,13 +2407,6 @@ static void megasas_scsi_realize(PCIDevice *dev, Error **errp) ...@@ -2407,13 +2407,6 @@ static void megasas_scsi_realize(PCIDevice *dev, Error **errp)
} }
} }
static void
megasas_write_config(PCIDevice *pci, uint32_t addr, uint32_t val, int len)
{
pci_default_write_config(pci, addr, val, len);
msi_write_config(pci, addr, val, len);
}
static Property megasas_properties_gen1[] = { static Property megasas_properties_gen1[] = {
DEFINE_PROP_UINT32("max_sge", MegasasState, fw_sge, DEFINE_PROP_UINT32("max_sge", MegasasState, fw_sge,
MEGASAS_DEFAULT_SGE), MEGASAS_DEFAULT_SGE),
...@@ -2516,7 +2509,6 @@ static void megasas_class_init(ObjectClass *oc, void *data) ...@@ -2516,7 +2509,6 @@ static void megasas_class_init(ObjectClass *oc, void *data)
dc->vmsd = info->vmsd; dc->vmsd = info->vmsd;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
dc->desc = info->desc; dc->desc = info->desc;
pc->config_write = megasas_write_config;
} }
static const TypeInfo megasas_info = { static const TypeInfo megasas_info = {
......
...@@ -1174,13 +1174,6 @@ static const VMStateDescription vmstate_pvscsi = { ...@@ -1174,13 +1174,6 @@ static const VMStateDescription vmstate_pvscsi = {
} }
}; };
static void
pvscsi_write_config(PCIDevice *pci, uint32_t addr, uint32_t val, int len)
{
pci_default_write_config(pci, addr, val, len);
msi_write_config(pci, addr, val, len);
}
static Property pvscsi_properties[] = { static Property pvscsi_properties[] = {
DEFINE_PROP_UINT8("use_msg", PVSCSIState, use_msg, 1), DEFINE_PROP_UINT8("use_msg", PVSCSIState, use_msg, 1),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
...@@ -1202,7 +1195,6 @@ static void pvscsi_class_init(ObjectClass *klass, void *data) ...@@ -1202,7 +1195,6 @@ static void pvscsi_class_init(ObjectClass *klass, void *data)
dc->vmsd = &vmstate_pvscsi; dc->vmsd = &vmstate_pvscsi;
dc->props = pvscsi_properties; dc->props = pvscsi_properties;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
k->config_write = pvscsi_write_config;
hc->unplug = pvscsi_hot_unplug; hc->unplug = pvscsi_hot_unplug;
hc->plug = pvscsi_hotplug; hc->plug = pvscsi_hotplug;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册