diff mbox series

PM: Use dev_printk() when possible

Message ID 20210126212940.2922275-1-helgaas@kernel.org (mailing list archive)
State Mainlined, archived
Headers show
Series PM: Use dev_printk() when possible | expand

Commit Message

Bjorn Helgaas Jan. 26, 2021, 9:29 p.m. UTC
From: Bjorn Helgaas <bhelgaas@google.com>

Use dev_printk() when possible to make messages more consistent with other
device-related messages.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/base/power/main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Rafael J. Wysocki Jan. 27, 2021, 6:22 p.m. UTC | #1
On Wed, Jan 27, 2021 at 8:23 AM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> Use dev_printk() when possible to make messages more consistent with other
> device-related messages.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  drivers/base/power/main.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> index 46793276598d..f893c3c5af07 100644
> --- a/drivers/base/power/main.c
> +++ b/drivers/base/power/main.c
> @@ -16,6 +16,7 @@
>   */
>
>  #define pr_fmt(fmt) "PM: " fmt
> +#define dev_fmt pr_fmt
>
>  #include <linux/device.h>
>  #include <linux/export.h>
> @@ -449,8 +450,8 @@ static void pm_dev_dbg(struct device *dev, pm_message_t state, const char *info)
>  static void pm_dev_err(struct device *dev, pm_message_t state, const char *info,
>                         int error)
>  {
> -       pr_err("Device %s failed to %s%s: error %d\n",
> -              dev_name(dev), pm_verb(state.event), info, error);
> +       dev_err(dev, "failed to %s%s: error %d\n", pm_verb(state.event), info,
> +               error);
>  }
>
>  static void dpm_show_time(ktime_t starttime, pm_message_t state, int error,
> @@ -1897,8 +1898,8 @@ int dpm_prepare(pm_message_t state)
>                                 error = 0;
>                                 continue;
>                         }
> -                       pr_info("Device %s not prepared for power transition: code %d\n",
> -                               dev_name(dev), error);
> +                       dev_info(dev, "not prepared for power transition: code %d\n",
> +                                error);
>                         put_device(dev);
>                         break;
>                 }
> --

Applied as 5.12 material, thanks!
diff mbox series

Patch

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 46793276598d..f893c3c5af07 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -16,6 +16,7 @@ 
  */
 
 #define pr_fmt(fmt) "PM: " fmt
+#define dev_fmt pr_fmt
 
 #include <linux/device.h>
 #include <linux/export.h>
@@ -449,8 +450,8 @@  static void pm_dev_dbg(struct device *dev, pm_message_t state, const char *info)
 static void pm_dev_err(struct device *dev, pm_message_t state, const char *info,
 			int error)
 {
-	pr_err("Device %s failed to %s%s: error %d\n",
-	       dev_name(dev), pm_verb(state.event), info, error);
+	dev_err(dev, "failed to %s%s: error %d\n", pm_verb(state.event), info,
+		error);
 }
 
 static void dpm_show_time(ktime_t starttime, pm_message_t state, int error,
@@ -1897,8 +1898,8 @@  int dpm_prepare(pm_message_t state)
 				error = 0;
 				continue;
 			}
-			pr_info("Device %s not prepared for power transition: code %d\n",
-				dev_name(dev), error);
+			dev_info(dev, "not prepared for power transition: code %d\n",
+				 error);
 			put_device(dev);
 			break;
 		}