提交 57e7c8ce 编写于 作者: A Arnd Bergmann 提交者: David S. Miller

net: vxge: avoid unused function warnings

When CONFIG_PCI_MSI is disabled, we get warnings about unused functions
in the vxge driver:

drivers/net/ethernet/neterion/vxge/vxge-main.c:2121:13: warning: 'adaptive_coalesce_tx_interrupts' defined but not used [-Wunused-function]
drivers/net/ethernet/neterion/vxge/vxge-main.c:2149:13: warning: 'adaptive_coalesce_rx_interrupts' defined but not used [-Wunused-function]

We could add another #ifdef here, but it's nicer to avoid those warnings
for good by converting the existing #ifdef to if(IS_ENABLED()), which has
the same effect but provides better compile-time coverage in general,
and lets the compiler understand better when the function is intentionally
unused.
Signed-off-by: NArnd Bergmann <arnd@arndb.de>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 1f820f53
...@@ -2223,8 +2223,6 @@ static irqreturn_t vxge_isr_napi(int irq, void *dev_id) ...@@ -2223,8 +2223,6 @@ static irqreturn_t vxge_isr_napi(int irq, void *dev_id)
return IRQ_NONE; return IRQ_NONE;
} }
#ifdef CONFIG_PCI_MSI
static irqreturn_t vxge_tx_msix_handle(int irq, void *dev_id) static irqreturn_t vxge_tx_msix_handle(int irq, void *dev_id)
{ {
struct vxge_fifo *fifo = (struct vxge_fifo *)dev_id; struct vxge_fifo *fifo = (struct vxge_fifo *)dev_id;
...@@ -2442,16 +2440,13 @@ static void vxge_rem_msix_isr(struct vxgedev *vdev) ...@@ -2442,16 +2440,13 @@ static void vxge_rem_msix_isr(struct vxgedev *vdev)
if (vdev->config.intr_type == MSI_X) if (vdev->config.intr_type == MSI_X)
pci_disable_msix(vdev->pdev); pci_disable_msix(vdev->pdev);
} }
#endif
static void vxge_rem_isr(struct vxgedev *vdev) static void vxge_rem_isr(struct vxgedev *vdev)
{ {
#ifdef CONFIG_PCI_MSI if (IS_ENABLED(CONFIG_PCI_MSI) &&
if (vdev->config.intr_type == MSI_X) { vdev->config.intr_type == MSI_X) {
vxge_rem_msix_isr(vdev); vxge_rem_msix_isr(vdev);
} else } else if (vdev->config.intr_type == INTA) {
#endif
if (vdev->config.intr_type == INTA) {
synchronize_irq(vdev->pdev->irq); synchronize_irq(vdev->pdev->irq);
free_irq(vdev->pdev->irq, vdev); free_irq(vdev->pdev->irq, vdev);
} }
...@@ -2460,11 +2455,10 @@ static void vxge_rem_isr(struct vxgedev *vdev) ...@@ -2460,11 +2455,10 @@ static void vxge_rem_isr(struct vxgedev *vdev)
static int vxge_add_isr(struct vxgedev *vdev) static int vxge_add_isr(struct vxgedev *vdev)
{ {
int ret = 0; int ret = 0;
#ifdef CONFIG_PCI_MSI
int vp_idx = 0, intr_idx = 0, intr_cnt = 0, msix_idx = 0, irq_req = 0; int vp_idx = 0, intr_idx = 0, intr_cnt = 0, msix_idx = 0, irq_req = 0;
int pci_fun = PCI_FUNC(vdev->pdev->devfn); int pci_fun = PCI_FUNC(vdev->pdev->devfn);
if (vdev->config.intr_type == MSI_X) if (IS_ENABLED(CONFIG_PCI_MSI) && vdev->config.intr_type == MSI_X)
ret = vxge_enable_msix(vdev); ret = vxge_enable_msix(vdev);
if (ret) { if (ret) {
...@@ -2475,7 +2469,7 @@ static int vxge_add_isr(struct vxgedev *vdev) ...@@ -2475,7 +2469,7 @@ static int vxge_add_isr(struct vxgedev *vdev)
vdev->config.intr_type = INTA; vdev->config.intr_type = INTA;
} }
if (vdev->config.intr_type == MSI_X) { if (IS_ENABLED(CONFIG_PCI_MSI) && vdev->config.intr_type == MSI_X) {
for (intr_idx = 0; for (intr_idx = 0;
intr_idx < (vdev->no_of_vpath * intr_idx < (vdev->no_of_vpath *
VXGE_HW_VPATH_MSIX_ACTIVE); intr_idx++) { VXGE_HW_VPATH_MSIX_ACTIVE); intr_idx++) {
...@@ -2576,9 +2570,8 @@ static int vxge_add_isr(struct vxgedev *vdev) ...@@ -2576,9 +2570,8 @@ static int vxge_add_isr(struct vxgedev *vdev)
vdev->vxge_entries[intr_cnt].in_use = 1; vdev->vxge_entries[intr_cnt].in_use = 1;
vdev->vxge_entries[intr_cnt].arg = &vdev->vpaths[0]; vdev->vxge_entries[intr_cnt].arg = &vdev->vpaths[0];
} }
INTA_MODE:
#endif
INTA_MODE:
if (vdev->config.intr_type == INTA) { if (vdev->config.intr_type == INTA) {
snprintf(vdev->desc[0], VXGE_INTR_STRLEN, snprintf(vdev->desc[0], VXGE_INTR_STRLEN,
"%s:vxge:INTA", vdev->ndev->name); "%s:vxge:INTA", vdev->ndev->name);
...@@ -3889,12 +3882,12 @@ static void vxge_device_config_init(struct vxge_hw_device_config *device_config, ...@@ -3889,12 +3882,12 @@ static void vxge_device_config_init(struct vxge_hw_device_config *device_config,
if (max_mac_vpath > VXGE_MAX_MAC_ADDR_COUNT) if (max_mac_vpath > VXGE_MAX_MAC_ADDR_COUNT)
max_mac_vpath = VXGE_MAX_MAC_ADDR_COUNT; max_mac_vpath = VXGE_MAX_MAC_ADDR_COUNT;
#ifndef CONFIG_PCI_MSI if (!IS_ENABLED(CONFIG_PCI_MSI)) {
vxge_debug_init(VXGE_ERR, vxge_debug_init(VXGE_ERR,
"%s: This Kernel does not support " "%s: This Kernel does not support "
"MSI-X. Defaulting to INTA", VXGE_DRIVER_NAME); "MSI-X. Defaulting to INTA", VXGE_DRIVER_NAME);
*intr_type = INTA; *intr_type = INTA;
#endif }
/* Configure whether MSI-X or IRQL. */ /* Configure whether MSI-X or IRQL. */
switch (*intr_type) { switch (*intr_type) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册