Skip to contentSkip to conversation

fm10k: prefer %s and __func__ for diagnostic prints

PATCH New Jacob Keller 2 participants 2 messages Aug 11, 2017 – Sep 18, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fm10k: prefer %s and __func__ for diagnostic prints

Don't hardcode the function names in the diagnostic output when these reset related routines fail. Instead, use %s and __func__ so that future refactors don't need to change the print outs.

Additionally, while we are here, add missing function header comments for the new reset_prepare and reset_done function handlers.

---
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +16 -2
index 3c79e6707cec..ba9d038f22e8 100644
@@ -2588,11 +2588,18 @@ static void fm10k_io_resume(struct pci_dev *pdev)
 
 	if (err)
 		dev_warn(&pdev->dev,
-			 "fm10k_io_resume failed: %d\n", err);
+			 "%s failed: %d\n", __func__, err);
 	else
 		netif_device_attach(netdev);
 }
 
+/**
+ * fm10k_io_reset_prepare - called when PCI function is about to be reset
+ * @pdev: Pointer to PCI device
+ *
+ * This callback is called when the PCI function is about to be reset,
+ * allowing the device driver to prepare for it.
+ */
 static void fm10k_io_reset_prepare(struct pci_dev *pdev)
 {
 	/* warn incase we have any active VF devices */
@@ -2602,6 +2609,13 @@ static void fm10k_io_reset_prepare(struct pci_dev *pdev)
 	fm10k_prepare_suspend(pci_get_drvdata(pdev));
 }
 
+/**
+ * fm10k_io_reset_done - called when PCI function has finished resetting
+ * @pdev: Pointer to PCI device
+ *
+ * This callback is called just after the PCI function is reset, such as via
+ * /sys/class/net/<enpX>/device/reset or similar.
+ */
 static void fm10k_io_reset_done(struct pci_dev *pdev)
 {
 	struct fm10k_intfc *interface = pci_get_drvdata(pdev);
@@ -2609,7 +2623,7 @@ static void fm10k_io_reset_done(struct pci_dev *pdev)
 
 	if (err) {
 		dev_warn(&pdev->dev,
-			 "fm10k_io_reset_notify failed: %d\n", err);
+			 "%s failed: %d\n", __func__, err);
 		netif_device_detach(interface->netdev);
 	}
 }
Signature · 1 line
2.14.0.rc1.251.g593d8d6362ce
#1 lore raw

PATCH 1/1 fm10k: prefer %s and __func__ for diagnostic prints

Quoted 14 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jacob Keller
Sent: Friday, August 11, 2017 11:15 AM
To: Intel Wired LAN <[email protected]>
Subject: [Intel-wired-lan] [PATCH] fm10k: prefer %s and __func__ for diagnostic prints

Don't hardcode the function names in the diagnostic output when these reset related routines fail. Instead, use %s and __func__ so that future refactors don't need to change the print outs.

Quoted 5 lines

Additionally, while we are here, add missing function header comments for the new reset_prepare and reset_done function handlers.

---