aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/amplc_dio200_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/comedi/drivers/amplc_dio200_common.c')
-rw-r--r--drivers/staging/comedi/drivers/amplc_dio200_common.c61
1 files changed, 33 insertions, 28 deletions
diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
index d15a3dc1216a..d1539e798ffd 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
@@ -1,23 +1,23 @@
/*
- comedi/drivers/amplc_dio200_common.c
-
- Common support code for "amplc_dio200" and "amplc_dio200_pci".
-
- Copyright (C) 2005-2013 MEV Ltd. <http://www.mev.co.uk/>
-
- COMEDI - Linux Control and Measurement Device Interface
- Copyright (C) 1998,2000 David A. Schleef <ds@schleef.org>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-*/
+ * comedi/drivers/amplc_dio200_common.c
+ *
+ * Common support code for "amplc_dio200" and "amplc_dio200_pci".
+ *
+ * Copyright (C) 2005-2013 MEV Ltd. <http://www.mev.co.uk/>
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1998,2000 David A. Schleef <ds@schleef.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
#include <linux/module.h>
#include <linux/interrupt.h>
@@ -337,9 +337,10 @@ static int dio200_handle_read_intr(struct comedi_device *dev,
* interested in (just in case there's a race
* condition).
*/
- if (triggered & subpriv->enabled_isns)
+ if (triggered & subpriv->enabled_isns) {
/* Collect scan data. */
dio200_read_scan_intr(dev, s, triggered);
+ }
}
}
spin_unlock_irqrestore(&subpriv->spinlock, flags);
@@ -576,12 +577,13 @@ static int dio200_subdev_8254_init(struct comedi_device *dev,
regshift = 0;
}
- if (dev->mmio)
+ if (dev->mmio) {
i8254 = comedi_8254_mm_init(dev->mmio + offset,
0, I8254_IO8, regshift);
- else
+ } else {
i8254 = comedi_8254_init(dev->iobase + offset,
0, I8254_IO8, regshift);
+ }
if (!i8254)
return -ENOMEM;
@@ -593,10 +595,10 @@ static int dio200_subdev_8254_init(struct comedi_device *dev,
* There could be multiple timers so this driver does not
* use dev->pacer to save the i8254 pointer. Instead,
* comedi_8254_subdevice_init() saved the i8254 pointer in
- * s->private. Set the runflag bit so that the core will
- * automatically free it when the driver is detached.
+ * s->private. Mark the subdevice as having private data
+ * to be automatically freed when the device is detached.
*/
- s->runflags |= COMEDI_SRF_FREE_SPRIV;
+ comedi_set_spriv_auto_free(s);
/* Initialize channels. */
if (board->has_clk_gat_sce) {
@@ -641,15 +643,18 @@ static int dio200_subdev_8255_bits(struct comedi_device *dev,
mask = comedi_dio_update_state(s, data);
if (mask) {
- if (mask & 0xff)
+ if (mask & 0xff) {
dio200_write8(dev, subpriv->ofs + I8255_DATA_A_REG,
s->state & 0xff);
- if (mask & 0xff00)
+ }
+ if (mask & 0xff00) {
dio200_write8(dev, subpriv->ofs + I8255_DATA_B_REG,
(s->state >> 8) & 0xff);
- if (mask & 0xff0000)
+ }
+ if (mask & 0xff0000) {
dio200_write8(dev, subpriv->ofs + I8255_DATA_C_REG,
(s->state >> 16) & 0xff);
+ }
}
val = dio200_read8(dev, subpriv->ofs + I8255_DATA_A_REG);