Commit b8c623e5 authored by Iain Churcher's avatar Iain Churcher Committed by Greg Kroah-Hartman

Staging: comedi: Fix Checkpatch.pl issues in mpc624.c

This patch resolves all checkpatch.pl issues in the mpc624.c file
Signed-off-by: default avatarIain Churcher <iain.linux.coding@googlemail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 3b87d0aa
......@@ -115,18 +115,21 @@ Configuration Options:
#define MPC624_SPEED_440_Hz (MPC624_OSR4 | MPC624_OSR2)
#define MPC624_SPEED_220_Hz (MPC624_OSR4 | MPC624_OSR2 | MPC624_OSR0)
#define MPC624_SPEED_110_Hz (MPC624_OSR4 | MPC624_OSR2 | MPC624_OSR1)
#define MPC624_SPEED_55_Hz (MPC624_OSR4 | MPC624_OSR2 | MPC624_OSR1 | MPC624_OSR0)
#define MPC624_SPEED_55_Hz \
(MPC624_OSR4 | MPC624_OSR2 | MPC624_OSR1 | MPC624_OSR0)
#define MPC624_SPEED_27_5_Hz (MPC624_OSR4 | MPC624_OSR3)
#define MPC624_SPEED_13_75_Hz (MPC624_OSR4 | MPC624_OSR3 | MPC624_OSR0)
#define MPC624_SPEED_6_875_Hz (MPC624_OSR4 | MPC624_OSR3 | MPC624_OSR2 | MPC624_OSR1 | MPC624_OSR0)
/* ---------------------------------------------------------------------------- */
#define MPC624_SPEED_6_875_Hz \
(MPC624_OSR4 | MPC624_OSR3 | MPC624_OSR2 | MPC624_OSR1 | MPC624_OSR0)
/* -------------------------------------------------------------------------- */
struct skel_private {
unsigned long int ulConvertionRate; /* set by mpc624_attach() from driver's parameters */
/* set by mpc624_attach() from driver's parameters */
unsigned long int ulConvertionRate;
};
#define devpriv ((struct skel_private *)dev->private)
/* ---------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
static const struct comedi_lrange range_mpc624_bipolar1 = {
1,
{
......@@ -145,11 +148,11 @@ static const struct comedi_lrange range_mpc624_bipolar10 = {
}
};
/* ---------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
static int mpc624_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int mpc624_detach(struct comedi_device *dev);
/* ---------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
static struct comedi_driver driver_mpc624 = {
.driver_name = "mpc624",
.module = THIS_MODULE,
......@@ -157,20 +160,20 @@ static struct comedi_driver driver_mpc624 = {
.detach = mpc624_detach
};
/* ---------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
static int mpc624_ai_rinsn(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn,
unsigned int *data);
/* ---------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
struct comedi_subdevice *s;
unsigned long iobase;
iobase = it->options[0];
printk("comedi%d: mpc624 [0x%04lx, ", dev->minor, iobase);
printk(KERN_INFO "comedi%d: mpc624 [0x%04lx, ", dev->minor, iobase);
if (request_region(iobase, MPC624_SIZE, "mpc624") == NULL) {
printk("I/O port(s) in use\n");
printk(KERN_ERR "I/O port(s) in use\n");
return -EIO;
}
......@@ -184,47 +187,48 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it)
switch (it->options[1]) {
case 0:
devpriv->ulConvertionRate = MPC624_SPEED_3_52_kHz;
printk("3.52 kHz, ");
printk(KERN_INFO "3.52 kHz, ");
break;
case 1:
devpriv->ulConvertionRate = MPC624_SPEED_1_76_kHz;
printk("1.76 kHz, ");
printk(KERN_INFO "1.76 kHz, ");
break;
case 2:
devpriv->ulConvertionRate = MPC624_SPEED_880_Hz;
printk("880 Hz, ");
printk(KERN_INFO "880 Hz, ");
break;
case 3:
devpriv->ulConvertionRate = MPC624_SPEED_440_Hz;
printk("440 Hz, ");
printk(KERN_INFO "440 Hz, ");
break;
case 4:
devpriv->ulConvertionRate = MPC624_SPEED_220_Hz;
printk("220 Hz, ");
printk(KERN_INFO "220 Hz, ");
break;
case 5:
devpriv->ulConvertionRate = MPC624_SPEED_110_Hz;
printk("110 Hz, ");
printk(KERN_INFO "110 Hz, ");
break;
case 6:
devpriv->ulConvertionRate = MPC624_SPEED_55_Hz;
printk("55 Hz, ");
printk(KERN_INFO "55 Hz, ");
break;
case 7:
devpriv->ulConvertionRate = MPC624_SPEED_27_5_Hz;
printk("27.5 Hz, ");
printk(KERN_INFO "27.5 Hz, ");
break;
case 8:
devpriv->ulConvertionRate = MPC624_SPEED_13_75_Hz;
printk("13.75 Hz, ");
printk(KERN_INFO "13.75 Hz, ");
break;
case 9:
devpriv->ulConvertionRate = MPC624_SPEED_6_875_Hz;
printk("6.875 Hz, ");
printk(KERN_INFO "6.875 Hz, ");
break;
default:
printk
("illegal convertion rate setting! Valid numbers are 0..9. Using 9 => 6.875 Hz, ");
(KERN_ERR "illegal convertion rate setting!"
" Valid numbers are 0..9. Using 9 => 6.875 Hz, ");
devpriv->ulConvertionRate = MPC624_SPEED_3_52_kHz;
}
......@@ -239,29 +243,29 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it)
switch (it->options[1]) {
default:
s->maxdata = 0x3FFFFFFF;
printk("30 bit, ");
printk(KERN_INFO "30 bit, ");
}
switch (it->options[1]) {
case 0:
s->range_table = &range_mpc624_bipolar1;
printk("1.01V]: ");
printk(KERN_INFO "1.01V]: ");
break;
default:
s->range_table = &range_mpc624_bipolar10;
printk("10.1V]: ");
printk(KERN_INFO "10.1V]: ");
}
s->len_chanlist = 1;
s->insn_read = mpc624_ai_rinsn;
printk("attached\n");
printk(KERN_INFO "attached\n");
return 1;
}
static int mpc624_detach(struct comedi_device *dev)
{
printk("comedi%d: mpc624: remove\n", dev->minor);
printk(KERN_INFO "comedi%d: mpc624: remove\n", dev->minor);
if (dev->iobase)
release_region(dev->iobase, MPC624_SIZE);
......@@ -280,11 +284,14 @@ static int mpc624_ai_rinsn(struct comedi_device *dev,
unsigned long int data_in, data_out;
unsigned char ucPort;
/* WARNING: We always write 0 to GNSWA bit, so the channel range is +-/10.1Vdc */
/*
* WARNING:
* We always write 0 to GNSWA bit, so the channel range is +-/10.1Vdc
*/
outb(insn->chanspec, dev->iobase + MPC624_GNMUXCH);
/* printk("Channel %d: \n", insn->chanspec); */
/* printk("Channel %d:\n", insn->chanspec); */
if (!insn->n) {
printk("MPC624: Warning, no data to acquire\n");
printk(KERN_INFO "MPC624: Warning, no data to acquire\n");
return 0;
}
......@@ -306,7 +313,7 @@ static int mpc624_ai_rinsn(struct comedi_device *dev,
break;
}
if (i == TIMEOUT) {
printk("MPC624: timeout (%dms)\n", TIMEOUT);
printk(KERN_ERR "MPC624: timeout (%dms)\n", TIMEOUT);
data[n] = 0;
return -ETIMEDOUT;
}
......@@ -344,31 +351,47 @@ static int mpc624_ai_rinsn(struct comedi_device *dev,
data_out <<= 1;
}
/* Received 32-bit long value consist of: */
/* 31: EOC (End Of Transmission) bit - should be 0 */
/* 30: DMY (Dummy) bit - should be 0 */
/* 29: SIG (Sign) bit - 1 if the voltage is positive, 0 if negative */
/* 28: MSB (Most Significant Bit) - the first bit of convertion result */
/* .... */
/* 05: LSB (Least Significant Bit) - the last bit of convertion result */
/* 04: sub-LSB - sub-LSBs are basically noise, but when */
/* 03: sub-LSB averaged properly, they can increase convertion */
/* 02: sub-LSB precision up to 29 bits; they can be discarded */
/* 01: sub-LSB without loss of resolution. */
/* 00: sub-LSB */
/*
* Received 32-bit long value consist of:
* 31: EOC -
* (End Of Transmission) bit - should be 0
* 30: DMY
* (Dummy) bit - should be 0
* 29: SIG
* (Sign) bit- 1 if the voltage is positive,
* 0 if negative
* 28: MSB
* (Most Significant Bit) - the first bit of
* the conversion result
* ....
* 05: LSB
* (Least Significant Bit)- the last bit of the
* conversion result
* 04-00: sub-LSB
* - sub-LSBs are basically noise, but when
* averaged properly, they can increase conversion
* precision up to 29 bits; they can be discarded
* without loss of resolution.
*/
if (data_in & MPC624_EOC_BIT)
printk("MPC624: EOC bit is set (data_in=%lu)!",
printk(KERN_INFO "MPC624:EOC bit is set (data_in=%lu)!",
data_in);
if (data_in & MPC624_DMY_BIT)
printk("MPC624: DMY bit is set (data_in=%lu)!",
printk(KERN_INFO "MPC624:DMY bit is set (data_in=%lu)!",
data_in);
if (data_in & MPC624_SGN_BIT) { /* check the sign bit *//* The voltage is positive */
data_in &= 0x3FFFFFFF; /* EOC and DMY should be 0, but we will mask them out just to be sure */
data[n] = data_in; /* comedi operates on unsigned numbers, so we don't clear the SGN bit */
/* SGN bit is still set! It's correct, since we're converting to unsigned. */
if (data_in & MPC624_SGN_BIT) { /* Volatge is positive */
/*
* comedi operates on unsigned numbers, so mask off EOC
* and DMY and don't clear the SGN bit
*/
data_in &= 0x3FFFFFFF;
data[n] = data_in;
} else { /* The voltage is negative */
/* data_in contains a number in 30-bit two's complement code and we must deal with it */
/*
* data_in contains a number in 30-bit two's complement
* code and we must deal with it
*/
data_in |= MPC624_SGN_BIT;
data_in = ~data_in;
data_in += 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment