Commit 669c930c authored by Benjamin Adolphi's avatar Benjamin Adolphi Committed by Greg Kroah-Hartman

Staging: comedi: amplc_dio200: Checkpatch cleanups

This fixes all checkpatch issues in the amplc_dio200 comedi driver.
Signed-off-by: default avatarBenjamin Adolphi <b.adolphi@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e20ad20d
......@@ -435,11 +435,13 @@ MODULE_DEVICE_TABLE(pci, dio200_pci_table);
* Useful for shorthand access to the particular board structure
*/
#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
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 {
#ifdef CONFIG_COMEDI_PCI
struct pci_dev *pci_dev; /* PCI device */
......@@ -603,9 +605,8 @@ static void dio200_stop_intr(struct comedi_device *dev,
subpriv->active = 0;
subpriv->enabled_isns = 0;
if (subpriv->has_int_sce) {
if (subpriv->has_int_sce)
outb(0, subpriv->iobase);
}
}
/*
......@@ -629,17 +630,15 @@ static int dio200_start_intr(struct comedi_device *dev,
/* Determine interrupt sources to enable. */
isn_bits = 0;
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 &= subpriv->valid_isns;
/* Enable interrupt sources. */
subpriv->enabled_isns = isn_bits;
if (subpriv->has_int_sce) {
if (subpriv->has_int_sce)
outb(isn_bits, subpriv->iobase);
}
}
return retval;
}
......@@ -662,14 +661,13 @@ dio200_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s,
spin_lock_irqsave(&subpriv->spinlock, flags);
s->async->inttrig = 0;
if (subpriv->active) {
if (subpriv->active)
event = dio200_start_intr(dev, s);
}
spin_unlock_irqrestore(&subpriv->spinlock, flags);
if (event) {
if (event)
comedi_event(dev, s);
}
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.
*/
cur_enabled = subpriv->enabled_isns;
if (subpriv->has_int_sce) {
if (subpriv->has_int_sce)
outb(cur_enabled, subpriv->iobase);
}
if (subpriv->active) {
/*
......@@ -747,10 +744,9 @@ static int dio200_handle_read_intr(struct comedi_device *dev,
len = s->async->cmd.chanlist_len;
for (n = 0; n < len; n++) {
ch = CR_CHAN(s->async->cmd.chanlist[n]);
if (triggered & (1U << ch)) {
if (triggered & (1U << ch))
val |= (1U << n);
}
}
/* Write the scan to the buffer. */
if (comedi_buf_put(s->async, val)) {
s->async->events |= (COMEDI_CB_BLOCK |
......@@ -781,9 +777,8 @@ static int dio200_handle_read_intr(struct comedi_device *dev,
}
spin_unlock_irqrestore(&subpriv->spinlock, flags);
if (oldevents != s->async->events) {
if (oldevents != s->async->events)
comedi_event(dev, s);
}
return (triggered != 0);
}
......@@ -798,9 +793,9 @@ static int dio200_subdev_intr_cancel(struct comedi_device *dev,
unsigned long flags;
spin_lock_irqsave(&subpriv->spinlock, flags);
if (subpriv->active) {
if (subpriv->active)
dio200_stop_intr(dev, s);
}
spin_unlock_irqrestore(&subpriv->spinlock, flags);
return 0;
......@@ -846,7 +841,8 @@ dio200_subdev_intr_cmdtest(struct comedi_device *dev,
if (err)
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 */
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);
if (event) {
if (event)
comedi_event(dev, s);
}
return 0;
}
......@@ -980,9 +975,8 @@ dio200_subdev_intr_init(struct comedi_device *dev, struct comedi_subdevice *s,
subpriv->valid_isns = valid_isns;
spin_lock_init(&subpriv->spinlock);
if (has_int_sce) {
if (has_int_sce)
outb(0, subpriv->iobase); /* Disable interrupt sources. */
}
s->private = subpriv;
s->type = COMEDI_SUBD_DI;
......@@ -1013,10 +1007,7 @@ dio200_subdev_intr_cleanup(struct comedi_device *dev,
struct comedi_subdevice *s)
{
struct dio200_subdev_intr *subpriv = s->private;
if (subpriv) {
kfree(subpriv);
}
}
/*
......@@ -1027,9 +1018,8 @@ static irqreturn_t dio200_interrupt(int irq, void *d)
struct comedi_device *dev = d;
int handled;
if (!dev->attached) {
if (!dev->attached)
return IRQ_NONE;
}
if (devpriv->intr_sd >= 0) {
handled = dio200_handle_read_intr(dev,
......@@ -1266,10 +1256,7 @@ dio200_subdev_8254_cleanup(struct comedi_device *dev,
struct comedi_subdevice *s)
{
struct dio200_subdev_intr *subpriv = s->private;
if (subpriv) {
kfree(subpriv);
}
}
/*
......@@ -1348,10 +1335,9 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
#endif
{
ret = dio200_request_region(dev->minor, iobase, DIO200_IO_SIZE);
if (ret < 0) {
if (ret < 0)
return ret;
}
}
dev->iobase = iobase;
layout = thislayout;
......@@ -1371,17 +1357,17 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
ret = dio200_subdev_8254_init(dev, s, iobase,
layout->sdinfo[n],
layout->has_clk_gat_sce);
if (ret < 0) {
if (ret < 0)
return ret;
}
break;
case sd_8255:
/* digital i/o subdevice (8255) */
ret = subdev_8255_init(dev, s, 0,
iobase + layout->sdinfo[n]);
if (ret < 0) {
if (ret < 0)
return ret;
}
break;
case sd_intr:
/* 'INTERRUPT' subdevice */
......@@ -1392,9 +1378,9 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
layout->sdinfo[n],
layout->
has_int_sce);
if (ret < 0) {
if (ret < 0)
return ret;
}
devpriv->intr_sd = n;
} else {
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;
if (sdx >= 0 && sdx < dev->n_subdevices) {
if (sdx >= 0 && sdx < dev->n_subdevices)
dev->read_subdev = &dev->subdevices[sdx];
}
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));
#endif
}
if (irq) {
if (irq)
printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE"));
} else {
else
printk("(no irq) ");
}
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,
DIO200_DRIVER_NAME);
if (dev->irq) {
if (dev->irq)
free_irq(dev->irq, dev);
}
if (dev->subdevices) {
layout = thislayout;
for (n = 0; n < dev->n_subdevices; n++) {
......@@ -1486,22 +1469,19 @@ static int dio200_detach(struct comedi_device *dev)
if (devpriv) {
#ifdef CONFIG_COMEDI_PCI
if (devpriv->pci_dev) {
if (dev->iobase) {
if (dev->iobase)
comedi_pci_disable(devpriv->pci_dev);
}
pci_dev_put(devpriv->pci_dev);
} else
#endif
{
if (dev->iobase) {
if (dev->iobase)
release_region(dev->iobase, DIO200_IO_SIZE);
}
}
}
if (dev->board_name) {
if (dev->board_name)
printk(KERN_INFO "comedi%d: %s removed\n",
dev->minor, dev->board_name);
}
return 0;
}
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