mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-10 22:54:11 +08:00
Staging: comedi: amplc_dio200: Checkpatch cleanups
This fixes all checkpatch issues in the amplc_dio200 comedi driver. Signed-off-by: Benjamin Adolphi <b.adolphi@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
e20ad20d84
commit
669c930c8f
@ -48,8 +48,8 @@ Passing a zero for an option is the same as leaving it unspecified.
|
|||||||
|
|
||||||
SUBDEVICES
|
SUBDEVICES
|
||||||
|
|
||||||
PC218E PC212E PC215E/PCI215
|
PC218E PC212E PC215E/PCI215
|
||||||
------------- ------------- -------------
|
------------- ------------- -------------
|
||||||
Subdevices 7 6 5
|
Subdevices 7 6 5
|
||||||
0 CTR-X1 PPI-X PPI-X
|
0 CTR-X1 PPI-X PPI-X
|
||||||
1 CTR-X2 CTR-Y1 PPI-Y
|
1 CTR-X2 CTR-Y1 PPI-Y
|
||||||
@ -59,8 +59,8 @@ SUBDEVICES
|
|||||||
5 CTR-Z2 INTERRUPT
|
5 CTR-Z2 INTERRUPT
|
||||||
6 INTERRUPT
|
6 INTERRUPT
|
||||||
|
|
||||||
PC214E PC272E/PCI272
|
PC214E PC272E/PCI272
|
||||||
------------- -------------
|
------------- -------------
|
||||||
Subdevices 4 4
|
Subdevices 4 4
|
||||||
0 PPI-X PPI-X
|
0 PPI-X PPI-X
|
||||||
1 PPI-Y PPI-Y
|
1 PPI-Y PPI-Y
|
||||||
@ -96,8 +96,8 @@ instructions are supported:
|
|||||||
0 to 7 as follows:
|
0 to 7 as follows:
|
||||||
|
|
||||||
0. CLK n, the counter channel's dedicated CLK input from the SK1
|
0. CLK n, the counter channel's dedicated CLK input from the SK1
|
||||||
connector. (N.B. for other values, the counter channel's CLKn
|
connector. (N.B. for other values, the counter channel's CLKn
|
||||||
pin on the SK1 connector is an output!)
|
pin on the SK1 connector is an output!)
|
||||||
1. Internal 10 MHz clock.
|
1. Internal 10 MHz clock.
|
||||||
2. Internal 1 MHz clock.
|
2. Internal 1 MHz clock.
|
||||||
3. Internal 100 kHz clock.
|
3. Internal 100 kHz clock.
|
||||||
@ -105,8 +105,8 @@ instructions are supported:
|
|||||||
5. Internal 1 kHz clock.
|
5. Internal 1 kHz clock.
|
||||||
6. OUT n-1, the output of counter channel n-1 (see note 1 below).
|
6. OUT n-1, the output of counter channel n-1 (see note 1 below).
|
||||||
7. Ext Clock, the counter chip's dedicated Ext Clock input from
|
7. Ext Clock, the counter chip's dedicated Ext Clock input from
|
||||||
the SK1 connector. This pin is shared by all three counter
|
the SK1 connector. This pin is shared by all three counter
|
||||||
channels on the chip.
|
channels on the chip.
|
||||||
|
|
||||||
INSN_CONFIG_GET_CLOCK_SRC. Returns the counter channel's current
|
INSN_CONFIG_GET_CLOCK_SRC. Returns the counter channel's current
|
||||||
clock source in data[1]. For internal clock sources, data[2] is set
|
clock source in data[1]. For internal clock sources, data[2] is set
|
||||||
@ -120,10 +120,10 @@ instructions are supported:
|
|||||||
0. VCC (internal +5V d.c.), i.e. gate permanently enabled.
|
0. VCC (internal +5V d.c.), i.e. gate permanently enabled.
|
||||||
1. GND (internal 0V d.c.), i.e. gate permanently disabled.
|
1. GND (internal 0V d.c.), i.e. gate permanently disabled.
|
||||||
2. GAT n, the counter channel's dedicated GAT input from the SK1
|
2. GAT n, the counter channel's dedicated GAT input from the SK1
|
||||||
connector. (N.B. for other values, the counter channel's GATn
|
connector. (N.B. for other values, the counter channel's GATn
|
||||||
pin on the SK1 connector is an output!)
|
pin on the SK1 connector is an output!)
|
||||||
3. /OUT n-2, the inverted output of counter channel n-2 (see note
|
3. /OUT n-2, the inverted output of counter channel n-2 (see note
|
||||||
2 below).
|
2 below).
|
||||||
4. Reserved.
|
4. Reserved.
|
||||||
5. Reserved.
|
5. Reserved.
|
||||||
6. Reserved.
|
6. Reserved.
|
||||||
@ -153,8 +153,8 @@ below.
|
|||||||
|
|
||||||
INTERRUPT SOURCES
|
INTERRUPT SOURCES
|
||||||
|
|
||||||
PC218E PC212E PC215E/PCI215
|
PC218E PC212E PC215E/PCI215
|
||||||
------------- ------------- -------------
|
------------- ------------- -------------
|
||||||
Sources 6 6 6
|
Sources 6 6 6
|
||||||
0 CTR-X1-OUT PPI-X-C0 PPI-X-C0
|
0 CTR-X1-OUT PPI-X-C0 PPI-X-C0
|
||||||
1 CTR-X2-OUT PPI-X-C3 PPI-X-C3
|
1 CTR-X2-OUT PPI-X-C3 PPI-X-C3
|
||||||
@ -163,8 +163,8 @@ INTERRUPT SOURCES
|
|||||||
4 CTR-Z1-OUT CTR-Z1-OUT CTR-Z1-OUT
|
4 CTR-Z1-OUT CTR-Z1-OUT CTR-Z1-OUT
|
||||||
5 CTR-Z2-OUT CTR-Z2-OUT CTR-Z2-OUT
|
5 CTR-Z2-OUT CTR-Z2-OUT CTR-Z2-OUT
|
||||||
|
|
||||||
PC214E PC272E/PCI272
|
PC214E PC272E/PCI272
|
||||||
------------- -------------
|
------------- -------------
|
||||||
Sources 1 6
|
Sources 1 6
|
||||||
0 JUMPER-J5 PPI-X-C0
|
0 JUMPER-J5 PPI-X-C0
|
||||||
1 PPI-X-C3
|
1 PPI-X-C3
|
||||||
@ -435,11 +435,13 @@ MODULE_DEVICE_TABLE(pci, dio200_pci_table);
|
|||||||
* Useful for shorthand access to the particular board structure
|
* Useful for shorthand access to the particular board structure
|
||||||
*/
|
*/
|
||||||
#define thisboard ((const struct dio200_board *)dev->board_ptr)
|
#define thisboard ((const struct dio200_board *)dev->board_ptr)
|
||||||
#define thislayout (&dio200_layouts[((struct dio200_board *)dev->board_ptr)->layout])
|
#define thislayout (&dio200_layouts[((struct dio200_board *) \
|
||||||
|
dev->board_ptr)->layout])
|
||||||
|
|
||||||
/* this structure is for data unique to this hardware driver. If
|
/* this structure is for data unique to this hardware driver. If
|
||||||
several hardware drivers keep similar information in this structure,
|
several hardware drivers keep similar information in this structure,
|
||||||
feel free to suggest moving the variable to the struct comedi_device struct. */
|
feel free to suggest moving the variable to the struct comedi_device struct.
|
||||||
|
*/
|
||||||
struct dio200_private {
|
struct dio200_private {
|
||||||
#ifdef CONFIG_COMEDI_PCI
|
#ifdef CONFIG_COMEDI_PCI
|
||||||
struct pci_dev *pci_dev; /* PCI device */
|
struct pci_dev *pci_dev; /* PCI device */
|
||||||
@ -603,9 +605,8 @@ static void dio200_stop_intr(struct comedi_device *dev,
|
|||||||
|
|
||||||
subpriv->active = 0;
|
subpriv->active = 0;
|
||||||
subpriv->enabled_isns = 0;
|
subpriv->enabled_isns = 0;
|
||||||
if (subpriv->has_int_sce) {
|
if (subpriv->has_int_sce)
|
||||||
outb(0, subpriv->iobase);
|
outb(0, subpriv->iobase);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -629,16 +630,14 @@ static int dio200_start_intr(struct comedi_device *dev,
|
|||||||
/* Determine interrupt sources to enable. */
|
/* Determine interrupt sources to enable. */
|
||||||
isn_bits = 0;
|
isn_bits = 0;
|
||||||
if (cmd->chanlist) {
|
if (cmd->chanlist) {
|
||||||
for (n = 0; n < cmd->chanlist_len; n++) {
|
for (n = 0; n < cmd->chanlist_len; n++)
|
||||||
isn_bits |= (1U << CR_CHAN(cmd->chanlist[n]));
|
isn_bits |= (1U << CR_CHAN(cmd->chanlist[n]));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
isn_bits &= subpriv->valid_isns;
|
isn_bits &= subpriv->valid_isns;
|
||||||
/* Enable interrupt sources. */
|
/* Enable interrupt sources. */
|
||||||
subpriv->enabled_isns = isn_bits;
|
subpriv->enabled_isns = isn_bits;
|
||||||
if (subpriv->has_int_sce) {
|
if (subpriv->has_int_sce)
|
||||||
outb(isn_bits, subpriv->iobase);
|
outb(isn_bits, subpriv->iobase);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
@ -662,14 +661,13 @@ dio200_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s,
|
|||||||
|
|
||||||
spin_lock_irqsave(&subpriv->spinlock, flags);
|
spin_lock_irqsave(&subpriv->spinlock, flags);
|
||||||
s->async->inttrig = 0;
|
s->async->inttrig = 0;
|
||||||
if (subpriv->active) {
|
if (subpriv->active)
|
||||||
event = dio200_start_intr(dev, s);
|
event = dio200_start_intr(dev, s);
|
||||||
}
|
|
||||||
spin_unlock_irqrestore(&subpriv->spinlock, flags);
|
spin_unlock_irqrestore(&subpriv->spinlock, flags);
|
||||||
|
|
||||||
if (event) {
|
if (event)
|
||||||
comedi_event(dev, s);
|
comedi_event(dev, s);
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -726,9 +724,8 @@ static int dio200_handle_read_intr(struct comedi_device *dev,
|
|||||||
* Reenable them NOW to minimize the time they are disabled.
|
* Reenable them NOW to minimize the time they are disabled.
|
||||||
*/
|
*/
|
||||||
cur_enabled = subpriv->enabled_isns;
|
cur_enabled = subpriv->enabled_isns;
|
||||||
if (subpriv->has_int_sce) {
|
if (subpriv->has_int_sce)
|
||||||
outb(cur_enabled, subpriv->iobase);
|
outb(cur_enabled, subpriv->iobase);
|
||||||
}
|
|
||||||
|
|
||||||
if (subpriv->active) {
|
if (subpriv->active) {
|
||||||
/*
|
/*
|
||||||
@ -747,9 +744,8 @@ static int dio200_handle_read_intr(struct comedi_device *dev,
|
|||||||
len = s->async->cmd.chanlist_len;
|
len = s->async->cmd.chanlist_len;
|
||||||
for (n = 0; n < len; n++) {
|
for (n = 0; n < len; n++) {
|
||||||
ch = CR_CHAN(s->async->cmd.chanlist[n]);
|
ch = CR_CHAN(s->async->cmd.chanlist[n]);
|
||||||
if (triggered & (1U << ch)) {
|
if (triggered & (1U << ch))
|
||||||
val |= (1U << n);
|
val |= (1U << n);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Write the scan to the buffer. */
|
/* Write the scan to the buffer. */
|
||||||
if (comedi_buf_put(s->async, val)) {
|
if (comedi_buf_put(s->async, val)) {
|
||||||
@ -781,9 +777,8 @@ static int dio200_handle_read_intr(struct comedi_device *dev,
|
|||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&subpriv->spinlock, flags);
|
spin_unlock_irqrestore(&subpriv->spinlock, flags);
|
||||||
|
|
||||||
if (oldevents != s->async->events) {
|
if (oldevents != s->async->events)
|
||||||
comedi_event(dev, s);
|
comedi_event(dev, s);
|
||||||
}
|
|
||||||
|
|
||||||
return (triggered != 0);
|
return (triggered != 0);
|
||||||
}
|
}
|
||||||
@ -798,9 +793,9 @@ static int dio200_subdev_intr_cancel(struct comedi_device *dev,
|
|||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irqsave(&subpriv->spinlock, flags);
|
spin_lock_irqsave(&subpriv->spinlock, flags);
|
||||||
if (subpriv->active) {
|
if (subpriv->active)
|
||||||
dio200_stop_intr(dev, s);
|
dio200_stop_intr(dev, s);
|
||||||
}
|
|
||||||
spin_unlock_irqrestore(&subpriv->spinlock, flags);
|
spin_unlock_irqrestore(&subpriv->spinlock, flags);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -846,7 +841,8 @@ dio200_subdev_intr_cmdtest(struct comedi_device *dev,
|
|||||||
if (err)
|
if (err)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* step 2: make sure trigger sources are unique and mutually compatible */
|
/* step 2: make sure trigger sources are unique and mutually
|
||||||
|
compatible */
|
||||||
|
|
||||||
/* these tests are true if more than one _src bit is set */
|
/* these tests are true if more than one _src bit is set */
|
||||||
if ((cmd->start_src & (cmd->start_src - 1)) != 0)
|
if ((cmd->start_src & (cmd->start_src - 1)) != 0)
|
||||||
@ -952,9 +948,8 @@ static int dio200_subdev_intr_cmd(struct comedi_device *dev,
|
|||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&subpriv->spinlock, flags);
|
spin_unlock_irqrestore(&subpriv->spinlock, flags);
|
||||||
|
|
||||||
if (event) {
|
if (event)
|
||||||
comedi_event(dev, s);
|
comedi_event(dev, s);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -980,9 +975,8 @@ dio200_subdev_intr_init(struct comedi_device *dev, struct comedi_subdevice *s,
|
|||||||
subpriv->valid_isns = valid_isns;
|
subpriv->valid_isns = valid_isns;
|
||||||
spin_lock_init(&subpriv->spinlock);
|
spin_lock_init(&subpriv->spinlock);
|
||||||
|
|
||||||
if (has_int_sce) {
|
if (has_int_sce)
|
||||||
outb(0, subpriv->iobase); /* Disable interrupt sources. */
|
outb(0, subpriv->iobase); /* Disable interrupt sources. */
|
||||||
}
|
|
||||||
|
|
||||||
s->private = subpriv;
|
s->private = subpriv;
|
||||||
s->type = COMEDI_SUBD_DI;
|
s->type = COMEDI_SUBD_DI;
|
||||||
@ -1013,10 +1007,7 @@ dio200_subdev_intr_cleanup(struct comedi_device *dev,
|
|||||||
struct comedi_subdevice *s)
|
struct comedi_subdevice *s)
|
||||||
{
|
{
|
||||||
struct dio200_subdev_intr *subpriv = s->private;
|
struct dio200_subdev_intr *subpriv = s->private;
|
||||||
|
kfree(subpriv);
|
||||||
if (subpriv) {
|
|
||||||
kfree(subpriv);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1027,9 +1018,8 @@ static irqreturn_t dio200_interrupt(int irq, void *d)
|
|||||||
struct comedi_device *dev = d;
|
struct comedi_device *dev = d;
|
||||||
int handled;
|
int handled;
|
||||||
|
|
||||||
if (!dev->attached) {
|
if (!dev->attached)
|
||||||
return IRQ_NONE;
|
return IRQ_NONE;
|
||||||
}
|
|
||||||
|
|
||||||
if (devpriv->intr_sd >= 0) {
|
if (devpriv->intr_sd >= 0) {
|
||||||
handled = dio200_handle_read_intr(dev,
|
handled = dio200_handle_read_intr(dev,
|
||||||
@ -1266,10 +1256,7 @@ dio200_subdev_8254_cleanup(struct comedi_device *dev,
|
|||||||
struct comedi_subdevice *s)
|
struct comedi_subdevice *s)
|
||||||
{
|
{
|
||||||
struct dio200_subdev_intr *subpriv = s->private;
|
struct dio200_subdev_intr *subpriv = s->private;
|
||||||
|
kfree(subpriv);
|
||||||
if (subpriv) {
|
|
||||||
kfree(subpriv);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1348,9 +1335,8 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ret = dio200_request_region(dev->minor, iobase, DIO200_IO_SIZE);
|
ret = dio200_request_region(dev->minor, iobase, DIO200_IO_SIZE);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dev->iobase = iobase;
|
dev->iobase = iobase;
|
||||||
|
|
||||||
@ -1371,17 +1357,17 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||||||
ret = dio200_subdev_8254_init(dev, s, iobase,
|
ret = dio200_subdev_8254_init(dev, s, iobase,
|
||||||
layout->sdinfo[n],
|
layout->sdinfo[n],
|
||||||
layout->has_clk_gat_sce);
|
layout->has_clk_gat_sce);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case sd_8255:
|
case sd_8255:
|
||||||
/* digital i/o subdevice (8255) */
|
/* digital i/o subdevice (8255) */
|
||||||
ret = subdev_8255_init(dev, s, 0,
|
ret = subdev_8255_init(dev, s, 0,
|
||||||
iobase + layout->sdinfo[n]);
|
iobase + layout->sdinfo[n]);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case sd_intr:
|
case sd_intr:
|
||||||
/* 'INTERRUPT' subdevice */
|
/* 'INTERRUPT' subdevice */
|
||||||
@ -1392,9 +1378,9 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||||||
layout->sdinfo[n],
|
layout->sdinfo[n],
|
||||||
layout->
|
layout->
|
||||||
has_int_sce);
|
has_int_sce);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
devpriv->intr_sd = n;
|
devpriv->intr_sd = n;
|
||||||
} else {
|
} else {
|
||||||
s->type = COMEDI_SUBD_UNUSED;
|
s->type = COMEDI_SUBD_UNUSED;
|
||||||
@ -1407,9 +1393,8 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sdx = devpriv->intr_sd;
|
sdx = devpriv->intr_sd;
|
||||||
if (sdx >= 0 && sdx < dev->n_subdevices) {
|
if (sdx >= 0 && sdx < dev->n_subdevices)
|
||||||
dev->read_subdev = &dev->subdevices[sdx];
|
dev->read_subdev = &dev->subdevices[sdx];
|
||||||
}
|
|
||||||
|
|
||||||
dev->board_name = thisboard->name;
|
dev->board_name = thisboard->name;
|
||||||
|
|
||||||
@ -1434,11 +1419,10 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||||||
printk("(pci %s) ", pci_name(pci_dev));
|
printk("(pci %s) ", pci_name(pci_dev));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (irq) {
|
if (irq)
|
||||||
printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE"));
|
printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE"));
|
||||||
} else {
|
else
|
||||||
printk("(no irq) ");
|
printk("(no irq) ");
|
||||||
}
|
|
||||||
|
|
||||||
printk("attached\n");
|
printk("attached\n");
|
||||||
|
|
||||||
@ -1461,9 +1445,8 @@ static int dio200_detach(struct comedi_device *dev)
|
|||||||
printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor,
|
printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor,
|
||||||
DIO200_DRIVER_NAME);
|
DIO200_DRIVER_NAME);
|
||||||
|
|
||||||
if (dev->irq) {
|
if (dev->irq)
|
||||||
free_irq(dev->irq, dev);
|
free_irq(dev->irq, dev);
|
||||||
}
|
|
||||||
if (dev->subdevices) {
|
if (dev->subdevices) {
|
||||||
layout = thislayout;
|
layout = thislayout;
|
||||||
for (n = 0; n < dev->n_subdevices; n++) {
|
for (n = 0; n < dev->n_subdevices; n++) {
|
||||||
@ -1486,22 +1469,19 @@ static int dio200_detach(struct comedi_device *dev)
|
|||||||
if (devpriv) {
|
if (devpriv) {
|
||||||
#ifdef CONFIG_COMEDI_PCI
|
#ifdef CONFIG_COMEDI_PCI
|
||||||
if (devpriv->pci_dev) {
|
if (devpriv->pci_dev) {
|
||||||
if (dev->iobase) {
|
if (dev->iobase)
|
||||||
comedi_pci_disable(devpriv->pci_dev);
|
comedi_pci_disable(devpriv->pci_dev);
|
||||||
}
|
|
||||||
pci_dev_put(devpriv->pci_dev);
|
pci_dev_put(devpriv->pci_dev);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (dev->iobase) {
|
if (dev->iobase)
|
||||||
release_region(dev->iobase, DIO200_IO_SIZE);
|
release_region(dev->iobase, DIO200_IO_SIZE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dev->board_name) {
|
if (dev->board_name)
|
||||||
printk(KERN_INFO "comedi%d: %s removed\n",
|
printk(KERN_INFO "comedi%d: %s removed\n",
|
||||||
dev->minor, dev->board_name);
|
dev->minor, dev->board_name);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user