Skip to contentSkip to conversation

Staging: comedi: fl512: Replace printk with dev_info et al

PATCH In review Bruce Humphrey 2 participants 2 messages Sep 13, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Staging: comedi: fl512: Replace printk with dev_info et al

Replace printk(KERN_XXX with the appropiate dev_info, dev_warn, dev_dbg in fl512.c

---
 drivers/staging/comedi/drivers/fl512.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/staging/comedi/drivers/fl512.c +7 -5
index d1da809..5a8e0ae 100644
@@ -118,9 +118,9 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	struct comedi_subdevice *s;
 
 	iobase = it->options[0];
-	printk(KERN_INFO "comedi:%d fl512: 0x%04lx", dev->minor, iobase);
+	dev_info(dev->class_dev, "%s: 0x%04lx\n", dev->board_name, iobase);
 	if (!request_region(iobase, FL512_SIZE, "fl512")) {
-		printk(KERN_WARNING " I/O port conflict\n");
+		dev_warn(dev->class_dev, " I/O port conflict\n");
 		return -EIO;
 	}
 	dev->iobase = iobase;
@@ -129,7 +129,7 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		return -ENOMEM;
 
 #if DEBUG
-	printk(KERN_DEBUG "malloc ok\n");
+	dev_dbg(dev->class_dev, "malloc ok\n");
 #endif
 
 	ret = comedi_alloc_subdevices(dev, 2);
@@ -153,7 +153,8 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	s->range_table = &range_fl512;
 	/* function to call when read AD */
 	s->insn_read = fl512_ai_insn;
-	printk(KERN_INFO "comedi: fl512: subdevice 0 initialized\n");
+	dev_info(dev->class_dev, "%s: subdevice 0 initialized\n",
+		dev->board_name);
 
 	/* Analog output */
 	s = dev->subdevices + 1;
@@ -171,7 +172,8 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	s->insn_write = fl512_ao_insn;
 	/* function to call when reading DA */
 	s->insn_read = fl512_ao_insn_readback;
-	printk(KERN_INFO "comedi: fl512: subdevice 1 initialized\n");
+	dev_info(dev->class_dev, "%s: subdevice 1 initialized\n",
+		dev->board_name);
 
 	return 1;
 }
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 12 lines · Bruce Humphrey

Replace printk(KERN_XXX with the appropiate dev_info, dev_warn, dev_dbg in fl512.c

---
 drivers/staging/comedi/drivers/fl512.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/staging/comedi/drivers/fl512.c +0 -0
index d1da809..5a8e0ae 100644

drivers/staging/comedi/drivers/fl512.c static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 121

Quoted 5 lines
drivers/staging/comedi/drivers/fl512.c +1 -1
@@ -118,9 +118,9 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	struct comedi_subdevice *s;
 
 	iobase = it->options[0];
-	printk(KERN_INFO "comedi:%d fl512: 0x%04lx", dev->minor, iobase);
+	dev_info(dev->class_dev, "%s: 0x%04lx\n", dev->board_name, iobase);

Only print this at the end when it succeeds.

drivers/staging/comedi/drivers/fl512.c static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 123

Quoted 3 lines
drivers/staging/comedi/drivers/fl512.c +1 -1
 	if (!request_region(iobase, FL512_SIZE, "fl512")) {
-		printk(KERN_WARNING " I/O port conflict\n");
+		dev_warn(dev->class_dev, " I/O port conflict\n");
                                          ^

Bogus space.

drivers/staging/comedi/drivers/fl512.c static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 133

Quoted 10 lines
drivers/staging/comedi/drivers/fl512.c +1 -1
 		return -EIO;
 	}
 	dev->iobase = iobase;
@@ -129,7 +129,7 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		return -ENOMEM;
 
 #if DEBUG
-	printk(KERN_DEBUG "malloc ok\n");
+	dev_dbg(dev->class_dev, "malloc ok\n");
 #endif

Remove this section.

drivers/staging/comedi/drivers/fl512.c static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 157

Quoted 9 lines
drivers/staging/comedi/drivers/fl512.c +2 -1
 	ret = comedi_alloc_subdevices(dev, 2);
@@ -153,7 +153,8 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	s->range_table = &range_fl512;
 	/* function to call when read AD */
 	s->insn_read = fl512_ai_insn;
-	printk(KERN_INFO "comedi: fl512: subdevice 0 initialized\n");
+	dev_info(dev->class_dev, "%s: subdevice 0 initialized\n",
+		dev->board_name);

Delete.

drivers/staging/comedi/drivers/fl512.c static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 176

Quoted 10 lines
drivers/staging/comedi/drivers/fl512.c +2 -1
 	/* Analog output */
 	s = dev->subdevices + 1;
@@ -171,7 +172,8 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	s->insn_write = fl512_ao_insn;
 	/* function to call when reading DA */
 	s->insn_read = fl512_ao_insn_readback;
-	printk(KERN_INFO "comedi: fl512: subdevice 1 initialized\n");
+	dev_info(dev->class_dev, "%s: subdevice 1 initialized\n",
+		dev->board_name);

Move the print from the start down to here. Re-word it. Copy from one that Hartley has worked on.

regards,
dan carpenter

Quoted 10 lines
drivers/staging/comedi/drivers/fl512.c +0 -0
 	return 1;
 }
Signature · 6 lines
1.7.9.5

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel