Re: [PATCH] PM: Add device name to suspend_report_result()

From: Bjorn Helgaas
Date: Thu Mar 03 2022 - 12:57:47 EST


On Thu, Mar 03, 2022 at 07:56:37AM +0900, 장영진/TV S/W Lab(VD)/Staff Engineer/삼성전자 wrote:
> > -----Original Message-----
> > From: Bjorn Helgaas <helgaas@xxxxxxxxxx>
> > Sent: Thursday, March 3, 2022 5:16 AM
> > To: 'Greg Kroah-Hartman' <gregkh@xxxxxxxxxxxxxxxxxxx>
> > Cc: �念��/TV S/W Lab(VD)/Staff Engineer/�Z���� <yj84.jang@xxxxxxxxxxx>;
> > 'Rafael J. Wysocki' <rafael@xxxxxxxxxx>; 'Pavel Machek' <pavel@xxxxxx>;
> > 'Len Brown' <len.brown@xxxxxxxxx>; 'Bjorn Helgaas' <bhelgaas@xxxxxxxxxx>;
> > linux-pm@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-
> > pci@xxxxxxxxxxxxxxx; linux-acpi@xxxxxxxxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx;
> > js07.lee@xxxxxxxxxxx
> > Subject: Re: [PATCH] PM: Add device name to suspend_report_result()
> >
> > On Wed, Mar 02, 2022 at 03:52:51PM +0100, 'Greg Kroah-Hartman' wrote:
> > > On Wed, Mar 02, 2022 at 08:00:14PM +0900, 念 /TV S/W Lab(VD)/Staff
> > Engineer/ Z wrote:
> > > > > -----Original Message-----
> > > > > From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> > > > > Sent: Wednesday, March 2, 2022 4:58 PM
> > > > > To: Youngjin Jang <yj84.jang@xxxxxxxxxxx>
> > > > > Cc: Rafael J. Wysocki <rafael@xxxxxxxxxx>; Pavel Machek
> > > > > <pavel@xxxxxx>; Len Brown <len.brown@xxxxxxxxx>; Bjorn Helgaas
> > > > > <bhelgaas@xxxxxxxxxx>; linux-pm@xxxxxxxxxxxxxxx;
> > > > > linux-kernel@xxxxxxxxxxxxxxx; linux- pci@xxxxxxxxxxxxxxx;
> > > > > linux-acpi@xxxxxxxxxxxxxxx; linux-
> > > > usb@xxxxxxxxxxxxxxx;
> > > > > js07.lee@xxxxxxxxxxx
> > > > > Subject: Re: [PATCH] PM: Add device name to
> > > > > suspend_report_result()
> > > > >
> > > > > On Wed, Mar 02, 2022 at 03:49:17PM +0900, Youngjin Jang wrote:
> > > > > > From: "yj84.jang" <yj84.jang@xxxxxxxxxxx>

> > > > > > - pr_err("%s(): %pS returns %d\n", function, fn, ret);
> > > > > > + pr_err("%s(): %pS (%s) returns %d\n", function, fn,
> > > > > > +dev_driver_string(dev), ret);
> > > > >
> > > > > If you have a struct device, please use dev_err().
> > > >
> > > > I think dev_err() is nice option, but we can see a minor issue.
> > > > Prefix log "PM: " would be lost, If I use dev_err() in this context.
> > > > As you know, all logs in power management include "PM :" prefix.
> > >
> > > Why does that matter? Fix them all to use the struct device pointer
> > > and then they will be properly unified with the rest of the kernel log
> > > infrastructure.
> >
> > You can #define dev_fmt if you need a prefix.
>
> I tested dev_fmt before, but I feel that not a good solution.
> Because the readability is not so great than I expected.
> I didn't want to break the PM logging rules.

I didn't catch your meaning here. Some examples would probably help.

The patch above is from __suspend_report_result() in
drivers/base/power/main.c. That file already defines both pr_fmt and
dev_fmt to be "PM: ", so I would expect dev_err() output to already
include "PM: ".