Skip to contentSkip to conversation

Staging: comedi: ssv_snp: fix checkpatch.pl warnings

PATCH In review Güngör Erseymen 2 participants 3 messages Aug 9, 2012 – Aug 10, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: comedi: ssv_snp: fix checkpatch.pl warnings

Fix two checkpatch.pl warnings about printk issues by using pr_info(...) instead of printk(KERN_INFO, ...).

---
 drivers/staging/comedi/drivers/ssv_dnp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/comedi/drivers/ssv_dnp.c +2 -2
index 84b9f2a..4cd0f1b 100644
@@ -177,7 +177,7 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	struct comedi_subdevice *s;
 	int ret;
 
-	printk(KERN_INFO "comedi%d: dnp: ", dev->minor);
+	pr_info("comedi%d: dnp: ", dev->minor);
 
 	dev->board_name = board->name;
 
@@ -195,7 +195,7 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	s->insn_bits = dnp_dio_insn_bits;
 	s->insn_config = dnp_dio_insn_config;
 
-	printk("attached\n");
+	pr_info("attached\n");
 
 	/* We use the I/O ports 0x22,0x23 and 0xa3-0xa9, which are always
 	 * allocated for the primary 8259, so we don't need to allocate them
Signature · 1 line
1.7.11.4
#1 lore raw
Quoted 7 lines · Güngör Erseymen

Fix two checkpatch.pl warnings about printk issues by using pr_info(...) instead of printk(KERN_INFO, ...).

---
 drivers/staging/comedi/drivers/ssv_dnp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Hello Güngör,

You have a typo in the subject for this patch.
"ssv_snp" should be "ssv_dnp"

drivers/staging/comedi/drivers/ssv_dnp.c static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 180

Quoted 11 lines
drivers/staging/comedi/drivers/ssv_dnp.c +1 -1
index 84b9f2a..4cd0f1b 100644
@@ -177,7 +177,7 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	struct comedi_subdevice *s;
 	int ret;
 
-	printk(KERN_INFO "comedi%d: dnp: ", dev->minor);
+	pr_info("comedi%d: dnp: ", dev->minor);

Where possible, fixes like this should use the dev_printk versions. For instance, this one would be:

	dev_info(dev->class_dev, "dnp:");

But, there is a cleaner fix for this file. See below.

drivers/staging/comedi/drivers/ssv_dnp.c static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 198

Quoted 8 lines
drivers/staging/comedi/drivers/ssv_dnp.c +1 -1
 	dev->board_name = board->name;
 
@@ -195,7 +195,7 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	s->insn_bits = dnp_dio_insn_bits;
 	s->insn_config = dnp_dio_insn_config;
 
-	printk("attached\n");
+	pr_info("attached\n");

There are only two printk's in this file, both in the "attach" routine.

The first one does not have a "\n" and the function could exit without ever terminating the message.

A better fix would be to merge the two messages into one "attached" message at the end of the function. You could also use the dev->board_name instead of the open coded string. Something like:

	dev_info(dev->class_dev, "%s: attached\n", dev->board_name);

Also, the message should be moved so that it's the last thing that happens before the function returns.

Regards,
Hartley

Quoted 3 lines
drivers/staging/comedi/drivers/ssv_dnp.c +0 -0
 	/* We use the I/O ports 0x22,0x23 and 0xa3-0xa9, which are always
 	 * allocated for the primary 8259, so we don't need to allocate them
Signature · 3 lines
1.7.11.4

���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
#2 lore raw
Quoted 2 lines · H Hartley Sweeten

You have a typo in the subject for this patch.
"ssv_snp" should be "ssv_dnp"

Hello Hartley,

I missed that typo. This is my first patch for linux kernel, i am a bit nervous.

Quoted 32 lines

drivers/staging/comedi/drivers/ssv_dnp.c static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 180

Quoted 10 lines
drivers/staging/comedi/drivers/ssv_dnp.c +1 -1
index 84b9f2a..4cd0f1b 100644
@@ -177,7 +177,7 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it)
      struct comedi_subdevice *s;
      int ret;
 
-     printk(KERN_INFO "comedi%d: dnp: ", dev->minor);
+     pr_info("comedi%d: dnp: ", dev->minor);

Where possible, fixes like this should use the dev_printk versions. For instance, this one would be:

        dev_info(dev->class_dev, "dnp:");

But, there is a cleaner fix for this file. See below.

drivers/staging/comedi/drivers/ssv_dnp.c static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 198

Quoted 8 lines
drivers/staging/comedi/drivers/ssv_dnp.c +1 -1
      dev->board_name = board->name;
 
@@ -195,7 +195,7 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it)
      s->insn_bits = dnp_dio_insn_bits;
      s->insn_config = dnp_dio_insn_config;
 
-     printk("attached\n");
+     pr_info("attached\n");

There are only two printk's in this file, both in the "attach" routine.

The first one does not have a "\n" and the function could exit without ever terminating the message.

Quoted 8 lines

A better fix would be to merge the two messages into one "attached" message at the end of the function. You could also use the dev->board_name instead of the open coded string. Something like:

        dev_info(dev->class_dev, "%s: attached\n", dev->board_name);

Also, the message should be moved so that it's the last thing that happens before the function returns.

Thanks for advice, i will send a new patch with changes.