Skip to contentSkip to conversation

Staging: comedi: fix over 80 character coding style issues in ni_labpc.c

PATCH In review Maurice Dawson 3 participants 3 messages May 29, 2010 – Jun 17, 2010 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: comedi: fix over 80 character coding style issues in ni_labpc.c

This is a patch to the ni_labpc.c file that fixes most over 80 character warnings found by the checkpatch.pl tool. Two lines, 4 and 1035 have not been changed because readability is better and no information is hidden

---
 drivers/staging/comedi/drivers/ni_labpc.c |   81 ++++++++++++++++++++---------
 1 files changed, 57 insertions(+), 24 deletions(-)
drivers/staging/comedi/drivers/ni_labpc.c +57 -24
index 67c8a53..bf063ad 100644
@@ -738,7 +738,8 @@ static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		break;
 	case pcmcia_bustype:
 		printk
-		    (" this driver does not support pcmcia cards, use ni_labpc_cs.o\n");
+		    ("this driver does not support pcmcia cards, "
+							"use ni_labpc_cs.o\n");
 		return -EINVAL;
 		break;
 	default:
@@ -866,8 +867,9 @@ static int labpc_ai_chanlist_invalid(const struct comedi_device *dev,
 
 	if (mode == MODE_SINGLE_CHAN_INTERVAL) {
 		if (cmd->chanlist_len > 0xff) {
-			comedi_error(dev,
-				     "ni_labpc: chanlist too long for single channel interval mode\n");
+			comedi_error(dev, "ni_labpc: chanlist too long "
+							"for single channel "
+							"interval mode\n");
 			return 1;
 		}
 	}
@@ -881,23 +883,29 @@ static int labpc_ai_chanlist_invalid(const struct comedi_device *dev,
 		switch (mode) {
 		case MODE_SINGLE_CHAN_INTERVAL:
 			if (CR_CHAN(cmd->chanlist[i]) != channel) {
-				comedi_error(dev,
-					     "channel scanning order specified in chanlist is not supported by hardware.\n");
+				comedi_error(dev, "channel scanning order "
+							"specified in chanlist "
+							"is not supported "
+							"by hardware.\n");
 				return 1;
 			}
 			break;
 		case MODE_MULT_CHAN_UP:
 			if (CR_CHAN(cmd->chanlist[i]) != i) {
-				comedi_error(dev,
-					     "channel scanning order specified in chanlist is not supported by hardware.\n");
+				comedi_error(dev, "channel scanning order "
+							"specified in chanlist "
+							"is not supported "
+							"by hardware.\n");
 				return 1;
 			}
 			break;
 		case MODE_MULT_CHAN_DOWN:
 			if (CR_CHAN(cmd->chanlist[i]) !=
 			    cmd->chanlist_len - i - 1) {
-				comedi_error(dev,
-					     "channel scanning order specified in chanlist is not supported by hardware.\n");
+				comedi_error(dev, "channel scanning order "
+							"specified in chanlist "
+							"is not supported "
+							"by hardware.\n");
 				return 1;
 			}
 			break;
@@ -908,14 +916,14 @@ static int labpc_ai_chanlist_invalid(const struct comedi_device *dev,
 		}
 
 		if (CR_RANGE(cmd->chanlist[i]) != range) {
-			comedi_error(dev,
-				     "entries in chanlist must all have the same range\n");
+			comedi_error(dev, "entries in chanlist must all have "
+							"the same range\n");
 			return 1;
 		}
 
 		if (CR_AREF(cmd->chanlist[i]) != aref) {
-			comedi_error(dev,
-				     "entries in chanlist must all have the same reference\n");
+			comedi_error(dev, "entries in chanlist must all have "
+							"the same reference\n");
 			return 1;
 		}
 	}
@@ -1096,7 +1104,10 @@ static int labpc_ai_cmdtest(struct comedi_device *dev,
 			err++;
 		}
 		break;
-		/*  TRIG_EXT doesn't care since it doesn't trigger off a numbered channel */
+		/*
+		 * TRIG_EXT doesn't care since it doesn't
+		 * trigger off a numbered channel
+		 */
 	default:
 		break;
 	}
@@ -1154,25 +1165,36 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 
 	/*  setup hardware conversion counter */
 	if (cmd->stop_src == TRIG_EXT) {
-		/*  load counter a1 with count of 3 (pc+ manual says this is minimum allowed) using mode 0 */
+		/*
+		 * load counter a1 with count of 3
+		 * (pc+ manual says this is minimum allowed)
+		 * using mode 0
+		 */
 		ret = labpc_counter_load(dev, dev->iobase + COUNTER_A_BASE_REG,
 					 1, 3, 0);
 		if (ret < 0) {
 			comedi_error(dev, "error loading counter a1");
 			return -1;
 		}
-	} else			/*  otherwise, just put a1 in mode 0 with no count to set its output low */
+	} else			/*
+				 * otherwise, just put a1 in mode 0
+				 * with no count to set its output low
+				 */
 		devpriv->write_byte(INIT_A1_BITS,
 				    dev->iobase + COUNTER_A_CONTROL_REG);
 
 	/*  figure out what method we will use to transfer data */
 	if (devpriv->dma_chan &&	/*  need a dma channel allocated */
-	    /*  dma unsafe at RT priority, and too much setup time for TRIG_WAKE_EOS for */
+		/*
+		 * dma unsafe at RT priority,
+		 * and too much setup time for TRIG_WAKE_EOS for
+		 */
 	    (cmd->flags & (TRIG_WAKE_EOS | TRIG_RT)) == 0 &&
 	    /*  only available on the isa boards */
 	    thisboard->bustype == isa_bustype) {
 		xfer = isa_dma_transfer;
-	} else if (thisboard->register_layout == labpc_1200_layout &&	/*  pc-plus has no fifo-half full interrupt */
+		/* pc-plus has no fifo-half full interrupt */
+	} else if (thisboard->register_layout == labpc_1200_layout &&
 		   /*  wake-end-of-scan should interrupt on fifo not empty */
 		   (cmd->flags & TRIG_WAKE_EOS) == 0 &&
 		   /*  make sure we are taking more than just a few points */
@@ -1259,7 +1281,8 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 	devpriv->write_byte(INTERVAL_LOAD_BITS,
 			    dev->iobase + INTERVAL_LOAD_REG);
 
-	if (cmd->convert_src == TRIG_TIMER || cmd->scan_begin_src == TRIG_TIMER) {
+	if (cmd->convert_src == TRIG_TIMER ||
+					cmd->scan_begin_src == TRIG_TIMER) {
 		/*  set up pacing */
 		labpc_adc_timing(dev, cmd);
 		/*  load counter b0 in mode 3 */
@@ -1619,7 +1642,10 @@ static int labpc_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
 		devpriv->command4_bits |= ADC_DIFF_BIT;
 	devpriv->write_byte(devpriv->command4_bits, dev->iobase + COMMAND4_REG);
 
-	/* initialize pacer counter output to make sure it doesn't cause any problems */
+	/*
+	 * initialize pacer counter output
+	 * to make sure it doesn't cause any problems
+	 */
 	devpriv->write_byte(INIT_A0_BITS, dev->iobase + COUNTER_A_CONTROL_REG);
 
 	labpc_clear_adc_fifo(dev);
@@ -1733,8 +1759,9 @@ static int labpc_eeprom_write_insn(struct comedi_device *dev,
 
 	/*  only allow writes to user area of eeprom */
 	if (channel < 16 || channel > 127) {
-		printk
-		    ("eeprom writes are only allowed to channels 16 through 127 (the pointer and user areas)");
+		printk(kERN_ERR "eeprom writes are only allowed to "
+						"channels 16 through 127 "
+						"(the pointer and user areas)");
 		return -EINVAL;
 	}
 
@@ -1844,7 +1871,10 @@ static void labpc_adc_timing(struct comedi_device *dev, struct comedi_cmd *cmd)
 		unsigned int scan_period;
 
 		scan_period = labpc_ai_scan_period(cmd);
-		/* calculate cascaded counter values that give desired scan timing */
+		/*
+		 * calculate cascaded counter values
+		 * that give desired scan timing
+		 */
 		i8253_cascade_ns_to_timer_2div(LABPC_TIMER_BASE,
 					       &(devpriv->divisor_b1),
 					       &(devpriv->divisor_b0),
@@ -1855,7 +1885,10 @@ static void labpc_adc_timing(struct comedi_device *dev, struct comedi_cmd *cmd)
 		unsigned int convert_period;
 
 		convert_period = labpc_ai_convert_period(cmd);
-		/* calculate cascaded counter values that give desired conversion timing */
+		/*
+		 * calculate cascaded counter values
+		 * that give desired conversion timing
+		 */
 		i8253_cascade_ns_to_timer_2div(LABPC_TIMER_BASE,
 					       &(devpriv->divisor_a0),
 					       &(devpriv->divisor_b0),
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 12 lines · Maurice Dawson

This is a patch to the ni_labpc.c file that fixes most over 80 character warnings found by the checkpatch.pl tool. Two lines, 4 and 1035 have not been changed because readability is better and no information is hidden

---
 drivers/staging/comedi/drivers/ni_labpc.c |   81 ++++++++++++++++++++---------
 1 files changed, 57 insertions(+), 24 deletions(-)
drivers/staging/comedi/drivers/ni_labpc.c +0 -0
index 67c8a53..bf063ad 100644

drivers/staging/comedi/drivers/ni_labpc.c static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 742

Quoted 6 lines
drivers/staging/comedi/drivers/ni_labpc.c +2 -1
@@ -738,7 +738,8 @@ static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		break;
 	case pcmcia_bustype:
 		printk
-		    (" this driver does not support pcmcia cards, use ni_labpc_cs.o\n");
+		    ("this driver does not support pcmcia cards, "
+							"use ni_labpc_cs.o\n");

Ick, no, don't break these types of strings. Newer versions of checkpatch will not complain about this.

drivers/staging/comedi/drivers/ni_labpc.c static int labpc_ai_chanlist_invalid(const struct comedi_device *dev, · line 872

Quoted 7 lines
drivers/staging/comedi/drivers/ni_labpc.c +3 -2
 	if (mode == MODE_SINGLE_CHAN_INTERVAL) {
 		if (cmd->chanlist_len > 0xff) {
-			comedi_error(dev,
-				     "ni_labpc: chanlist too long for single channel interval mode\n");
+			comedi_error(dev, "ni_labpc: chanlist too long "
+							"for single channel "
+							"interval mode\n");

Same here, don't do this.

drivers/staging/comedi/drivers/ni_labpc.c static int labpc_ai_chanlist_invalid(const struct comedi_device *dev, · line 889

Quoted 13 lines
drivers/staging/comedi/drivers/ni_labpc.c +4 -2
 			return 1;
 		}
 	}
@@ -881,23 +883,29 @@ static int labpc_ai_chanlist_invalid(const struct comedi_device *dev,
 		switch (mode) {
 		case MODE_SINGLE_CHAN_INTERVAL:
 			if (CR_CHAN(cmd->chanlist[i]) != channel) {
-				comedi_error(dev,
-					     "channel scanning order specified in chanlist is not supported by hardware.\n");
+				comedi_error(dev, "channel scanning order "
+							"specified in chanlist "
+							"is not supported "
+							"by hardware.\n");

Nor here.

drivers/staging/comedi/drivers/ni_labpc.c static int labpc_ai_chanlist_invalid(const struct comedi_device *dev, · line 898

Quoted 11 lines
drivers/staging/comedi/drivers/ni_labpc.c +4 -2
 				return 1;
 			}
 			break;
 		case MODE_MULT_CHAN_UP:
 			if (CR_CHAN(cmd->chanlist[i]) != i) {
-				comedi_error(dev,
-					     "channel scanning order specified in chanlist is not supported by hardware.\n");
+				comedi_error(dev, "channel scanning order "
+							"specified in chanlist "
+							"is not supported "
+							"by hardware.\n");

Or here.

drivers/staging/comedi/drivers/ni_labpc.c static int labpc_ai_chanlist_invalid(const struct comedi_device *dev, · line 908

Quoted 12 lines
drivers/staging/comedi/drivers/ni_labpc.c +4 -2
 				return 1;
 			}
 			break;
 		case MODE_MULT_CHAN_DOWN:
 			if (CR_CHAN(cmd->chanlist[i]) !=
 			    cmd->chanlist_len - i - 1) {
-				comedi_error(dev,
-					     "channel scanning order specified in chanlist is not supported by hardware.\n");
+				comedi_error(dev, "channel scanning order "
+							"specified in chanlist "
+							"is not supported "
+							"by hardware.\n");

Or here, or the rest of the printk() lines.

Care to resend this without those types of changes?

thanks,

greg k-h

#2 lore raw
Quoted 17 lines · Greg KH

drivers/staging/comedi/drivers/ni_labpc.c static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 742

Quoted 13 lines · Maurice Dawson

This is a patch to the ni_labpc.c file that fixes most over 80 character warnings found by the checkpatch.pl tool. Two lines, 4 and 1035 have not been changed because readability is better and no information is hidden

drivers/staging/comedi/drivers/ni_labpc.c +2 -1
@@ -738,7 +738,8 @@ static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		break;
 	case pcmcia_bustype:
 		printk
-		    (" this driver does not support pcmcia cards, use ni_labpc_cs.o\n");
+		    ("this driver does not support pcmcia cards, "
+							"use ni_labpc_cs.o\n");

Ick, no, don't break these types of strings. Newer versions of checkpatch will not complain about this.

Hi Greg.

Unfortunately, currently checkpatch will complain about this sort of line because the format string is not on the same line as the printk.

This line should become something like:

		pr_err(" this driver does not support pcmcia cards, use ni_labpc_cs\n");
or
		comedi_err(etc...);

if ever the comedi_<level> printk helper macros are accepted.