All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Cao jin <caoj.fnst@cn.fujitsu.com>,
	Dmitry Fleytman <dmitry@daynix.com>,
	Jason Wang <jasowang@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Marcel Apfelbaum <marcel@redhat.com>
Subject: [Qemu-devel] [PULL v2 29/30] e1000e: remove unnecessary internal msi state flag
Date: Tue, 5 Jul 2016 18:47:47 +0300	[thread overview]
Message-ID: <20160705184747-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <1467733400-17206-1-git-send-email-mst@redhat.com>

From: Cao jin <caoj.fnst@cn.fujitsu.com>

Internal big flag E1000E_USE_MSI is unnecessary, also is the helper
function: e1000e_init_msi(), e1000e_cleanup_msi(), so, remove them all.

cc: Dmitry Fleytman <dmitry@daynix.com>
cc: Jason Wang <jasowang@redhat.com>
cc: Markus Armbruster <armbru@redhat.com>
cc: Marcel Apfelbaum <marcel@redhat.com>
cc: Michael S. Tsirkin <mst@redhat.com>

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
 hw/net/e1000e.c | 33 +++++++--------------------------
 1 file changed, 7 insertions(+), 26 deletions(-)

diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
index a06d184..c7d33ee 100644
--- a/hw/net/e1000e.c
+++ b/hw/net/e1000e.c
@@ -89,8 +89,7 @@ typedef struct E1000EState {
 #define E1000E_MSIX_TABLE   (0x0000)
 #define E1000E_MSIX_PBA     (0x2000)
 
-#define E1000E_USE_MSI     BIT(0)
-#define E1000E_USE_MSIX    BIT(1)
+#define E1000E_USE_MSIX    BIT(0)
 
 static uint64_t
 e1000e_mmio_read(void *opaque, hwaddr addr, unsigned size)
@@ -264,28 +263,6 @@ static void e1000e_core_realize(E1000EState *s)
 }
 
 static void
-e1000e_init_msi(E1000EState *s)
-{
-    int res;
-
-    res = msi_init(PCI_DEVICE(s), 0xD0, 1, true, false, NULL);
-
-    if (!res) {
-        s->intr_state |= E1000E_USE_MSI;
-    } else {
-        trace_e1000e_msi_init_fail(res);
-    }
-}
-
-static void
-e1000e_cleanup_msi(E1000EState *s)
-{
-    if (s->intr_state & E1000E_USE_MSI) {
-        msi_uninit(PCI_DEVICE(s));
-    }
-}
-
-static void
 e1000e_unuse_msix_vectors(E1000EState *s, int num_vectors)
 {
     int i;
@@ -440,6 +417,7 @@ static void e1000e_pci_realize(PCIDevice *pci_dev, Error **errp)
     static const uint16_t e1000e_dsn_offset =  0x140;
     E1000EState *s = E1000E(pci_dev);
     uint8_t *macaddr;
+    int ret;
 
     trace_e1000e_cb_pci_realize();
 
@@ -489,7 +467,10 @@ static void e1000e_pci_realize(PCIDevice *pci_dev, Error **errp)
         hw_error("Failed to initialize PCIe capability");
     }
 
-    e1000e_init_msi(s);
+    ret = msi_init(PCI_DEVICE(s), 0xD0, 1, true, false, NULL);
+    if (ret) {
+        trace_e1000e_msi_init_fail(ret);
+    }
 
     if (e1000e_add_pm_capability(pci_dev, e1000e_pmrb_offset,
                                   PCI_PM_CAP_DSI) < 0) {
@@ -528,7 +509,7 @@ static void e1000e_pci_uninit(PCIDevice *pci_dev)
     qemu_del_nic(s->nic);
 
     e1000e_cleanup_msix(s);
-    e1000e_cleanup_msi(s);
+    msi_uninit(pci_dev);
 }
 
 static void e1000e_qdev_reset(DeviceState *dev)
-- 
MST

  parent reply	other threads:[~2016-07-05 15:47 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1467733400-17206-1-git-send-email-mst@redhat.com>
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 01/30] xen: fix ram init regression Michael S. Tsirkin
2016-07-05 15:46   ` Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 02/30] hw/ppc: realize the PCI root bus as part of mac99 init Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 03/30] hw/pci: delay bus_master_enable_region initialization Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 04/30] q35: allow dynamic sysbus Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 05/30] hw/iommu: enable iommu with -device Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 06/30] machine: remove iommu property Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 07/30] piix: Set I440FXState member pci_info.w32 in one place Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 08/30] pc: Eliminate PcPciInfo Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 09/30] virtio: revert host notifiers to old semantics Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 10/30] virtio: set low features early on load Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 11/30] Revert "virtio-net: unbreak self announcement and guest offloads after migration" Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 12/30] pci_register_bar: cleanup Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 13/30] log: Clean up misuse of Range for -dfilter Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 14/30] range: Eliminate direct Range member access Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 15/30] range: Replace internal representation of Range Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 16/30] log: Permit -dfilter 0..0xffffffffffffffff Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 17/30] tests: acpi: add CPU hotplug testcase Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 18/30] tests: add APIC.cphp and DSDT.cphp blobs Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 19/30] change pvscsi_init_msi() type to void Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 20/30] usb xhci: change msi/msix property type Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 21/30] intel-hda: change msi " Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 22/30] mptsas: " Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 23/30] megasas: change msi/msix " Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 24/30] pci bridge dev: change msi " Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 25/30] pci: Convert msi_init() to Error and fix callers to check it Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 26/30] megasas: remove unnecessary megasas_use_msi() Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 27/30] mptsas: remove unnecessary internal msi state flag Michael S. Tsirkin
2016-07-26  5:01   ` Amit Shah
2016-07-26  7:29     ` Cao jin
2016-07-26 11:18       ` Amit Shah
2016-07-26 13:10         ` Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 28/30] vmxnet3: " Michael S. Tsirkin
2016-07-05 15:47 ` Michael S. Tsirkin [this message]
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 30/30] vmw_pvscsi: " Michael S. Tsirkin

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=20160705184747-mutt-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=armbru@redhat.com \
    --cc=caoj.fnst@cn.fujitsu.com \
    --cc=dmitry@daynix.com \
    --cc=jasowang@redhat.com \
    --cc=marcel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.