Commit bc8bf90a authored by Nick Robinson's avatar Nick Robinson Committed by Greg Kroah-Hartman
Browse files

Staging: comedi: Fix checpatch.pl issues in file rtd520.c



This patch fixes the checkpatch errors listed below:

ERROR: code indent should use tabs where possible
WARNING: space prohibited between function name and open parenthesis '('
WARNING: please, no spaces at the start of a line
WARNING: braces {} are not necessary for single statement blocks
WARNING: printk() should include KERN_ facility level

Signed-off-by: default avatarNick Robinson <nr33@msstate.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e80528b7
Loading
Loading
Loading
Loading
+157 −164
Original line number Diff line number Diff line
@@ -760,7 +760,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
	int index;
#endif

	printk("comedi%d: rtd520 attaching.\n", dev->minor);
	printk(KERN_INFO "comedi%d: rtd520 attaching.\n", dev->minor);

#if defined(CONFIG_COMEDI_DEBUG) && defined(USE_DMA)
	/* You can set this a load time: modprobe comedi comedi_debug=1 */
@@ -800,10 +800,10 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
	}
	if (!pcidev) {
		if (it->options[0] && it->options[1]) {
			printk("No RTD card at bus=%d slot=%d.\n",
			printk(KERN_INFO "No RTD card at bus=%d slot=%d.\n",
			       it->options[0], it->options[1]);
		} else {
			printk("No RTD card found.\n");
			printk(KERN_INFO "No RTD card found.\n");
		}
		return -EIO;
	}
@@ -812,7 +812,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)

	ret = comedi_pci_enable(pcidev, DRV_NAME);
	if (ret < 0) {
		printk("Failed to enable PCI device and request regions.\n");
		printk(KERN_INFO "Failed to enable PCI device and request regions.\n");
		return ret;
	}
	devpriv->got_regions = 1;
@@ -830,9 +830,9 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
	devpriv->las1 = ioremap_nocache(physLas1, LAS1_PCISIZE);
	devpriv->lcfg = ioremap_nocache(physLcfg, LCFG_PCISIZE);

	if (!devpriv->las0 || !devpriv->las1 || !devpriv->lcfg) {
	if (!devpriv->las0 || !devpriv->las1 || !devpriv->lcfg)
		return -ENOMEM;
	}


	DPRINTK("%s: LAS0=%llx, LAS1=%llx, CFG=%llx.\n", dev->board_name,
		(unsigned long long)physLas0, (unsigned long long)physLas1,
@@ -849,7 +849,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
		pci_read_config_byte(devpriv->pci_dev,
				     PCI_LATENCY_TIMER, &pci_latency);
		if (pci_latency < 32) {
			printk("%s: PCI latency changed from %d to %d\n",
			printk(KERN_INFO "%s: PCI latency changed from %d to %d\n",
			       dev->board_name, pci_latency, 32);
			pci_write_config_byte(devpriv->pci_dev,
					      PCI_LATENCY_TIMER, 32);
@@ -875,9 +875,9 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
	 * Allocate the subdevice structures.  alloc_subdevice() is a
	 * convenient macro defined in comedidev.h.
	 */
	if (alloc_subdevices(dev, 4) < 0) {
	if (alloc_subdevices(dev, 4) < 0)
		return -ENOMEM;
	}


	s = dev->subdevices + 0;
	dev->read_subdev = s;
@@ -887,11 +887,11 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
	    SDF_READABLE | SDF_GROUND | SDF_COMMON | SDF_DIFF | SDF_CMD_READ;
	s->n_chan = thisboard->aiChans;
	s->maxdata = (1 << thisboard->aiBits) - 1;
	if (thisboard->aiMaxGain <= 32) {
	if (thisboard->aiMaxGain <= 32)
		s->range_table = &rtd_ai_7520_range;
	} else {
	else
		s->range_table = &rtd_ai_4520_range;
	}

	s->len_chanlist = RTD_MAX_CHANLIST;	/* devpriv->fifoLen */
	s->insn_read = rtd_ai_rinsn;
	s->do_cmd = rtd_ai_cmd;
@@ -961,9 +961,9 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
	printk("( irq=%u )", dev->irq);

	ret = rtd520_probe_fifo_depth(dev);
	if (ret < 0) {
	if (ret < 0)
		return ret;
	}

	devpriv->fifoLen = ret;
	printk("( fifoLen=%d )", devpriv->fifoLen);

@@ -1028,7 +1028,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
		RtdDma0Mode(dev, DMA_MODE_BITS);
		RtdDma0Source(dev, DMAS_ADFIFO_HALF_FULL);	/* set DMA trigger source */
	} else {
		printk("( no IRQ->no DMA )");
		printk(KERN_INFO "( no IRQ->no DMA )");
	}
#endif /* USE_DMA */

@@ -1071,18 +1071,18 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
	}

	/* release all regions that were allocated */
	if (devpriv->las0) {
	if (devpriv->las0)
		iounmap(devpriv->las0);
	}
	if (devpriv->las1) {

	if (devpriv->las1)
		iounmap(devpriv->las1);
	}
	if (devpriv->lcfg) {

	if (devpriv->lcfg)
		iounmap(devpriv->lcfg);
	}
	if (devpriv->pci_dev) {

	if (devpriv->pci_dev)
		pci_dev_put(devpriv->pci_dev);
	}

	return ret;
#endif
}
@@ -1158,24 +1158,24 @@ static int rtd_detach(struct comedi_device *dev)
		}

		/* release all regions that were allocated */
		if (devpriv->las0) {
		if (devpriv->las0)
			iounmap(devpriv->las0);
		}
		if (devpriv->las1) {

		if (devpriv->las1)
			iounmap(devpriv->las1);
		}
		if (devpriv->lcfg) {

		if (devpriv->lcfg)
			iounmap(devpriv->lcfg);
		}

		if (devpriv->pci_dev) {
			if (devpriv->got_regions) {
			if (devpriv->got_regions)
				comedi_pci_disable(devpriv->pci_dev);
			}

			pci_dev_put(devpriv->pci_dev);
		}
	}

	printk("comedi%d: rtd520: removed.\n", dev->minor);
	printk(KERN_INFO "comedi%d: rtd520: removed.\n", dev->minor);

	return 0;
}
@@ -1275,13 +1275,13 @@ static int rtd520_probe_fifo_depth(struct comedi_device *dev)
		}
	}
	if (i == limit) {
		printk("\ncomedi: %s: failed to probe fifo size.\n", DRV_NAME);
		printk(KERN_INFO "\ncomedi: %s: failed to probe fifo size.\n", DRV_NAME);
		return -EIO;
	}
	RtdAdcClearFifo(dev);
	if (fifo_size != 0x400 && fifo_size != 0x2000) {
		printk
		    ("\ncomedi: %s: unexpected fifo size of %i, expected 1024 or 8192.\n",
		    (KERN_INFO "\ncomedi: %s: unexpected fifo size of %i, expected 1024 or 8192.\n",
		     DRV_NAME, fifo_size);
		return -EIO;
	}
@@ -1335,12 +1335,11 @@ static int rtd_ai_rinsn(struct comedi_device *dev,
		d = RtdAdcFifoGet(dev);	/* get 2s comp value */
		/*printk ("rtd520: Got 0x%x after %d usec\n", d, ii+1); */
		d = d >> 3;	/* low 3 bits are marker lines */
		if (CHAN_ARRAY_TEST(devpriv->chanBipolar, 0)) {
		if (CHAN_ARRAY_TEST(devpriv->chanBipolar, 0))
			data[n] = d + 2048;	/* convert to comedi unsigned data */
		} else {
		else
			data[n] = d;
	}
	}

	/* return the number of samples read/written */
	return n;
@@ -1375,11 +1374,11 @@ static int ai_read_n(struct comedi_device *dev, struct comedi_subdevice *s,
		d = RtdAdcFifoGet(dev);	/* get 2s comp value */

		d = d >> 3;	/* low 3 bits are marker lines */
		if (CHAN_ARRAY_TEST(devpriv->chanBipolar, s->async->cur_chan)) {
		if (CHAN_ARRAY_TEST(devpriv->chanBipolar, s->async->cur_chan))
			sample = d + 2048;	/* convert to comedi unsigned data */
		} else {
		else
			sample = d;
		}

		if (!comedi_buf_put(s->async, sample))
			return -1;

@@ -1403,11 +1402,11 @@ static int ai_read_dregs(struct comedi_device *dev, struct comedi_subdevice *s)
		}

		d = d >> 3;	/* low 3 bits are marker lines */
		if (CHAN_ARRAY_TEST(devpriv->chanBipolar, s->async->cur_chan)) {
		if (CHAN_ARRAY_TEST(devpriv->chanBipolar, s->async->cur_chan))
			sample = d + 2048;	/* convert to comedi unsigned data */
		} else {
		else
			sample = d;
		}

		if (!comedi_buf_put(s->async, sample))
			return -1;

@@ -1493,9 +1492,9 @@ static int ai_process_dma(struct comedi_device *dev, struct comedi_subdevice *s)

		if (CHAN_ARRAY_TEST(devpriv->chanBipolar, s->async->cur_chan)) {
			sample = (*dp >> 3) + 2048;	/* convert to comedi unsigned data */
		} else {
		else
			sample = *dp >> 3;	/* low 3 bits are marker lines */
		}

		*dp++ = sample;	/* put processed value back */

		if (++s->async->cur_chan >= s->async->cmd.chanlist_len)
@@ -1546,9 +1545,8 @@ static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */
	u16 fifoStatus;
	struct comedi_subdevice *s = dev->subdevices + 0;	/* analog in subdevice */

	if (!dev->attached) {
	if (!dev->attached)
		return IRQ_NONE;
	}

	devpriv->intCount++;	/* DEBUG statistics */

@@ -1594,9 +1592,8 @@ static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */

	status = RtdInterruptStatus(dev);
	/* if interrupt was not caused by our board, or handled above */
	if (0 == status) {
	if (0 == status)
		return IRQ_HANDLED;
	}

	if (status & IRQM_ADC_ABOUT_CNT) {	/* sample count -> read FIFO */
		/* since the priority interrupt controller may have queued a sample
@@ -1734,33 +1731,32 @@ static int rtd_ai_cmdtest(struct comedi_device *dev,

	tmp = cmd->start_src;
	cmd->start_src &= TRIG_NOW;
	if (!cmd->start_src || tmp != cmd->start_src) {
	if (!cmd->start_src || tmp != cmd->start_src)
		err++;
	}

	tmp = cmd->scan_begin_src;
	cmd->scan_begin_src &= TRIG_TIMER | TRIG_EXT;
	if (!cmd->scan_begin_src || tmp != cmd->scan_begin_src) {
	if (!cmd->scan_begin_src || tmp != cmd->scan_begin_src)
		err++;
	}


	tmp = cmd->convert_src;
	cmd->convert_src &= TRIG_TIMER | TRIG_EXT;
	if (!cmd->convert_src || tmp != cmd->convert_src) {
	if (!cmd->convert_src || tmp != cmd->convert_src)
		err++;
	}


	tmp = cmd->scan_end_src;
	cmd->scan_end_src &= TRIG_COUNT;
	if (!cmd->scan_end_src || tmp != cmd->scan_end_src) {
	if (!cmd->scan_end_src || tmp != cmd->scan_end_src)
		err++;
	}


	tmp = cmd->stop_src;
	cmd->stop_src &= TRIG_COUNT | TRIG_NONE;
	if (!cmd->stop_src || tmp != cmd->stop_src) {
	if (!cmd->stop_src || tmp != cmd->stop_src)
		err++;
	}


	if (err)
		return 1;
@@ -1772,16 +1768,14 @@ static int rtd_ai_cmdtest(struct comedi_device *dev,
	    cmd->scan_begin_src != TRIG_EXT) {
		err++;
	}
	if (cmd->convert_src != TRIG_TIMER && cmd->convert_src != TRIG_EXT) {
	if (cmd->convert_src != TRIG_TIMER && cmd->convert_src != TRIG_EXT)
		err++;
	}
	if (cmd->stop_src != TRIG_COUNT && cmd->stop_src != TRIG_NONE) {

	if (cmd->stop_src != TRIG_COUNT && cmd->stop_src != TRIG_NONE)
		err++;
	}

	if (err) {
	if (err)
		return 2;
	}

	/* step 3: make sure arguments are trivially compatible */

@@ -1882,9 +1876,9 @@ static int rtd_ai_cmdtest(struct comedi_device *dev,
		}
	}

	if (err) {
	if (err)
		return 3;
	}


	/* step 4: fix up any arguments */

@@ -1896,17 +1890,17 @@ static int rtd_ai_cmdtest(struct comedi_device *dev,
		tmp = cmd->scan_begin_arg;
		rtd_ns_to_timer(&cmd->scan_begin_arg,
				cmd->flags & TRIG_ROUND_MASK);
		if (tmp != cmd->scan_begin_arg) {
		if (tmp != cmd->scan_begin_arg)
			err++;
		}

	}
	if (cmd->convert_src == TRIG_TIMER) {
		tmp = cmd->convert_arg;
		rtd_ns_to_timer(&cmd->convert_arg,
				cmd->flags & TRIG_ROUND_MASK);
		if (tmp != cmd->convert_arg) {
		if (tmp != cmd->convert_arg)
			err++;
		}

		if (cmd->scan_begin_src == TRIG_TIMER
		    && (cmd->scan_begin_arg
			< (cmd->convert_arg * cmd->scan_end_arg))) {
@@ -1916,9 +1910,8 @@ static int rtd_ai_cmdtest(struct comedi_device *dev,
		}
	}

	if (err) {
	if (err)
		return 4;
	}

	return 0;
}
@@ -2267,9 +2260,9 @@ static int rtd_ao_rinsn(struct comedi_device *dev,
	int i;
	int chan = CR_CHAN(insn->chanspec);

	for (i = 0; i < insn->n; i++) {
	for (i = 0; i < insn->n; i++)
		data[i] = devpriv->aoValue[chan];
	}


	return i;
}