diff mbox

[v2] power: Replace printks with dev_* and pr_* routines

Message ID 1384886818-11861-1-git-send-email-shuah.kh@samsung.com (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Shuah Khan Nov. 19, 2013, 6:46 p.m. UTC
Replaced printks with dev_* and pr_* routines. Replacing printk in
__suspend_report_result() will require passing in struct device *
pointer from calling routines and this will require changes to
external interface suspend_report_result() which is used by several
drivers. Hence, this one instance is replaced by pr_err().

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 drivers/base/power/main.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Joe Perches Nov. 19, 2013, 6:53 p.m. UTC | #1
On Tue, 2013-11-19 at 11:46 -0700, Shuah Khan wrote:
> Replaced printks with dev_* and pr_* routines. Replacing printk in
> __suspend_report_result() will require passing in struct device *
> pointer from calling routines and this will require changes to
> external interface suspend_report_result() which is used by several
> drivers. Hence, this one instance is replaced by pr_err().
[]
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
[]
> @@ -1308,9 +1308,8 @@ int dpm_prepare(pm_message_t state)
>  				error = 0;
>  				continue;
>  			}
> -			printk(KERN_INFO "PM: Device %s not prepared "
> -				"for power transition: code %d\n",
> -				dev_name(dev), error);
> +			dev_info("PM: not prepared for power transition: ",
> +				 "code %d\n", error);

Shuah, you have to make sure the files modified by
your patches compile successfully before sending
patches like this.


--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Shuah Khan Nov. 19, 2013, 6:57 p.m. UTC | #2
On 11/19/2013 11:53 AM, Joe Perches wrote:
> On Tue, 2013-11-19 at 11:46 -0700, Shuah Khan wrote:
>> Replaced printks with dev_* and pr_* routines. Replacing printk in
>> __suspend_report_result() will require passing in struct device *
>> pointer from calling routines and this will require changes to
>> external interface suspend_report_result() which is used by several
>> drivers. Hence, this one instance is replaced by pr_err().
> []
>> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> []
>> @@ -1308,9 +1308,8 @@ int dpm_prepare(pm_message_t state)
>>   				error = 0;
>>   				continue;
>>   			}
>> -			printk(KERN_INFO "PM: Device %s not prepared "
>> -				"for power transition: code %d\n",
>> -				dev_name(dev), error);
>> +			dev_info("PM: not prepared for power transition: ",
>> +				 "code %d\n", error);
>
> Shuah, you have to make sure the files modified by
> your patches compile successfully before sending
> patches like this.
>
>

Oops. I did compile. Missed the warning. Sorry about that.

-- Shuah
Joe Perches Nov. 19, 2013, 7:07 p.m. UTC | #3
On Tue, 2013-11-19 at 11:57 -0700, Shuah Khan wrote:
> On 11/19/2013 11:53 AM, Joe Perches wrote:
> > On Tue, 2013-11-19 at 11:46 -0700, Shuah Khan wrote:
> >> Replaced printks with dev_* and pr_* routines. Replacing printk in
> >> __suspend_report_result() will require passing in struct device *
> >> pointer from calling routines and this will require changes to
> >> external interface suspend_report_result() which is used by several
> >> drivers. Hence, this one instance is replaced by pr_err().
> > []
> >> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> > []
> >> @@ -1308,9 +1308,8 @@ int dpm_prepare(pm_message_t state)
> >>   				error = 0;
> >>   				continue;
> >>   			}
> >> -			printk(KERN_INFO "PM: Device %s not prepared "
> >> -				"for power transition: code %d\n",
> >> -				dev_name(dev), error);
> >> +			dev_info("PM: not prepared for power transition: ",
> >> +				 "code %d\n", error);
> >
> > Shuah, you have to make sure the files modified by
> > your patches compile successfully before sending
> > patches like this.
> Oops. I did compile. Missed the warning. Sorry about that.

btw:

When you're doing patches like this, not bugfixes,
not something that's going to be applied to current
or stable, please make them against -next and not
against Linus' tree.

Also, I would make the larger change that modifies
all the drivers like I suggested.  What you've done
I think is a half-measure and is incomplete.

cheers, Joe

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Shuah Khan Nov. 19, 2013, 8 p.m. UTC | #4
On 11/19/2013 12:07 PM, Joe Perches wrote:
> On Tue, 2013-11-19 at 11:57 -0700, Shuah Khan wrote:
>> On 11/19/2013 11:53 AM, Joe Perches wrote:
>>> On Tue, 2013-11-19 at 11:46 -0700, Shuah Khan wrote:
>>>> Replaced printks with dev_* and pr_* routines. Replacing printk in
>>>> __suspend_report_result() will require passing in struct device *
>>>> pointer from calling routines and this will require changes to
>>>> external interface suspend_report_result() which is used by several
>>>> drivers. Hence, this one instance is replaced by pr_err().
>>> []
>>>> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
>>> []
>>>> @@ -1308,9 +1308,8 @@ int dpm_prepare(pm_message_t state)
>>>>    				error = 0;
>>>>    				continue;
>>>>    			}
>>>> -			printk(KERN_INFO "PM: Device %s not prepared "
>>>> -				"for power transition: code %d\n",
>>>> -				dev_name(dev), error);
>>>> +			dev_info("PM: not prepared for power transition: ",
>>>> +				 "code %d\n", error);
>>>
>>> Shuah, you have to make sure the files modified by
>>> your patches compile successfully before sending
>>> patches like this.
>> Oops. I did compile. Missed the warning. Sorry about that.
>
> btw:
>
> When you're doing patches like this, not bugfixes,
> not something that's going to be applied to current
> or stable, please make them against -next and not
> against Linus' tree.

ok. Makes sense changes like this don't need to be rushed. They could 
use soak time in linux-next.

>
> Also, I would make the larger change that modifies
> all the drivers like I suggested.  What you've done
> I think is a half-measure and is incomplete.
>

I was a bit reluctant to change all the drivers since the original 
message didn't include device information. However, adding device 
information would make this message more useful.

I will re-do the patch to make the larger change.

-- Shuah
Greg Kroah-Hartman Nov. 19, 2013, 10:59 p.m. UTC | #5
On Tue, Nov 19, 2013 at 11:57:22AM -0700, Shuah Khan wrote:
> On 11/19/2013 11:53 AM, Joe Perches wrote:
> > On Tue, 2013-11-19 at 11:46 -0700, Shuah Khan wrote:
> >> Replaced printks with dev_* and pr_* routines. Replacing printk in
> >> __suspend_report_result() will require passing in struct device *
> >> pointer from calling routines and this will require changes to
> >> external interface suspend_report_result() which is used by several
> >> drivers. Hence, this one instance is replaced by pr_err().
> > []
> >> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> > []
> >> @@ -1308,9 +1308,8 @@ int dpm_prepare(pm_message_t state)
> >>   				error = 0;
> >>   				continue;
> >>   			}
> >> -			printk(KERN_INFO "PM: Device %s not prepared "
> >> -				"for power transition: code %d\n",
> >> -				dev_name(dev), error);
> >> +			dev_info("PM: not prepared for power transition: ",
> >> +				 "code %d\n", error);
> >
> > Shuah, you have to make sure the files modified by
> > your patches compile successfully before sending
> > patches like this.
> >
> >
> 
> Oops. I did compile. Missed the warning. Sorry about that.

It should be an "error"...

It adds a codingstyle warning as well, so fix that up for the next
version please :)

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 9f098a8..3f42c43 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -349,8 +349,8 @@  static void pm_dev_dbg(struct device *dev, pm_message_t state, char *info)
 static void pm_dev_err(struct device *dev, pm_message_t state, char *info,
 			int error)
 {
-	printk(KERN_ERR "PM: Device %s failed to %s%s: error %d\n",
-		dev_name(dev), pm_verb(state.event), info, error);
+	dev_err(dev, "PM: 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, char *info)
@@ -1308,9 +1308,8 @@  int dpm_prepare(pm_message_t state)
 				error = 0;
 				continue;
 			}
-			printk(KERN_INFO "PM: Device %s not prepared "
-				"for power transition: code %d\n",
-				dev_name(dev), error);
+			dev_info("PM: not prepared for power transition: ",
+				 "code %d\n", error);
 			put_device(dev);
 			break;
 		}
@@ -1347,7 +1346,7 @@  EXPORT_SYMBOL_GPL(dpm_suspend_start);
 void __suspend_report_result(const char *function, void *fn, int ret)
 {
 	if (ret)
-		printk(KERN_ERR "%s(): %pF returns %d\n", function, fn, ret);
+		pr_err("%s(): %pF returns %d\n", function, fn, ret);
 }
 EXPORT_SYMBOL_GPL(__suspend_report_result);