All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] PCI/PM: Use dev_printk() when possible
@ 2019-10-17 21:28 Bjorn Helgaas
  2019-10-17 21:28 ` [PATCH 1/2] PCI/PM: Use PCI dev_printk() wrappers for consistency Bjorn Helgaas
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2019-10-17 21:28 UTC (permalink / raw)
  To: linux-pci; +Cc: Rafael J . Wysocki, linux-kernel, linux-pm, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

Some PM messages, e.g., "PCI PM: Device state not saved by %pS\n", had no
indication of what device was affected.  Add pci_WARN() and use it.

Bjorn Helgaas (2):
  PCI/PM: Use PCI dev_printk() wrappers for consistency
  PCI/PM: Use pci_WARN() to include device information

 drivers/pci/pci-driver.c | 45 ++++++++++++++++++++--------------------
 include/linux/pci.h      |  8 +++++++
 2 files changed, 31 insertions(+), 22 deletions(-)

-- 
2.23.0.866.gb869b98d4c-goog


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] PCI/PM: Use PCI dev_printk() wrappers for consistency
  2019-10-17 21:28 [PATCH 0/2] PCI/PM: Use dev_printk() when possible Bjorn Helgaas
@ 2019-10-17 21:28 ` Bjorn Helgaas
  2019-10-17 21:28 ` [PATCH 2/2] PCI/PM: Use pci_WARN() to include device information Bjorn Helgaas
  2019-10-18 10:26 ` [PATCH 0/2] PCI/PM: Use dev_printk() when possible Rafael J. Wysocki
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2019-10-17 21:28 UTC (permalink / raw)
  To: linux-pci; +Cc: Rafael J . Wysocki, linux-kernel, linux-pm, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

Use the PCI dev_printk() wrappers for consistency with the rest of the PCI
core.  No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pci-driver.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index dd70ab2519c9..407b1df5ea7c 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -315,7 +315,8 @@ static long local_pci_probe(void *_ddi)
 	 * Probe function should return < 0 for failure, 0 for success
 	 * Treat values > 0 as success, but warn.
 	 */
-	dev_warn(dev, "Driver probe function unexpectedly returned %d\n", rc);
+	pci_warn(pci_dev, "Driver probe function unexpectedly returned %d\n",
+		 rc);
 	return 0;
 }
 
@@ -865,7 +866,7 @@ static int pci_pm_suspend_noirq(struct device *dev)
 			pci_prepare_to_sleep(pci_dev);
 	}
 
-	dev_dbg(dev, "PCI PM: Suspend power state: %s\n",
+	pci_dbg(pci_dev, "PCI PM: Suspend power state: %s\n",
 		pci_power_name(pci_dev->current_state));
 
 	if (pci_dev->current_state == PCI_D0) {
@@ -880,7 +881,7 @@ static int pci_pm_suspend_noirq(struct device *dev)
 	}
 
 	if (pci_dev->skip_bus_pm && pm_suspend_no_platform()) {
-		dev_dbg(dev, "PCI PM: Skipped\n");
+		pci_dbg(pci_dev, "PCI PM: Skipped\n");
 		goto Fixup;
 	}
 
@@ -1295,11 +1296,11 @@ static int pci_pm_runtime_suspend(struct device *dev)
 		 * log level.
 		 */
 		if (error == -EBUSY || error == -EAGAIN) {
-			dev_dbg(dev, "can't suspend now (%ps returned %d)\n",
+			pci_dbg(pci_dev, "can't suspend now (%ps returned %d)\n",
 				pm->runtime_suspend, error);
 			return error;
 		} else if (error) {
-			dev_err(dev, "can't suspend (%ps returned %d)\n",
+			pci_err(pci_dev, "can't suspend (%ps returned %d)\n",
 				pm->runtime_suspend, error);
 			return error;
 		}
-- 
2.23.0.866.gb869b98d4c-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] PCI/PM: Use pci_WARN() to include device information
  2019-10-17 21:28 [PATCH 0/2] PCI/PM: Use dev_printk() when possible Bjorn Helgaas
  2019-10-17 21:28 ` [PATCH 1/2] PCI/PM: Use PCI dev_printk() wrappers for consistency Bjorn Helgaas
@ 2019-10-17 21:28 ` Bjorn Helgaas
  2019-10-18 10:26 ` [PATCH 0/2] PCI/PM: Use dev_printk() when possible Rafael J. Wysocki
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2019-10-17 21:28 UTC (permalink / raw)
  To: linux-pci; +Cc: Rafael J . Wysocki, linux-kernel, linux-pm, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

Add and use pci_WARN() wrappers so warnings include device information.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pci-driver.c | 34 +++++++++++++++++-----------------
 include/linux/pci.h      |  8 ++++++++
 2 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 407b1df5ea7c..5337cbbd69de 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -585,9 +585,9 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state)
 
 		if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0
 		    && pci_dev->current_state != PCI_UNKNOWN) {
-			WARN_ONCE(pci_dev->current_state != prev,
-				"PCI PM: Device state not saved by %pS\n",
-				drv->suspend);
+			pci_WARN_ONCE(pci_dev, pci_dev->current_state != prev,
+				      "PCI PM: Device state not saved by %pS\n",
+				      drv->suspend);
 		}
 	}
 
@@ -612,9 +612,9 @@ static int pci_legacy_suspend_late(struct device *dev, pm_message_t state)
 
 		if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0
 		    && pci_dev->current_state != PCI_UNKNOWN) {
-			WARN_ONCE(pci_dev->current_state != prev,
-				"PCI PM: Device state not saved by %pS\n",
-				drv->suspend_late);
+			pci_WARN_ONCE(pci_dev, pci_dev->current_state != prev,
+				      "PCI PM: Device state not saved by %pS\n",
+				      drv->suspend_late);
 			goto Fixup;
 		}
 	}
@@ -670,8 +670,8 @@ static bool pci_has_legacy_pm_support(struct pci_dev *pci_dev)
 	 * supported as well.  Drivers are supposed to support either the
 	 * former, or the latter, but not both at the same time.
 	 */
-	WARN(ret && drv->driver.pm, "driver %s device %04x:%04x\n",
-		drv->name, pci_dev->vendor, pci_dev->device);
+	pci_WARN(pci_dev, ret && drv->driver.pm, "device %04x:%04x\n",
+		 pci_dev->vendor, pci_dev->device);
 
 	return ret;
 }
@@ -794,9 +794,9 @@ static int pci_pm_suspend(struct device *dev)
 
 		if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0
 		    && pci_dev->current_state != PCI_UNKNOWN) {
-			WARN_ONCE(pci_dev->current_state != prev,
-				"PCI PM: State of device not saved by %pS\n",
-				pm->suspend);
+			pci_WARN_ONCE(pci_dev, pci_dev->current_state != prev,
+				      "PCI PM: State of device not saved by %pS\n",
+				      pm->suspend);
 		}
 	}
 
@@ -842,9 +842,9 @@ static int pci_pm_suspend_noirq(struct device *dev)
 
 		if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0
 		    && pci_dev->current_state != PCI_UNKNOWN) {
-			WARN_ONCE(pci_dev->current_state != prev,
-				"PCI PM: State of device not saved by %pS\n",
-				pm->suspend_noirq);
+			pci_WARN_ONCE(pci_dev, pci_dev->current_state != prev,
+				      "PCI PM: State of device not saved by %pS\n",
+				      pm->suspend_noirq);
 			goto Fixup;
 		}
 	}
@@ -1311,9 +1311,9 @@ static int pci_pm_runtime_suspend(struct device *dev)
 	if (pm && pm->runtime_suspend
 	    && !pci_dev->state_saved && pci_dev->current_state != PCI_D0
 	    && pci_dev->current_state != PCI_UNKNOWN) {
-		WARN_ONCE(pci_dev->current_state != prev,
-			"PCI PM: State of device not saved by %pS\n",
-			pm->runtime_suspend);
+		pci_WARN_ONCE(pci_dev, pci_dev->current_state != prev,
+			      "PCI PM: State of device not saved by %pS\n",
+			      pm->runtime_suspend);
 		return 0;
 	}
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index f9088c89a534..4846306d521c 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2400,4 +2400,12 @@ void pci_uevent_ers(struct pci_dev *pdev, enum  pci_ers_result err_type);
 #define pci_info_ratelimited(pdev, fmt, arg...) \
 	dev_info_ratelimited(&(pdev)->dev, fmt, ##arg)
 
+#define pci_WARN(pdev, condition, fmt, arg...) \
+	WARN(condition, "%s %s: " fmt, \
+	     dev_driver_string(&(pdev)->dev), pci_name(pdev), ##arg)
+
+#define pci_WARN_ONCE(pdev, condition, fmt, arg...) \
+	WARN_ONCE(condition, "%s %s: " fmt, \
+		  dev_driver_string(&(pdev)->dev), pci_name(pdev), ##arg)
+
 #endif /* LINUX_PCI_H */
-- 
2.23.0.866.gb869b98d4c-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] PCI/PM: Use dev_printk() when possible
  2019-10-17 21:28 [PATCH 0/2] PCI/PM: Use dev_printk() when possible Bjorn Helgaas
  2019-10-17 21:28 ` [PATCH 1/2] PCI/PM: Use PCI dev_printk() wrappers for consistency Bjorn Helgaas
  2019-10-17 21:28 ` [PATCH 2/2] PCI/PM: Use pci_WARN() to include device information Bjorn Helgaas
@ 2019-10-18 10:26 ` Rafael J. Wysocki
  2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2019-10-18 10:26 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-pci, Rafael J . Wysocki, linux-kernel, linux-pm, Bjorn Helgaas

On Thursday, October 17, 2019 11:28:49 PM CEST Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> Some PM messages, e.g., "PCI PM: Device state not saved by %pS\n", had no
> indication of what device was affected.  Add pci_WARN() and use it.
> 
> Bjorn Helgaas (2):
>   PCI/PM: Use PCI dev_printk() wrappers for consistency
>   PCI/PM: Use pci_WARN() to include device information
> 
>  drivers/pci/pci-driver.c | 45 ++++++++++++++++++++--------------------
>  include/linux/pci.h      |  8 +++++++
>  2 files changed, 31 insertions(+), 22 deletions(-)
> 
> 

Good cleanups!

For both

Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-18 10:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-17 21:28 [PATCH 0/2] PCI/PM: Use dev_printk() when possible Bjorn Helgaas
2019-10-17 21:28 ` [PATCH 1/2] PCI/PM: Use PCI dev_printk() wrappers for consistency Bjorn Helgaas
2019-10-17 21:28 ` [PATCH 2/2] PCI/PM: Use pci_WARN() to include device information Bjorn Helgaas
2019-10-18 10:26 ` [PATCH 0/2] PCI/PM: Use dev_printk() when possible Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.