staging: comedi: amplc_dio200_common: remove 'spinlock' from struct dio200_subdev_8254
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 23 Feb 2015 21:58:00 +0000 (14:58 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Mar 2015 02:51:52 +0000 (18:51 -0800)
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: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/amplc_dio200_common.c

index 48cdddc5611086619b2b9733155d8c9583a48dd3..08dab1fd91f2ea78c750b07b668edd98fd1165f6 100644 (file)
@@ -101,7 +101,6 @@ struct dio200_subdev_8254 {
        unsigned int ofs;               /* Counter base offset */
        unsigned int clock_src[3];      /* Current clock sources */
        unsigned int gate_src[3];       /* Current gate sources */
-       spinlock_t spinlock;
 };
 
 struct dio200_subdev_8255 {
@@ -535,16 +534,12 @@ static int dio200_subdev_8254_read(struct comedi_device *dev,
                                   struct comedi_insn *insn,
                                   unsigned int *data)
 {
-       struct dio200_subdev_8254 *subpriv = s->private;
        int chan = CR_CHAN(insn->chanspec);
        unsigned int n;
-       unsigned long flags;
 
-       for (n = 0; n < insn->n; n++) {
-               spin_lock_irqsave(&subpriv->spinlock, flags);
+       for (n = 0; n < insn->n; n++)
                data[n] = dio200_subdev_8254_read_chan(dev, s, chan);
-               spin_unlock_irqrestore(&subpriv->spinlock, flags);
-       }
+
        return insn->n;
 }
 
@@ -553,16 +548,12 @@ static int dio200_subdev_8254_write(struct comedi_device *dev,
                                    struct comedi_insn *insn,
                                    unsigned int *data)
 {
-       struct dio200_subdev_8254 *subpriv = s->private;
        int chan = CR_CHAN(insn->chanspec);
        unsigned int n;
-       unsigned long flags;
 
-       for (n = 0; n < insn->n; n++) {
-               spin_lock_irqsave(&subpriv->spinlock, flags);
+       for (n = 0; n < insn->n; n++)
                dio200_subdev_8254_write_chan(dev, s, chan, data[n]);
-               spin_unlock_irqrestore(&subpriv->spinlock, flags);
-       }
+
        return insn->n;
 }
 
@@ -643,12 +634,9 @@ static int dio200_subdev_8254_config(struct comedi_device *dev,
                                     struct comedi_insn *insn,
                                     unsigned int *data)
 {
-       struct dio200_subdev_8254 *subpriv = s->private;
        int ret = 0;
        int chan = CR_CHAN(insn->chanspec);
-       unsigned long flags;
 
-       spin_lock_irqsave(&subpriv->spinlock, flags);
        switch (data[0]) {
        case INSN_CONFIG_SET_COUNTER_MODE:
                if (data[1] > (I8254_MODE5 | I8254_BCD))
@@ -689,7 +677,7 @@ static int dio200_subdev_8254_config(struct comedi_device *dev,
                ret = -EINVAL;
                break;
        }
-       spin_unlock_irqrestore(&subpriv->spinlock, flags);
+
        return ret < 0 ? ret : insn->n;
 }
 
@@ -713,7 +701,6 @@ static int dio200_subdev_8254_init(struct comedi_device *dev,
        s->insn_write = dio200_subdev_8254_write;
        s->insn_config = dio200_subdev_8254_config;
 
-       spin_lock_init(&subpriv->spinlock);
        subpriv->ofs = offset;
 
        /* Initialize channels. */
This page took 0.026081 seconds and 5 git commands to generate.