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

Commit 3672effd authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman
Browse files

staging: comedi: pass subdevice to comedi_buf_put()



Change the parameters of `comedi_buf_put()` to pass a pointer to the
comedi subdevice instead of a pointer to the "async" structure belonging
to the subdevice.

The function puts a sample value in the comedi buffer, but currently
only deals with 16-bit sample types.  A future version could deal with
16 or 32-bit sample types depending on the value of the SDF_LSAMPL
subdevice flag.

The main aim at the moment is to replace all the `struct comedi_async *`
parameters with `struct comedi_subdevice *` parameters in the comedi
driver API.

Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 53030b13
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -416,8 +416,9 @@ unsigned int comedi_buf_read_free(struct comedi_async *async,
}
EXPORT_SYMBOL_GPL(comedi_buf_read_free);

int comedi_buf_put(struct comedi_async *async, unsigned short x)
int comedi_buf_put(struct comedi_subdevice *s, unsigned short x)
{
	struct comedi_async *async = s->async;
	unsigned int n = __comedi_buf_write_alloc(async, sizeof(short), 1);

	if (n < sizeof(short)) {
+1 −1
Original line number Diff line number Diff line
@@ -343,7 +343,7 @@ unsigned int comedi_buf_read_n_available(struct comedi_async *);
unsigned int comedi_buf_read_alloc(struct comedi_async *, unsigned int);
unsigned int comedi_buf_read_free(struct comedi_async *, unsigned int);

int comedi_buf_put(struct comedi_async *, unsigned short);
int comedi_buf_put(struct comedi_subdevice *s, unsigned short x);
int comedi_buf_get(struct comedi_async *, unsigned short *);

void comedi_buf_memcpy_to(struct comedi_async *async, unsigned int offset,
+1 −1
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ void subdev_8255_interrupt(struct comedi_device *dev,
	d = spriv->io(0, _8255_DATA, 0, iobase);
	d |= (spriv->io(0, _8255_DATA + 1, 0, iobase) << 8);

	comedi_buf_put(s->async, d);
	comedi_buf_put(s, d);
	s->async->events |= COMEDI_CB_EOS;

	comedi_event(dev, s);
+1 −1
Original line number Diff line number Diff line
@@ -1520,7 +1520,7 @@ static int apci3120_interrupt_handle_eos(struct comedi_device *dev)
	n_chan = devpriv->ui_AiNbrofChannels;

	for (i = 0; i < n_chan; i++)
		err &= comedi_buf_put(s->async, inw(dev->iobase + 0));
		err &= comedi_buf_put(s, inw(dev->iobase + 0));

	s->async->events |= COMEDI_CB_EOS;

+1 −1
Original line number Diff line number Diff line
@@ -262,7 +262,7 @@ static irqreturn_t apci1032_interrupt(int irq, void *d)
	outl(ctrl & ~APCI1032_CTRL_INT_ENA, dev->iobase + APCI1032_CTRL_REG);

	s->state = inl(dev->iobase + APCI1032_STATUS_REG) & 0xffff;
	comedi_buf_put(s->async, s->state);
	comedi_buf_put(s, s->state);
	s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS;
	comedi_event(dev, s);

Loading