Skip to contentSkip to conversation

gpio: samsung: use pr_* instead of printk

PATCH Superseded Jingoo Han 3 participants 8 messages Sep 10, 2012 – Sep 11, 2012 GPIO

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/1 gpio: samsung: use pr_* instead of printk

This patch uses pr_* instead of printk.

---
 drivers/gpio/gpio-samsung.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-samsung.c +3 -3
index ba126cc..e38d990 100644
@@ -45,7 +45,7 @@
 #ifndef DEBUG_GPIO
 #define gpio_dbg(x...) do { } while (0)
 #else
-#define gpio_dbg(x...) printk(KERN_DEBUG x)
+#define gpio_dbg(x...) pr_debug(x)
 #endif
 
 int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip,
@@ -926,10 +926,10 @@ static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip)
 #ifdef CONFIG_PM
 	if (chip->pm != NULL) {
 		if (!chip->pm->save || !chip->pm->resume)
-			printk(KERN_ERR "gpio: %s has missing PM functions\n",
+			pr_err("gpio: %s has missing PM functions\n",
 			       gc->label);
 	} else
-		printk(KERN_ERR "gpio: %s has no PM function\n", gc->label);
+		pr_err("gpio: %s has no PM function\n", gc->label);
 #endif
 
 	/* gpiochip_add() prints own failure message on error. */
Signature · 1 line
1.7.1
#1 lore raw
Quoted 6 lines · Jingoo Han

This patch uses pr_* instead of printk.

drivers/gpio/gpio-samsung.c | 6 +++--- 1 files changed, 3
insertions(+), 3 deletions(-)

Quoted 6 lines
(quoted diff) +0 -0

b/drivers/gpio/gpio-samsung.c index ba126cc..e38d990 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c @@ -45,7 +45,7 @@ #ifndef DEBUG_GPIO #define gpio_dbg(x...) do { } while
(0) #else -#define gpio_dbg(x...) printk(KERN_DEBUG x) +#define gpio_dbg(x...) pr_debug(x)

This is a functional change since pr_debug compiles away to nothing unless DEBUG is defined, so now you need to define both DEBUG and DEBUG_GPIO for this to print.

A better fix would be to just replace calls to gpio_dbg with pr_debug.

~Ryan

author
#2 lore raw

On Tuesday, September 11, 2012 3:09 PM Ryan Mallon wrote

Quoted 19 lines · Jingoo Han
Quoted 6 lines

This patch uses pr_* instead of printk.

drivers/gpio/gpio-samsung.c | 6 +++--- 1 files changed, 3
insertions(+), 3 deletions(-)

Quoted 6 lines
(quoted diff) +0 -0

b/drivers/gpio/gpio-samsung.c index ba126cc..e38d990 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c @@ -45,7 +45,7 @@ #ifndef DEBUG_GPIO #define gpio_dbg(x...) do { } while
(0) #else -#define gpio_dbg(x...) printk(KERN_DEBUG x) +#define gpio_dbg(x...) pr_debug(x)

This is a functional change since pr_debug compiles away to nothing unless DEBUG is defined, so now you need to define both DEBUG and DEBUG_GPIO for this to print.

Quoted 3 lines

A better fix would be to just replace calls to gpio_dbg with pr_debug.

~Ryan

Hi Ryan Mallon,

OK, I will replace gpio_dbg with pr_debug as you mentioned. Thank you.

Best regards,
Jingoo Han

#3 lore raw
In reply to Jingoo Han

Hi,

Quoted 21 lines · Jingoo Han

This patch uses pr_* instead of printk.

---
 drivers/gpio/gpio-samsung.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-samsung.c +1 -1
index ba126cc..e38d990 100644
@@ -45,7 +45,7 @@
 #ifndef DEBUG_GPIO
 #define gpio_dbg(x...) do { } while (0)
 #else
-#define gpio_dbg(x...) printk(KERN_DEBUG x)
+#define gpio_dbg(x...) pr_debug(x)
 #endif
 
 int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip,

drivers/gpio/gpio-samsung.c static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip) · line 930

Quoted 6 lines
drivers/gpio/gpio-samsung.c +1 -1
@@ -926,10 +926,10 @@ static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip)
 #ifdef CONFIG_PM
 	if (chip->pm != NULL) {
 		if (!chip->pm->save || !chip->pm->resume)
-			printk(KERN_ERR "gpio: %s has missing PM functions\n",
+			pr_err("gpio: %s has missing PM functions\n",
 			       gc->label);

I would rather see dev_* conversion instead.

my 2 cents

Signature · 1 line
balbi
author
#4 lore raw

On Tuesday, September 11, 2012 3:31 PM Felipe Balbi wrote

Quoted 34 lines

Hi,

Quoted 21 lines · Jingoo Han

This patch uses pr_* instead of printk.

---
 drivers/gpio/gpio-samsung.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-samsung.c +1 -1
index ba126cc..e38d990 100644
@@ -45,7 +45,7 @@
 #ifndef DEBUG_GPIO
 #define gpio_dbg(x...) do { } while (0)
 #else
-#define gpio_dbg(x...) printk(KERN_DEBUG x)
+#define gpio_dbg(x...) pr_debug(x)
 #endif
 
 int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip,

drivers/gpio/gpio-samsung.c static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip) · line 930

Quoted 6 lines
drivers/gpio/gpio-samsung.c +1 -1
@@ -926,10 +926,10 @@ static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip)
 #ifdef CONFIG_PM
 	if (chip->pm != NULL) {
 		if (!chip->pm->save || !chip->pm->resume)
-			printk(KERN_ERR "gpio: %s has missing PM functions\n",
+			pr_err("gpio: %s has missing PM functions\n",
 			       gc->label);

I would rather see dev_* conversion instead.

Quoted 1 line

my 2 cents

Hi Felipe Balbi,

OK, I will replace printk(KERN_ERR...) with dev_err. Thank you.

Best regards,
Jingoo Han

Quoted 3 lines

--
balbi

#5 lore raw
Quoted 36 lines · Jingoo Han

On Tuesday, September 11, 2012 3:31 PM Felipe Balbi wrote

Quoted 34 lines

Hi,

Quoted 21 lines · Jingoo Han

This patch uses pr_* instead of printk.

---
 drivers/gpio/gpio-samsung.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-samsung.c +1 -1
index ba126cc..e38d990 100644
@@ -45,7 +45,7 @@
 #ifndef DEBUG_GPIO
 #define gpio_dbg(x...) do { } while (0)
 #else
-#define gpio_dbg(x...) printk(KERN_DEBUG x)
+#define gpio_dbg(x...) pr_debug(x)
 #endif
 
 int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip,

drivers/gpio/gpio-samsung.c static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip) · line 930

Quoted 6 lines
drivers/gpio/gpio-samsung.c +1 -1
@@ -926,10 +926,10 @@ static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip)
 #ifdef CONFIG_PM
 	if (chip->pm != NULL) {
 		if (!chip->pm->save || !chip->pm->resume)
-			printk(KERN_ERR "gpio: %s has missing PM functions\n",
+			pr_err("gpio: %s has missing PM functions\n",
 			       gc->label);

I would rather see dev_* conversion instead.

Quoted 6 lines
Quoted 1 line

my 2 cents

Hi Felipe Balbi,

OK, I will replace printk(KERN_ERR...) with dev_err. Thank you.

I was going to suggest that also, but I don't think that there is a dev pointer to use. The gpio_chip structure has an optional one, but from my quick glance it didn't look like the Samsung driver was using it. I could be wrong though. If I am, go with dev_err (and dev_dbg for replacing the gpio_dbg statements).

~Ryan

author
#6 lore raw

On Tuesday, September 11, 2012 3:48 PM Ryan Mallon wrote

Quoted 42 lines · Jingoo Han
Quoted 40 lines

On Tuesday, September 11, 2012 3:31 PM Felipe Balbi wrote

Quoted 34 lines

Hi,

Quoted 21 lines · Jingoo Han

This patch uses pr_* instead of printk.

---
 drivers/gpio/gpio-samsung.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-samsung.c +1 -1
index ba126cc..e38d990 100644
@@ -45,7 +45,7 @@
 #ifndef DEBUG_GPIO
 #define gpio_dbg(x...) do { } while (0)
 #else
-#define gpio_dbg(x...) printk(KERN_DEBUG x)
+#define gpio_dbg(x...) pr_debug(x)
 #endif
 
 int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip,

drivers/gpio/gpio-samsung.c static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip) · line 930

Quoted 6 lines
drivers/gpio/gpio-samsung.c +1 -1
@@ -926,10 +926,10 @@ static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip)
 #ifdef CONFIG_PM
 	if (chip->pm != NULL) {
 		if (!chip->pm->save || !chip->pm->resume)
-			printk(KERN_ERR "gpio: %s has missing PM functions\n",
+			pr_err("gpio: %s has missing PM functions\n",
 			       gc->label);

I would rather see dev_* conversion instead.

Quoted 1 line

my 2 cents

Hi Felipe Balbi,

Quoted 8 lines
Quoted 2 lines

OK, I will replace printk(KERN_ERR...) with dev_err. Thank you.

I was going to suggest that also, but I don't think that there is a dev pointer to use. The gpio_chip structure has an optional one, but from my quick glance it didn't look like the Samsung driver was using it. I could be wrong though. If I am, go with dev_err (and dev_dbg for replacing the gpio_dbg statements).

Also, I cannot find dev point to use.
I will use pr_dbg, pr_err.

Thanks.

Quoted 5 lines

~Ryan

#7 lore raw
Quoted 46 lines · Jingoo Han

On Tuesday, September 11, 2012 3:48 PM Ryan Mallon wrote

Quoted 45 lines · Jingoo Han
Quoted 42 lines

On Tuesday, September 11, 2012 3:31 PM Felipe Balbi wrote

Quoted 34 lines

Hi,

Quoted 21 lines · Jingoo Han

This patch uses pr_* instead of printk.

---
 drivers/gpio/gpio-samsung.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-samsung.c +1 -1
index ba126cc..e38d990 100644
@@ -45,7 +45,7 @@
 #ifndef DEBUG_GPIO
 #define gpio_dbg(x...) do { } while (0)
 #else
-#define gpio_dbg(x...) printk(KERN_DEBUG x)
+#define gpio_dbg(x...) pr_debug(x)
 #endif
 
 int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip,

drivers/gpio/gpio-samsung.c static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip) · line 930

Quoted 6 lines
drivers/gpio/gpio-samsung.c +1 -1
@@ -926,10 +926,10 @@ static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip)
 #ifdef CONFIG_PM
 	if (chip->pm != NULL) {
 		if (!chip->pm->save || !chip->pm->resume)
-			printk(KERN_ERR "gpio: %s has missing PM functions\n",
+			pr_err("gpio: %s has missing PM functions\n",
 			       gc->label);

I would rather see dev_* conversion instead.

Quoted 1 line

my 2 cents

Hi Felipe Balbi,

OK, I will replace printk(KERN_ERR...) with dev_err. Thank you.

Quoted 8 lines
Quoted 5 lines

I was going to suggest that also, but I don't think that there is a dev pointer to use. The gpio_chip structure has an optional one, but from my quick glance it didn't look like the Samsung driver was using it. I could be wrong though. If I am, go with dev_err (and dev_dbg for replacing the gpio_dbg statements).

Also, I cannot find dev point to use.
I will use pr_dbg, pr_err.

Now that I look at the driver, the missing dev pointer is just because gpio-samsung.c is NOT a proper driver. I'd strongly suggest to convert the driver to a proper platform_driver, but it's your call anyway ;-)

my 2 cents

Signature · 1 line
balbi