Skip to contentSkip to conversation

staging/comedi: Use pr_ or dev_ printks in drivers/serial2002.c

PATCH In review YAMANE Toshiaki 2 participants 3 messages Oct 10, 2012 – Oct 25, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging/comedi: Use pr_ or dev_ printks in drivers/serial2002.c

fixed below checkpatch warning.
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...

and added pr_fmt.

---
 drivers/staging/comedi/drivers/serial2002.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/staging/comedi/drivers/serial2002.c +5 -2
index 5bf84cf..cc4f6e7 100644
@@ -31,6 +31,8 @@ Status: in development
 
 */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include "../comedidev.h"
 
 #include <linux/delay.h>
@@ -282,7 +284,7 @@ static struct serial_data serial_read(struct file *f, int timeout)
 
 		length++;
 		if (data < 0) {
-			printk(KERN_ERR "serial2002 error\n");
+			pr_err("serial2002 error\n");
 			break;
 		} else if (data & 0x80) {
 			result.value = (result.value << 7) | (data & 0x7f);
@@ -355,7 +357,8 @@ static int serial_2002_open(struct comedi_device *dev)
 	devpriv->tty = filp_open(port, O_RDWR, 0);
 	if (IS_ERR(devpriv->tty)) {
 		result = (int)PTR_ERR(devpriv->tty);
-		printk(KERN_ERR "serial_2002: file open error = %d\n", result);
+		dev_err(dev->class_dev,
+			"serial_2002: file open error = %d\n", result);
 	} else {
 		struct config_t {
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 24 lines · YAMANE Toshiaki

fixed below checkpatch warning.
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...

and added pr_fmt.

---
 drivers/staging/comedi/drivers/serial2002.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/staging/comedi/drivers/serial2002.c +2 -0
index 5bf84cf..cc4f6e7 100644
@@ -31,6 +31,8 @@ Status: in development
 
 */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include "../comedidev.h"
 
 #include <linux/delay.h>

drivers/staging/comedi/drivers/serial2002.c static struct serial_data serial_read(struct file *f, int timeout) · line 287

Quoted 5 lines
drivers/staging/comedi/drivers/serial2002.c +1 -1
@@ -282,7 +284,7 @@ static struct serial_data serial_read(struct file *f, int timeout)
 
 		length++;
 		if (data < 0) {
-			printk(KERN_ERR "serial2002 error\n");
+			pr_err("serial2002 error\n");

The "serial2002" word here is redundant.

drivers/staging/comedi/drivers/serial2002.c static int serial_2002_open(struct comedi_device *dev) · line 361

Quoted 10 lines
drivers/staging/comedi/drivers/serial2002.c +2 -1
 			break;
 		} else if (data & 0x80) {
 			result.value = (result.value << 7) | (data & 0x7f);
@@ -355,7 +357,8 @@ static int serial_2002_open(struct comedi_device *dev)
 	devpriv->tty = filp_open(port, O_RDWR, 0);
 	if (IS_ERR(devpriv->tty)) {
 		result = (int)PTR_ERR(devpriv->tty);
-		printk(KERN_ERR "serial_2002: file open error = %d\n", result);
+		dev_err(dev->class_dev,
+			"serial_2002: file open error = %d\n", result);

Same here.

greg k-h

#2 lore raw

PATCH v2 1/1 staging/comedi: Use pr_ or dev_ printks in drivers/serial2002.c

fixed below checkpatch warning.
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...

and added pr_fmt.

---
 drivers/staging/comedi/drivers/serial2002.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/comedi/drivers/serial2002.c +4 -2
index 5bf84cf..91fb8b1 100644
@@ -31,6 +31,8 @@ Status: in development
 
 */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include "../comedidev.h"
 
 #include <linux/delay.h>
@@ -282,7 +284,7 @@ static struct serial_data serial_read(struct file *f, int timeout)
 
 		length++;
 		if (data < 0) {
-			printk(KERN_ERR "serial2002 error\n");
+			pr_err("Failed to read serial.\n");
 			break;
 		} else if (data & 0x80) {
 			result.value = (result.value << 7) | (data & 0x7f);
@@ -355,7 +357,7 @@ static int serial_2002_open(struct comedi_device *dev)
 	devpriv->tty = filp_open(port, O_RDWR, 0);
 	if (IS_ERR(devpriv->tty)) {
 		result = (int)PTR_ERR(devpriv->tty);
-		printk(KERN_ERR "serial_2002: file open error = %d\n", result);
+		dev_err(dev->class_dev, "file open error = %d\n", result);
 	} else {
 		struct config_t {
 
Signature · 1 line
1.7.9.5