提交 35f96162 编写于 作者: J Jingoo Han 提交者: Linus Torvalds

backlight: use pr_warn() and pr_debug() instead of printk()

Use pr_warn() and pr_debug() instead of printk to allow dynamic debugging.
The pr_fmt prefix for pr_ macros is used.  Also fix checkpatch warnings
as below:

WARNING: Prefer pr_warn(... to printk(KERN_WARNING, ...

[akpm@linux-foundation.org: use KBUILD_MODNAME, per Joe]
Signed-off-by: NJingoo Han <jg1.han@samsung.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 71d7225c
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/device.h> #include <linux/device.h>
...@@ -123,7 +125,7 @@ static ssize_t backlight_store_power(struct device *dev, ...@@ -123,7 +125,7 @@ static ssize_t backlight_store_power(struct device *dev,
rc = -ENXIO; rc = -ENXIO;
mutex_lock(&bd->ops_lock); mutex_lock(&bd->ops_lock);
if (bd->ops) { if (bd->ops) {
pr_debug("backlight: set power to %lu\n", power); pr_debug("set power to %lu\n", power);
if (bd->props.power != power) { if (bd->props.power != power) {
bd->props.power = power; bd->props.power = power;
backlight_update_status(bd); backlight_update_status(bd);
...@@ -161,8 +163,7 @@ static ssize_t backlight_store_brightness(struct device *dev, ...@@ -161,8 +163,7 @@ static ssize_t backlight_store_brightness(struct device *dev,
if (brightness > bd->props.max_brightness) if (brightness > bd->props.max_brightness)
rc = -EINVAL; rc = -EINVAL;
else { else {
pr_debug("backlight: set brightness to %lu\n", pr_debug("set brightness to %lu\n", brightness);
brightness);
bd->props.brightness = brightness; bd->props.brightness = brightness;
backlight_update_status(bd); backlight_update_status(bd);
rc = count; rc = count;
...@@ -378,8 +379,8 @@ static int __init backlight_class_init(void) ...@@ -378,8 +379,8 @@ static int __init backlight_class_init(void)
{ {
backlight_class = class_create(THIS_MODULE, "backlight"); backlight_class = class_create(THIS_MODULE, "backlight");
if (IS_ERR(backlight_class)) { if (IS_ERR(backlight_class)) {
printk(KERN_WARNING "Unable to create backlight class; errno = %ld\n", pr_warn("Unable to create backlight class; errno = %ld\n",
PTR_ERR(backlight_class)); PTR_ERR(backlight_class));
return PTR_ERR(backlight_class); return PTR_ERR(backlight_class);
} }
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/device.h> #include <linux/device.h>
...@@ -116,7 +118,7 @@ static ssize_t lcd_store_power(struct device *dev, ...@@ -116,7 +118,7 @@ static ssize_t lcd_store_power(struct device *dev,
mutex_lock(&ld->ops_lock); mutex_lock(&ld->ops_lock);
if (ld->ops && ld->ops->set_power) { if (ld->ops && ld->ops->set_power) {
pr_debug("lcd: set power to %lu\n", power); pr_debug("set power to %lu\n", power);
ld->ops->set_power(ld, power); ld->ops->set_power(ld, power);
rc = count; rc = count;
} }
...@@ -152,7 +154,7 @@ static ssize_t lcd_store_contrast(struct device *dev, ...@@ -152,7 +154,7 @@ static ssize_t lcd_store_contrast(struct device *dev,
mutex_lock(&ld->ops_lock); mutex_lock(&ld->ops_lock);
if (ld->ops && ld->ops->set_contrast) { if (ld->ops && ld->ops->set_contrast) {
pr_debug("lcd: set contrast to %lu\n", contrast); pr_debug("set contrast to %lu\n", contrast);
ld->ops->set_contrast(ld, contrast); ld->ops->set_contrast(ld, contrast);
rc = count; rc = count;
} }
...@@ -263,8 +265,8 @@ static int __init lcd_class_init(void) ...@@ -263,8 +265,8 @@ static int __init lcd_class_init(void)
{ {
lcd_class = class_create(THIS_MODULE, "lcd"); lcd_class = class_create(THIS_MODULE, "lcd");
if (IS_ERR(lcd_class)) { if (IS_ERR(lcd_class)) {
printk(KERN_WARNING "Unable to create backlight class; errno = %ld\n", pr_warn("Unable to create backlight class; errno = %ld\n",
PTR_ERR(lcd_class)); PTR_ERR(lcd_class));
return PTR_ERR(lcd_class); return PTR_ERR(lcd_class);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册