Commit b74e635d authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: mite: pass subdevice to mite_buf_change()

`mite_buf_change()` in the "mite" module currently takes a pointer to a
`struct comedi_async` and gets a pointer to the owning `struct
comedi_subdevice` from the `subdevice` member.  Change it to take a
pointer to a `struct comedi_subdevice` and use the `async` member.

The motivation for this is to eliminate the `subdevice` member of
`struct comedi_async`.
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 a1c0e5fe
...@@ -307,8 +307,9 @@ EXPORT_SYMBOL_GPL(mite_dma_arm); ...@@ -307,8 +307,9 @@ EXPORT_SYMBOL_GPL(mite_dma_arm);
/**************************************/ /**************************************/
int mite_buf_change(struct mite_dma_descriptor_ring *ring, int mite_buf_change(struct mite_dma_descriptor_ring *ring,
struct comedi_async *async) struct comedi_subdevice *s)
{ {
struct comedi_async *async = s->async;
unsigned int n_links; unsigned int n_links;
int i; int i;
...@@ -333,7 +334,7 @@ int mite_buf_change(struct mite_dma_descriptor_ring *ring, ...@@ -333,7 +334,7 @@ int mite_buf_change(struct mite_dma_descriptor_ring *ring,
n_links * sizeof(struct mite_dma_descriptor), n_links * sizeof(struct mite_dma_descriptor),
&ring->descriptors_dma_addr, GFP_KERNEL); &ring->descriptors_dma_addr, GFP_KERNEL);
if (!ring->descriptors) { if (!ring->descriptors) {
dev_err(async->subdevice->device->class_dev, dev_err(s->device->class_dev,
"mite: ring buffer allocation failed\n"); "mite: ring buffer allocation failed\n");
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -120,7 +120,7 @@ int mite_done(struct mite_channel *mite_chan); ...@@ -120,7 +120,7 @@ int mite_done(struct mite_channel *mite_chan);
void mite_prep_dma(struct mite_channel *mite_chan, void mite_prep_dma(struct mite_channel *mite_chan,
unsigned int num_device_bits, unsigned int num_memory_bits); unsigned int num_device_bits, unsigned int num_memory_bits);
int mite_buf_change(struct mite_dma_descriptor_ring *ring, int mite_buf_change(struct mite_dma_descriptor_ring *ring,
struct comedi_async *async); struct comedi_subdevice *s);
static inline int CHAN_OFFSET(int channel) static inline int CHAN_OFFSET(int channel)
{ {
......
...@@ -836,7 +836,7 @@ static int ni_660x_buf_change(struct comedi_device *dev, ...@@ -836,7 +836,7 @@ static int ni_660x_buf_change(struct comedi_device *dev,
struct ni_gpct *counter = s->private; struct ni_gpct *counter = s->private;
int ret; int ret;
ret = mite_buf_change(mite_ring(devpriv, counter), s->async); ret = mite_buf_change(mite_ring(devpriv, counter), s);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -806,7 +806,7 @@ static int ni_pcidio_change(struct comedi_device *dev, ...@@ -806,7 +806,7 @@ static int ni_pcidio_change(struct comedi_device *dev,
struct nidio96_private *devpriv = dev->private; struct nidio96_private *devpriv = dev->private;
int ret; int ret;
ret = mite_buf_change(devpriv->di_mite_ring, s->async); ret = mite_buf_change(devpriv->di_mite_ring, s);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -1560,7 +1560,7 @@ static int pcimio_ai_change(struct comedi_device *dev, ...@@ -1560,7 +1560,7 @@ static int pcimio_ai_change(struct comedi_device *dev,
struct ni_private *devpriv = dev->private; struct ni_private *devpriv = dev->private;
int ret; int ret;
ret = mite_buf_change(devpriv->ai_mite_ring, s->async); ret = mite_buf_change(devpriv->ai_mite_ring, s);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1573,7 +1573,7 @@ static int pcimio_ao_change(struct comedi_device *dev, ...@@ -1573,7 +1573,7 @@ static int pcimio_ao_change(struct comedi_device *dev,
struct ni_private *devpriv = dev->private; struct ni_private *devpriv = dev->private;
int ret; int ret;
ret = mite_buf_change(devpriv->ao_mite_ring, s->async); ret = mite_buf_change(devpriv->ao_mite_ring, s);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1587,7 +1587,7 @@ static int pcimio_gpct0_change(struct comedi_device *dev, ...@@ -1587,7 +1587,7 @@ static int pcimio_gpct0_change(struct comedi_device *dev,
struct ni_private *devpriv = dev->private; struct ni_private *devpriv = dev->private;
int ret; int ret;
ret = mite_buf_change(devpriv->gpct_mite_ring[0], s->async); ret = mite_buf_change(devpriv->gpct_mite_ring[0], s);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1601,7 +1601,7 @@ static int pcimio_gpct1_change(struct comedi_device *dev, ...@@ -1601,7 +1601,7 @@ static int pcimio_gpct1_change(struct comedi_device *dev,
struct ni_private *devpriv = dev->private; struct ni_private *devpriv = dev->private;
int ret; int ret;
ret = mite_buf_change(devpriv->gpct_mite_ring[1], s->async); ret = mite_buf_change(devpriv->gpct_mite_ring[1], s);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1614,7 +1614,7 @@ static int pcimio_dio_change(struct comedi_device *dev, ...@@ -1614,7 +1614,7 @@ static int pcimio_dio_change(struct comedi_device *dev,
struct ni_private *devpriv = dev->private; struct ni_private *devpriv = dev->private;
int ret; int ret;
ret = mite_buf_change(devpriv->cdo_mite_ring, s->async); ret = mite_buf_change(devpriv->cdo_mite_ring, s);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
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