* [PATCH 2/7] backlight: apple_bl: use pr_debug/err instead of printk
@ 2012-05-15 7:52 Jingoo Han
2012-05-15 21:15 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Jingoo Han @ 2012-05-15 7:52 UTC (permalink / raw)
To: 'Andrew Morton', 'LKML'
Cc: 'Richard Purdie', 'Matthew Garrett',
'Jingoo Han'
This patch uses pr_debug/err instead of printk to allow dynamic debugging.
It also fixes checkpatch warnings as below:
WARNING: Prefer pr_debug(... to printk(KERN_DEBUG, ...
WARNING: Prefer pr_err(... to printk(KERN_ERR, ...
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/video/backlight/apple_bl.c | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/video/backlight/apple_bl.c b/drivers/video/backlight/apple_bl.c
index ef5ca0d..9236e95 100644
--- a/drivers/video/backlight/apple_bl.c
+++ b/drivers/video/backlight/apple_bl.c
@@ -61,8 +61,7 @@ static int intel_chipset_send_intensity(struct backlight_device *bd)
int intensity = bd->props.brightness;
if (debug)
- printk(KERN_DEBUG DRIVER "setting brightness to %d\n",
- intensity);
+ pr_debug("setting brightness to %d\n", intensity);
intel_chipset_set_brightness(intensity);
return 0;
@@ -77,8 +76,7 @@ static int intel_chipset_get_intensity(struct backlight_device *bd)
intensity = inb(0xb3) >> 4;
if (debug)
- printk(KERN_DEBUG DRIVER "read brightness of %d\n",
- intensity);
+ pr_debug("read brightness of %d\n", intensity);
return intensity;
}
@@ -108,8 +106,7 @@ static int nvidia_chipset_send_intensity(struct backlight_device *bd)
int intensity = bd->props.brightness;
if (debug)
- printk(KERN_DEBUG DRIVER "setting brightness to %d\n",
- intensity);
+ pr_debug("setting brightness to %d\n", intensity);
nvidia_chipset_set_brightness(intensity);
return 0;
@@ -124,8 +121,7 @@ static int nvidia_chipset_get_intensity(struct backlight_device *bd)
intensity = inb(0x52f) >> 4;
if (debug)
- printk(KERN_DEBUG DRIVER "read brightness of %d\n",
- intensity);
+ pr_debug("read brightness of %d\n", intensity);
return intensity;
}
@@ -150,7 +146,7 @@ static int __devinit apple_bl_add(struct acpi_device *dev)
host = pci_get_bus_and_slot(0, 0);
if (!host) {
- printk(KERN_ERR DRIVER "unable to find PCI host\n");
+ pr_err("unable to find PCI host\n");
return -ENODEV;
}
@@ -162,7 +158,7 @@ static int __devinit apple_bl_add(struct acpi_device *dev)
pci_dev_put(host);
if (!hw_data) {
- printk(KERN_ERR DRIVER "unknown hardware\n");
+ pr_err("unknown hardware\n");
return -ENODEV;
}
--
1.7.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH 2/7] backlight: apple_bl: use pr_debug/err instead of printk
2012-05-15 7:52 [PATCH 2/7] backlight: apple_bl: use pr_debug/err instead of printk Jingoo Han
@ 2012-05-15 21:15 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2012-05-15 21:15 UTC (permalink / raw)
To: Jingoo Han
Cc: 'LKML', 'Richard Purdie', 'Matthew Garrett'
On Tue, 15 May 2012 16:52:50 +0900
Jingoo Han <jg1.han@samsung.com> wrote:
> This patch uses pr_debug/err instead of printk to allow dynamic debugging.
> It also fixes checkpatch warnings as below:
>
> WARNING: Prefer pr_debug(... to printk(KERN_DEBUG, ...
> WARNING: Prefer pr_err(... to printk(KERN_ERR, ...
>
> ...
>
> --- a/drivers/video/backlight/apple_bl.c
> +++ b/drivers/video/backlight/apple_bl.c
> @@ -61,8 +61,7 @@ static int intel_chipset_send_intensity(struct backlight_device *bd)
> int intensity = bd->props.brightness;
>
> if (debug)
> - printk(KERN_DEBUG DRIVER "setting brightness to %d\n",
> - intensity);
> + pr_debug("setting brightness to %d\n", intensity);
This looks wrong. It replaces
apple_backlight: setting brightness to 42
with
setting brightness to 42
To do this properly we should do
#define pf_fmt "apple_backlight: "
before including printk.h. Conventionally this is done before
including any headers.
Also, apple_bl.c should explicitly include printk.h.
If doing this, please remove the DRIVER #define altogether.
Please check all the other drivers in this patchset. If they already
have custom things like DRIVER then remove that, define pr_fmt then
convert all the messages.
In other words, I'm recommending a functional change. For example,
drivers/video/backlight/generic_bl.c currently prints
Generic Backlight Driver Initialized
and I'm recommending that we switch this to
generic_bl: Generic Backlight Driver Initialized
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-15 21:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-15 7:52 [PATCH 2/7] backlight: apple_bl: use pr_debug/err instead of printk Jingoo Han
2012-05-15 21:15 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®