Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+5 −18
Original line number Diff line number Diff line
@@ -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. */