From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Mao Zhongyi <maozy.fnst@cn.fujitsu.com>,
pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com,
mst@redhat.com, dmitry@daynix.com, jasowang@redhat.com,
marcel@redhat.com, alex.williamson@redhat.com, armbru@redhat.com,
John Snow <jsnow@redhat.com>,
qemu-block@nongnu.org
Subject: [Qemu-devel] [PULL 08/21] pci: Replace pci_add_capability2() with pci_add_capability()
Date: Mon, 3 Jul 2017 22:45:05 +0300 [thread overview]
Message-ID: <1499111049-13721-9-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1499111049-13721-1-git-send-email-mst@redhat.com>
From: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
After the patch 'Make errp the last parameter of pci_add_capability()',
pci_add_capability() and pci_add_capability2() now do exactly the same.
So drop the wrapper pci_add_capability() of pci_add_capability2(), then
replace the pci_add_capability2() with pci_add_capability() everywhere.
Cc: pbonzini@redhat.com
Cc: rth@twiddle.net
Cc: ehabkost@redhat.com
Cc: mst@redhat.com
Cc: dmitry@daynix.com
Cc: jasowang@redhat.com
Cc: marcel@redhat.com
Cc: alex.williamson@redhat.com
Cc: armbru@redhat.com
Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/pci/pci.h | 3 ---
hw/i386/kvm/pci-assign.c | 14 +++++++-------
hw/ide/ich.c | 2 +-
hw/pci/msi.c | 2 +-
hw/pci/msix.c | 2 +-
hw/pci/pci.c | 20 ++------------------
hw/vfio/pci.c | 6 +++---
7 files changed, 15 insertions(+), 34 deletions(-)
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index fe52aa8..e598b09 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -358,9 +358,6 @@ pcibus_t pci_get_bar_addr(PCIDevice *pci_dev, int region_num);
int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,
uint8_t offset, uint8_t size,
Error **errp);
-int pci_add_capability2(PCIDevice *pdev, uint8_t cap_id,
- uint8_t offset, uint8_t size,
- Error **errp);
void pci_del_capability(PCIDevice *pci_dev, uint8_t cap_id, uint8_t cap_size);
diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index 87dcbdd..3d60455 100644
--- a/hw/i386/kvm/pci-assign.c
+++ b/hw/i386/kvm/pci-assign.c
@@ -1254,7 +1254,7 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp)
dev->dev.cap_present |= QEMU_PCI_CAP_MSI;
dev->cap.available |= ASSIGNED_DEVICE_CAP_MSI;
/* Only 32-bit/no-mask currently supported */
- ret = pci_add_capability2(pci_dev, PCI_CAP_ID_MSI, pos, 10,
+ ret = pci_add_capability(pci_dev, PCI_CAP_ID_MSI, pos, 10,
&local_err);
if (ret < 0) {
error_propagate(errp, local_err);
@@ -1288,7 +1288,7 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp)
}
dev->dev.cap_present |= QEMU_PCI_CAP_MSIX;
dev->cap.available |= ASSIGNED_DEVICE_CAP_MSIX;
- ret = pci_add_capability2(pci_dev, PCI_CAP_ID_MSIX, pos, 12,
+ ret = pci_add_capability(pci_dev, PCI_CAP_ID_MSIX, pos, 12,
&local_err);
if (ret < 0) {
error_propagate(errp, local_err);
@@ -1318,7 +1318,7 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp)
if (pos) {
uint16_t pmc;
- ret = pci_add_capability2(pci_dev, PCI_CAP_ID_PM, pos, PCI_PM_SIZEOF,
+ ret = pci_add_capability(pci_dev, PCI_CAP_ID_PM, pos, PCI_PM_SIZEOF,
&local_err);
if (ret < 0) {
error_propagate(errp, local_err);
@@ -1386,7 +1386,7 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp)
return -EINVAL;
}
- ret = pci_add_capability2(pci_dev, PCI_CAP_ID_EXP, pos, size,
+ ret = pci_add_capability(pci_dev, PCI_CAP_ID_EXP, pos, size,
&local_err);
if (ret < 0) {
error_propagate(errp, local_err);
@@ -1462,7 +1462,7 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp)
uint32_t status;
/* Only expose the minimum, 8 byte capability */
- ret = pci_add_capability2(pci_dev, PCI_CAP_ID_PCIX, pos, 8,
+ ret = pci_add_capability(pci_dev, PCI_CAP_ID_PCIX, pos, 8,
&local_err);
if (ret < 0) {
error_propagate(errp, local_err);
@@ -1490,7 +1490,7 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp)
pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_VPD, 0);
if (pos) {
/* Direct R/W passthrough */
- ret = pci_add_capability2(pci_dev, PCI_CAP_ID_VPD, pos, 8,
+ ret = pci_add_capability(pci_dev, PCI_CAP_ID_VPD, pos, 8,
&local_err);
if (ret < 0) {
error_propagate(errp, local_err);
@@ -1508,7 +1508,7 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp)
pos += PCI_CAP_LIST_NEXT) {
uint8_t len = pci_get_byte(pci_dev->config + pos + PCI_CAP_FLAGS);
/* Direct R/W passthrough */
- ret = pci_add_capability2(pci_dev, PCI_CAP_ID_VNDR, pos, len,
+ ret = pci_add_capability(pci_dev, PCI_CAP_ID_VNDR, pos, len,
&local_err);
if (ret < 0) {
error_propagate(errp, local_err);
diff --git a/hw/ide/ich.c b/hw/ide/ich.c
index 4599169..989fca5 100644
--- a/hw/ide/ich.c
+++ b/hw/ide/ich.c
@@ -130,7 +130,7 @@ static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp)
pci_register_bar(dev, ICH9_MEM_BAR, PCI_BASE_ADDRESS_SPACE_MEMORY,
&d->ahci.mem);
- sata_cap_offset = pci_add_capability2(dev, PCI_CAP_ID_SATA,
+ sata_cap_offset = pci_add_capability(dev, PCI_CAP_ID_SATA,
ICH9_SATA_CAP_OFFSET, SATA_CAP_SIZE,
errp);
if (sata_cap_offset < 0) {
diff --git a/hw/pci/msi.c b/hw/pci/msi.c
index a87b227..5e05ce5 100644
--- a/hw/pci/msi.c
+++ b/hw/pci/msi.c
@@ -216,7 +216,7 @@ int msi_init(struct PCIDevice *dev, uint8_t offset,
}
cap_size = msi_cap_sizeof(flags);
- config_offset = pci_add_capability2(dev, PCI_CAP_ID_MSI, offset,
+ config_offset = pci_add_capability(dev, PCI_CAP_ID_MSI, offset,
cap_size, errp);
if (config_offset < 0) {
return config_offset;
diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index fc5fe51..5078d3d 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -301,7 +301,7 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries,
return -EINVAL;
}
- cap = pci_add_capability2(dev, PCI_CAP_ID_MSIX,
+ cap = pci_add_capability(dev, PCI_CAP_ID_MSIX,
cap_pos, MSIX_CAP_LENGTH, errp);
if (cap < 0) {
return cap;
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 3ad6f4e..0c6f74a 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2259,28 +2259,12 @@ static void pci_del_option_rom(PCIDevice *pdev)
}
/*
- * if offset = 0,
- * Find and reserve space and add capability to the linked list
- * in pci config space
- */
-int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,
- uint8_t offset, uint8_t size,
- Error **errp)
-{
- int ret;
-
- ret = pci_add_capability2(pdev, cap_id, offset, size, errp);
-
- return ret;
-}
-
-/*
- * On success, pci_add_capability2() returns a positive value
+ * On success, pci_add_capability() returns a positive value
* that the offset of the pci capability.
* On failure, it sets an error and returns a negative error
* code.
*/
-int pci_add_capability2(PCIDevice *pdev, uint8_t cap_id,
+int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,
uint8_t offset, uint8_t size,
Error **errp)
{
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 70bfb59..8de8272 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -1837,14 +1837,14 @@ static int vfio_add_std_cap(VFIOPCIDevice *vdev, uint8_t pos, Error **errp)
case PCI_CAP_ID_PM:
vfio_check_pm_reset(vdev, pos);
vdev->pm_cap = pos;
- ret = pci_add_capability2(pdev, cap_id, pos, size, errp);
+ ret = pci_add_capability(pdev, cap_id, pos, size, errp);
break;
case PCI_CAP_ID_AF:
vfio_check_af_flr(vdev, pos);
- ret = pci_add_capability2(pdev, cap_id, pos, size, errp);
+ ret = pci_add_capability(pdev, cap_id, pos, size, errp);
break;
default:
- ret = pci_add_capability2(pdev, cap_id, pos, size, errp);
+ ret = pci_add_capability(pdev, cap_id, pos, size, errp);
break;
}
out:
--
MST
next prev parent reply other threads:[~2017-07-03 19:45 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-03 19:44 [Qemu-devel] [PULL 00/21] pc, acpi, pci, virtio: fixes, cleanups, features, tests Michael S. Tsirkin
2017-07-03 19:44 ` [Qemu-devel] [PULL 01/21] virtio-net: enable configurable tx queue size Michael S. Tsirkin
2017-07-04 1:44 ` Wei Wang
2017-07-13 8:01 ` Michal Privoznik
2017-07-03 19:44 ` [Qemu-devel] [PULL 02/21] hw/pci-bridge/dec: Classify the DEC PCI bridge as bridge device Michael S. Tsirkin
2017-07-03 19:44 ` [Qemu-devel] [PULL 03/21] intel_iommu: relax iq tail check on VTD_GCMD_QIE enable Michael S. Tsirkin
2017-07-03 19:44 ` [Qemu-devel] [PULL 04/21] pci: Clean up error checking in pci_add_capability() Michael S. Tsirkin
2017-07-03 19:44 ` [Qemu-devel] [PULL 05/21] pci: Add comment for pci_add_capability2() Michael S. Tsirkin
2017-07-03 19:44 ` [Qemu-devel] [PULL 06/21] pci: Fix the wrong assertion Michael S. Tsirkin
2017-07-03 19:44 ` [Qemu-devel] [PULL 07/21] pci: Make errp the last parameter of pci_add_capability() Michael S. Tsirkin
2017-07-03 19:45 ` Michael S. Tsirkin [this message]
2017-07-03 19:45 ` [Qemu-devel] [PULL 09/21] pci: Convert to realize Michael S. Tsirkin
2017-08-25 15:17 ` Eduardo Habkost
2017-08-25 16:57 ` Michael S. Tsirkin
2017-08-25 17:49 ` Eduardo Habkost
2017-07-03 19:45 ` [Qemu-devel] [PULL 10/21] pci: Convert shpc_init() to Error Michael S. Tsirkin
2017-07-03 19:45 ` [Qemu-devel] [PULL 11/21] i386/kvm/pci-assign: Fix return type of verify_irqchip_kernel() Michael S. Tsirkin
2017-07-03 19:45 ` [Qemu-devel] [PULL 12/21] i386/kvm/pci-assign: Use errp directly rather than local_err Michael S. Tsirkin
2017-07-03 19:45 ` [Qemu-devel] [PULL 13/21] fw_cfg: don't map the fw_cfg IO ports in fw_cfg_io_realize() Michael S. Tsirkin
2017-07-03 19:45 ` [Qemu-devel] [PULL 14/21] fw_cfg: move setting of FW_CFG_VERSION_DMA bit to fw_cfg_init1() Michael S. Tsirkin
2017-07-03 19:45 ` [Qemu-devel] [PULL 15/21] hw/acpi: remove dead acpi code Michael S. Tsirkin
2017-07-03 19:45 ` [Qemu-devel] [PULL 16/21] intel_iommu: fix migration breakage on mr switch Michael S. Tsirkin
2017-07-03 19:45 ` [Qemu-devel] [PULL 17/21] vhost: ensure vhost_ops are set before calling iotlb callback Michael S. Tsirkin
2017-07-03 19:45 ` [Qemu-devel] [PULL 18/21] vhost-user: unregister slave req handler at cleanup time Michael S. Tsirkin
2017-07-03 19:45 ` [Qemu-devel] [PULL 19/21] tests: Add unit tests for the VM Generation ID feature Michael S. Tsirkin
2017-07-11 13:32 ` Peter Maydell
2017-07-11 15:07 ` Ben Warren
2017-07-11 15:22 ` Peter Maydell
2017-07-11 16:49 ` Peter Maydell
2017-07-11 19:10 ` Michael S. Tsirkin
2017-07-11 20:42 ` Peter Maydell
2017-07-11 22:13 ` Laszlo Ersek
2017-07-11 23:43 ` Ben Warren
2017-07-12 0:42 ` Michael S. Tsirkin
2017-07-13 10:47 ` Peter Maydell
2017-07-13 11:31 ` Laszlo Ersek
2017-07-13 11:51 ` Marc-André Lureau
2017-07-13 13:34 ` Ben Warren
2017-07-13 16:38 ` Michael S. Tsirkin
2017-07-14 13:11 ` Peter Maydell
2017-07-14 15:14 ` Michael S. Tsirkin
2017-07-03 19:45 ` [Qemu-devel] [PULL 20/21] virtio-net: fix tx queue size for !vhost-user Michael S. Tsirkin
2017-07-03 19:45 ` [Qemu-devel] [PULL 21/21] i386/acpi: update expected acpi files Michael S. Tsirkin
2017-07-04 12:05 ` [Qemu-devel] [PULL 00/21] pc, acpi, pci, virtio: fixes, cleanups, features, tests Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1499111049-13721-9-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=armbru@redhat.com \
--cc=dmitry@daynix.com \
--cc=ehabkost@redhat.com \
--cc=jasowang@redhat.com \
--cc=jsnow@redhat.com \
--cc=maozy.fnst@cn.fujitsu.com \
--cc=marcel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).