From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEsNa-0003Al-8W for qemu-devel@nongnu.org; Mon, 20 Jun 2016 02:08:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bEsNY-0001ga-1A for qemu-devel@nongnu.org; Mon, 20 Jun 2016 02:08:13 -0400 Received: from [59.151.112.132] (port=65359 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEsNX-0001d3-BE for qemu-devel@nongnu.org; Mon, 20 Jun 2016 02:08:11 -0400 From: Cao jin Date: Mon, 20 Jun 2016 14:13:43 +0800 Message-ID: <1466403224-16604-13-git-send-email-caoj.fnst@cn.fujitsu.com> In-Reply-To: <1466403224-16604-1-git-send-email-caoj.fnst@cn.fujitsu.com> References: <1466403224-16604-1-git-send-email-caoj.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH v9 12/13] e1000e: remove unnecessary internal msi state flag List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Dmitry Fleytman , Jason Wang , Markus Armbruster , Marcel Apfelbaum , "Michael S. Tsirkin" 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 cc: Jason Wang cc: Markus Armbruster cc: Marcel Apfelbaum cc: Michael S. Tsirkin Signed-off-by: Cao jin --- 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) -- 2.1.0