[PATCH] hns3: fix unused function warning

Subsystems: hisilicon network subsystem 3 driver (hns3), hisilicon network subsystem driver, networking drivers, the rest

STALE3361d

2 messages, 2 authors, 2017-08-07 · open the first message on its own page

[PATCH] hns3: fix unused function warning

From: Arnd Bergmann <arnd@arndb.de>
Date: 2017-08-07 10:42:49

Without CONFIG_PCI_IOV, we get a harmless warning about an
unused function:

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c:2273:13: error: 'hclge_disable_sriov' defined but not used [-Werror=unused-function]

The #ifdefs in this driver are obviously wrong, so this just
removes them and uses an IS_ENABLED() check that does the same
thing correctly in a more readable way.

Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c    | 27 ++++++++++------------
 1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 3611991689bc..7440e85b607c 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -2272,19 +2272,17 @@ static void hclge_service_task(struct work_struct *work)
 
 static void hclge_disable_sriov(struct hclge_dev *hdev)
 {
-#ifdef CONFIG_PCI_IOV
-		/* If our VFs are assigned we cannot shut down SR-IOV
-		 * without causing issues, so just leave the hardware
-		 * available but disabled
-		 */
-		if (pci_vfs_assigned(hdev->pdev)) {
-			dev_warn(&hdev->pdev->dev,
-				 "disabling driver while VFs are assigned\n");
-			return;
-		}
+	/* If our VFs are assigned we cannot shut down SR-IOV
+	 * without causing issues, so just leave the hardware
+	 * available but disabled
+	 */
+	if (pci_vfs_assigned(hdev->pdev)) {
+		dev_warn(&hdev->pdev->dev,
+			 "disabling driver while VFs are assigned\n");
+		return;
+	}
 
-		pci_disable_sriov(hdev->pdev);
-#endif
+	pci_disable_sriov(hdev->pdev);
 }
 
 struct hclge_vport *hclge_get_vport(struct hnae3_handle *handle)
@@ -4182,9 +4180,8 @@ static void hclge_uninit_ae_dev(struct hnae3_ae_dev *ae_dev)
 
 	set_bit(HCLGE_STATE_DOWN, &hdev->state);
 
-#ifdef CONFIG_PCI_IOV
-	hclge_disable_sriov(hdev);
-#endif
+	if (IS_ENABLED(CONFIG_PCI_IOV))
+		hclge_disable_sriov(hdev);
 
 	if (hdev->service_timer.data)
 		del_timer_sync(&hdev->service_timer);
-- 
2.9.0

Re: [PATCH] hns3: fix unused function warning

From: David Miller <davem@davemloft.net>
Date: 2017-08-07 18:24:03

From: Arnd Bergmann <arnd@arndb.de>
Date: Mon,  7 Aug 2017 12:41:53 +0200
Without CONFIG_PCI_IOV, we get a harmless warning about an
unused function:

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c:2273:13: error: 'hclge_disable_sriov' defined but not used [-Werror=unused-function]

The #ifdefs in this driver are obviously wrong, so this just
removes them and uses an IS_ENABLED() check that does the same
thing correctly in a more readable way.

Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help