Commit 99ca4e46 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: amplc_dio200_common: remove 'spinlock' from struct dio200_subdev_8254

Currently this driver uses a spinlock in the 8254 subdevice (*insn_read), (*insn_write),
and (*insn_config) functions. The comedi core checks if the subdevice is 'busy', in
parse_insn(), before any of the subdevice functions are attempted.

Remove the unnecessary spinlock.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ed023d52
...@@ -101,7 +101,6 @@ struct dio200_subdev_8254 { ...@@ -101,7 +101,6 @@ struct dio200_subdev_8254 {
unsigned int ofs; /* Counter base offset */ unsigned int ofs; /* Counter base offset */
unsigned int clock_src[3]; /* Current clock sources */ unsigned int clock_src[3]; /* Current clock sources */
unsigned int gate_src[3]; /* Current gate sources */ unsigned int gate_src[3]; /* Current gate sources */
spinlock_t spinlock;
}; };
struct dio200_subdev_8255 { struct dio200_subdev_8255 {
...@@ -535,16 +534,12 @@ static int dio200_subdev_8254_read(struct comedi_device *dev, ...@@ -535,16 +534,12 @@ static int dio200_subdev_8254_read(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct dio200_subdev_8254 *subpriv = s->private;
int chan = CR_CHAN(insn->chanspec); int chan = CR_CHAN(insn->chanspec);
unsigned int n; unsigned int n;
unsigned long flags;
for (n = 0; n < insn->n; n++) { for (n = 0; n < insn->n; n++)
spin_lock_irqsave(&subpriv->spinlock, flags);
data[n] = dio200_subdev_8254_read_chan(dev, s, chan); data[n] = dio200_subdev_8254_read_chan(dev, s, chan);
spin_unlock_irqrestore(&subpriv->spinlock, flags);
}
return insn->n; return insn->n;
} }
...@@ -553,16 +548,12 @@ static int dio200_subdev_8254_write(struct comedi_device *dev, ...@@ -553,16 +548,12 @@ static int dio200_subdev_8254_write(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct dio200_subdev_8254 *subpriv = s->private;
int chan = CR_CHAN(insn->chanspec); int chan = CR_CHAN(insn->chanspec);
unsigned int n; unsigned int n;
unsigned long flags;
for (n = 0; n < insn->n; n++) { for (n = 0; n < insn->n; n++)
spin_lock_irqsave(&subpriv->spinlock, flags);
dio200_subdev_8254_write_chan(dev, s, chan, data[n]); dio200_subdev_8254_write_chan(dev, s, chan, data[n]);
spin_unlock_irqrestore(&subpriv->spinlock, flags);
}
return insn->n; return insn->n;
} }
...@@ -643,12 +634,9 @@ static int dio200_subdev_8254_config(struct comedi_device *dev, ...@@ -643,12 +634,9 @@ static int dio200_subdev_8254_config(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct dio200_subdev_8254 *subpriv = s->private;
int ret = 0; int ret = 0;
int chan = CR_CHAN(insn->chanspec); int chan = CR_CHAN(insn->chanspec);
unsigned long flags;
spin_lock_irqsave(&subpriv->spinlock, flags);
switch (data[0]) { switch (data[0]) {
case INSN_CONFIG_SET_COUNTER_MODE: case INSN_CONFIG_SET_COUNTER_MODE:
if (data[1] > (I8254_MODE5 | I8254_BCD)) if (data[1] > (I8254_MODE5 | I8254_BCD))
...@@ -689,7 +677,7 @@ static int dio200_subdev_8254_config(struct comedi_device *dev, ...@@ -689,7 +677,7 @@ static int dio200_subdev_8254_config(struct comedi_device *dev,
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
spin_unlock_irqrestore(&subpriv->spinlock, flags);
return ret < 0 ? ret : insn->n; return ret < 0 ? ret : insn->n;
} }
...@@ -713,7 +701,6 @@ static int dio200_subdev_8254_init(struct comedi_device *dev, ...@@ -713,7 +701,6 @@ static int dio200_subdev_8254_init(struct comedi_device *dev,
s->insn_write = dio200_subdev_8254_write; s->insn_write = dio200_subdev_8254_write;
s->insn_config = dio200_subdev_8254_config; s->insn_config = dio200_subdev_8254_config;
spin_lock_init(&subpriv->spinlock);
subpriv->ofs = offset; subpriv->ofs = offset;
/* Initialize channels. */ /* Initialize channels. */
......
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