* [PATCH] power: Replace printks with pr_* routines
@ 2013-11-15 16:10 Shuah Khan
2013-11-15 21:19 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Shuah Khan @ 2013-11-15 16:10 UTC (permalink / raw)
To: len.brown, pavel, gregkh, rjw
Cc: Shuah Khan, linux-pm, linux-kernel, shuahkhan
Replaced printks with pr_* routines. dev_* routines could have been used,
but chose to use pr_* to avoid breaking scripts that might be relying on
a specific text.
Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
drivers/base/power/main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 9f098a8..43d5dcf 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -349,7 +349,7 @@ 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",
+ pr_err("PM: Device %s failed to %s%s: error %d\n",
dev_name(dev), pm_verb(state.event), info, error);
}
@@ -1308,7 +1308,7 @@ int dpm_prepare(pm_message_t state)
error = 0;
continue;
}
- printk(KERN_INFO "PM: Device %s not prepared "
+ pr_info("PM: Device %s not prepared "
"for power transition: code %d\n",
dev_name(dev), error);
put_device(dev);
@@ -1347,7 +1347,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);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] power: Replace printks with pr_* routines
2013-11-15 16:10 [PATCH] power: Replace printks with pr_* routines Shuah Khan
@ 2013-11-15 21:19 ` Greg KH
2013-11-15 21:46 ` Joe Perches
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2013-11-15 21:19 UTC (permalink / raw)
To: Shuah Khan; +Cc: len.brown, pavel, rjw, linux-pm, linux-kernel, shuahkhan
On Fri, Nov 15, 2013 at 09:10:06AM -0700, Shuah Khan wrote:
> Replaced printks with pr_* routines. dev_* routines could have been used,
> but chose to use pr_* to avoid breaking scripts that might be relying on
> a specific text.
I'd really like to switch to dev_* instead, even changing to pr_* should
change the output prefix (if it's set for this file, odds are it isn't
though...)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] power: Replace printks with pr_* routines
2013-11-15 21:19 ` Greg KH
@ 2013-11-15 21:46 ` Joe Perches
2013-11-15 22:10 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2013-11-15 21:46 UTC (permalink / raw)
To: Greg KH
Cc: Shuah Khan, len.brown, pavel, rjw, linux-pm, linux-kernel, shuahkhan
On Sat, 2013-11-16 at 06:19 +0900, Greg KH wrote:
> On Fri, Nov 15, 2013 at 09:10:06AM -0700, Shuah Khan wrote:
> > Replaced printks with pr_* routines. dev_* routines could have been used,
> > but chose to use pr_* to avoid breaking scripts that might be relying on
> > a specific text.
>
> I'd really like to switch to dev_* instead, even changing to pr_* should
> change the output prefix (if it's set for this file, odds are it isn't
> though...)
It's not.
Something like this?
Pass a struct device * through to the PM
suspend logging routines. Use dev_<level>
instead of printks.
---
drivers/base/power/main.c | 20 ++++++++++----------
drivers/pci/pci-driver.c | 18 +++++++++---------
drivers/pnp/driver.c | 2 +-
drivers/usb/core/hcd-pci.c | 4 ++--
include/linux/pm.h | 14 ++++++++------
5 files changed, 30 insertions(+), 28 deletions(-)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index c12e9b9..e0c12e6 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -351,8 +351,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)
@@ -385,7 +385,7 @@ static int dpm_run_callback(pm_callback_t cb, struct device *dev,
pm_dev_dbg(dev, state, info);
error = cb(dev);
- suspend_report_result(cb, error);
+ suspend_report_result(dev, cb, error);
initcall_debug_report(dev, calltime, error, state, info);
@@ -1112,7 +1112,7 @@ static int legacy_suspend(struct device *dev, pm_message_t state,
calltime = initcall_debug_start(dev);
error = cb(dev, state);
- suspend_report_result(cb, error);
+ suspend_report_result(dev, cb, error);
initcall_debug_report(dev, calltime, error, state, info);
@@ -1345,7 +1345,7 @@ static int device_prepare(struct device *dev, pm_message_t state)
if (callback) {
error = callback(dev);
- suspend_report_result(callback, error);
+ suspend_report_result(dev, callback, error);
}
device_unlock(dev);
@@ -1381,9 +1381,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(dev, "PM: not prepared for power transition: code %d\n",
+ error);
put_device(dev);
break;
}
@@ -1417,10 +1416,11 @@ int dpm_suspend_start(pm_message_t state)
}
EXPORT_SYMBOL_GPL(dpm_suspend_start);
-void __suspend_report_result(const char *function, void *fn, int ret)
+void __suspend_report_result(const struct device *dev,
+ const char *function, void *fn, int ret)
{
if (ret)
- printk(KERN_ERR "%s(): %pF returns %d\n", function, fn, ret);
+ dev_err(dev, "PM: %s(): %pF returns %d\n", function, fn, ret);
}
EXPORT_SYMBOL_GPL(__suspend_report_result);
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 4548535..340de34 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -484,7 +484,7 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state)
int error;
error = drv->suspend(pci_dev, state);
- suspend_report_result(drv->suspend, error);
+ suspend_report_result(dev, drv->suspend, error);
if (error)
return error;
@@ -511,7 +511,7 @@ static int pci_legacy_suspend_late(struct device *dev, pm_message_t state)
int error;
error = drv->suspend_late(pci_dev, state);
- suspend_report_result(drv->suspend_late, error);
+ suspend_report_result(dev, drv->suspend_late, error);
if (error)
return error;
@@ -638,7 +638,7 @@ static int pci_pm_suspend(struct device *dev)
int error;
error = pm->suspend(dev);
- suspend_report_result(pm->suspend, error);
+ suspend_report_result(dev, pm->suspend, error);
if (error)
return error;
@@ -674,7 +674,7 @@ static int pci_pm_suspend_noirq(struct device *dev)
int error;
error = pm->suspend_noirq(dev);
- suspend_report_result(pm->suspend_noirq, error);
+ suspend_report_result(dev, pm->suspend_noirq, error);
if (error)
return error;
@@ -791,7 +791,7 @@ static int pci_pm_freeze(struct device *dev)
int error;
error = pm->freeze(dev);
- suspend_report_result(pm->freeze, error);
+ suspend_report_result(dev, pm->freeze, error);
if (error)
return error;
}
@@ -814,7 +814,7 @@ static int pci_pm_freeze_noirq(struct device *dev)
int error;
error = drv->pm->freeze_noirq(dev);
- suspend_report_result(drv->pm->freeze_noirq, error);
+ suspend_report_result(dev, drv->pm->freeze_noirq, error);
if (error)
return error;
}
@@ -898,7 +898,7 @@ static int pci_pm_poweroff(struct device *dev)
int error;
error = pm->poweroff(dev);
- suspend_report_result(pm->poweroff, error);
+ suspend_report_result(dev, pm->poweroff, error);
if (error)
return error;
}
@@ -927,7 +927,7 @@ static int pci_pm_poweroff_noirq(struct device *dev)
int error;
error = drv->pm->poweroff_noirq(dev);
- suspend_report_result(drv->pm->poweroff_noirq, error);
+ suspend_report_result(dev, drv->pm->poweroff_noirq, error);
if (error)
return error;
}
@@ -1040,7 +1040,7 @@ static int pci_pm_runtime_suspend(struct device *dev)
pci_dev->state_saved = false;
pci_dev->no_d3cold = false;
error = pm->runtime_suspend(dev);
- suspend_report_result(pm->runtime_suspend, error);
+ suspend_report_result(dev, pm->runtime_suspend, error);
if (error)
return error;
if (!pci_dev->d3cold_allowed)
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index 6936e0a..1e70fc6 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -165,7 +165,7 @@ static int __pnp_bus_suspend(struct device *dev, pm_message_t state)
if (pnp_drv->driver.pm && pnp_drv->driver.pm->suspend) {
error = pnp_drv->driver.pm->suspend(dev);
- suspend_report_result(pnp_drv->driver.pm->suspend, error);
+ suspend_report_result(dev, pnp_drv->driver.pm->suspend, error);
if (error)
return error;
}
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index dfe9d0f..890ae99 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -453,7 +453,7 @@ static int suspend_common(struct device *dev, bool do_wakeup)
HCD_WAKEUP_PENDING(hcd->shared_hcd))
return -EBUSY;
retval = hcd->driver->pci_suspend(hcd, do_wakeup);
- suspend_report_result(hcd->driver->pci_suspend, retval);
+ suspend_report_result(dev, hcd->driver->pci_suspend, retval);
/* Check again in case wakeup raced with pci_suspend */
if ((retval == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) ||
@@ -566,7 +566,7 @@ static int hcd_pci_suspend_noirq(struct device *dev)
dev_dbg(dev, "--> PCI %s\n",
pci_power_name(pci_dev->current_state));
} else {
- suspend_report_result(pci_prepare_to_sleep, retval);
+ suspend_report_result(dev, pci_prepare_to_sleep, retval);
return retval;
}
diff --git a/include/linux/pm.h b/include/linux/pm.h
index a224c7f..d2a525a 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -644,12 +644,11 @@ extern int dpm_suspend_start(pm_message_t state);
extern int dpm_suspend(pm_message_t state);
extern int dpm_prepare(pm_message_t state);
-extern void __suspend_report_result(const char *function, void *fn, int ret);
+extern void __suspend_report_result(const struct device *dev,
+ const char *function, void *fn, int ret);
-#define suspend_report_result(fn, ret) \
- do { \
- __suspend_report_result(__func__, fn, ret); \
- } while (0)
+#define suspend_report_result(dev, fn, ret) \
+ __suspend_report_result(dev, __func__, fn, ret)
extern int device_pm_wait_for_dev(struct device *sub, struct device *dev);
extern void dpm_for_each_dev(void *data, void (*fn)(struct device *, void *));
@@ -685,7 +684,10 @@ static inline int dpm_suspend_start(pm_message_t state)
return 0;
}
-#define suspend_report_result(fn, ret) do {} while (0)
+static inline void suspend_report_result(const struct device *dev,
+ const char *fn, int ret)
+{
+}
static inline int device_pm_wait_for_dev(struct device *a, struct device *b)
{
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] power: Replace printks with pr_* routines
2013-11-15 21:46 ` Joe Perches
@ 2013-11-15 22:10 ` Greg KH
2013-11-15 22:27 ` Shuah Khan
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2013-11-15 22:10 UTC (permalink / raw)
To: Joe Perches
Cc: Shuah Khan, len.brown, pavel, rjw, linux-pm, linux-kernel, shuahkhan
On Fri, Nov 15, 2013 at 01:46:21PM -0800, Joe Perches wrote:
> On Sat, 2013-11-16 at 06:19 +0900, Greg KH wrote:
> > On Fri, Nov 15, 2013 at 09:10:06AM -0700, Shuah Khan wrote:
> > > Replaced printks with pr_* routines. dev_* routines could have been used,
> > > but chose to use pr_* to avoid breaking scripts that might be relying on
> > > a specific text.
> >
> > I'd really like to switch to dev_* instead, even changing to pr_* should
> > change the output prefix (if it's set for this file, odds are it isn't
> > though...)
>
> It's not.
>
> Something like this?
>
> Pass a struct device * through to the PM
> suspend logging routines. Use dev_<level>
> instead of printks.
That looks good to me, Shuah, does it work for you?
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] power: Replace printks with pr_* routines
2013-11-15 22:10 ` Greg KH
@ 2013-11-15 22:27 ` Shuah Khan
0 siblings, 0 replies; 5+ messages in thread
From: Shuah Khan @ 2013-11-15 22:27 UTC (permalink / raw)
To: Greg KH, Joe Perches
Cc: len.brown, pavel, rjw, linux-pm, linux-kernel, shuahkhan, Shuah Khan
On 11/15/2013 03:10 PM, Greg KH wrote:
> On Fri, Nov 15, 2013 at 01:46:21PM -0800, Joe Perches wrote:
>> On Sat, 2013-11-16 at 06:19 +0900, Greg KH wrote:
>>> On Fri, Nov 15, 2013 at 09:10:06AM -0700, Shuah Khan wrote:
>>>> Replaced printks with pr_* routines. dev_* routines could have been used,
>>>> but chose to use pr_* to avoid breaking scripts that might be relying on
>>>> a specific text.
>>>
>>> I'd really like to switch to dev_* instead, even changing to pr_* should
>>> change the output prefix (if it's set for this file, odds are it isn't
>>> though...)
>>
>> It's not.
>>
>> Something like this?
>>
>> Pass a struct device * through to the PM
>> suspend logging routines. Use dev_<level>
>> instead of printks.
>
> That looks good to me, Shuah, does it work for you?
>
> greg k-h
>
Looks good to me. I will update and re-send the patch.
-- Shuah
--
Shuah Khan
Senior Linux Kernel Developer - Open Source Group
Samsung Research America(Silicon Valley)
shuah.kh@samsung.com | (970) 672-0658
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-11-15 22:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-15 16:10 [PATCH] power: Replace printks with pr_* routines Shuah Khan
2013-11-15 21:19 ` Greg KH
2013-11-15 21:46 ` Joe Perches
2013-11-15 22:10 ` Greg KH
2013-11-15 22:27 ` Shuah Khan
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.