Skip to content

Commit 2a32ca1

Browse files
arndbdavem330
authored andcommitted
hns3: fix unused function warning
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: 46a3df9 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fde6af4 commit 2a32ca1

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,19 +2272,17 @@ static void hclge_service_task(struct work_struct *work)
22722272

22732273
static void hclge_disable_sriov(struct hclge_dev *hdev)
22742274
{
2275-
#ifdef CONFIG_PCI_IOV
2276-
/* If our VFs are assigned we cannot shut down SR-IOV
2277-
* without causing issues, so just leave the hardware
2278-
* available but disabled
2279-
*/
2280-
if (pci_vfs_assigned(hdev->pdev)) {
2281-
dev_warn(&hdev->pdev->dev,
2282-
"disabling driver while VFs are assigned\n");
2283-
return;
2284-
}
2275+
/* If our VFs are assigned we cannot shut down SR-IOV
2276+
* without causing issues, so just leave the hardware
2277+
* available but disabled
2278+
*/
2279+
if (pci_vfs_assigned(hdev->pdev)) {
2280+
dev_warn(&hdev->pdev->dev,
2281+
"disabling driver while VFs are assigned\n");
2282+
return;
2283+
}
22852284

2286-
pci_disable_sriov(hdev->pdev);
2287-
#endif
2285+
pci_disable_sriov(hdev->pdev);
22882286
}
22892287

22902288
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)
41824180

41834181
set_bit(HCLGE_STATE_DOWN, &hdev->state);
41844182

4185-
#ifdef CONFIG_PCI_IOV
4186-
hclge_disable_sriov(hdev);
4187-
#endif
4183+
if (IS_ENABLED(CONFIG_PCI_IOV))
4184+
hclge_disable_sriov(hdev);
41884185

41894186
if (hdev->service_timer.data)
41904187
del_timer_sync(&hdev->service_timer);

0 commit comments

Comments
 (0)