Commit 19d9212e authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: mite: rename 'struct mite_dma_descriptor_ring'

Rename this name to 'mite_ring' to help shorten the long lines.

In the ni_660x driver, also shorten the private data member 'mite_rings'
to simply 'ring'.
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 f5d077cd
......@@ -355,11 +355,11 @@ void mite_detach(struct mite *mite)
}
EXPORT_SYMBOL_GPL(mite_detach);
struct mite_dma_descriptor_ring *mite_alloc_ring(struct mite *mite)
struct mite_ring *mite_alloc_ring(struct mite *mite)
{
struct mite_dma_descriptor_ring *ring =
kmalloc(sizeof(struct mite_dma_descriptor_ring), GFP_KERNEL);
struct mite_ring *ring;
ring = kmalloc(sizeof(*ring), GFP_KERNEL);
if (!ring)
return NULL;
ring->hw_dev = get_device(&mite->pcidev->dev);
......@@ -374,7 +374,7 @@ struct mite_dma_descriptor_ring *mite_alloc_ring(struct mite *mite)
};
EXPORT_SYMBOL_GPL(mite_alloc_ring);
void mite_free_ring(struct mite_dma_descriptor_ring *ring)
void mite_free_ring(struct mite_ring *ring)
{
if (ring) {
if (ring->descriptors) {
......@@ -390,11 +390,10 @@ void mite_free_ring(struct mite_dma_descriptor_ring *ring)
};
EXPORT_SYMBOL_GPL(mite_free_ring);
struct mite_channel *
mite_request_channel_in_range(struct mite *mite,
struct mite_dma_descriptor_ring *ring,
unsigned int min_channel,
unsigned int max_channel)
struct mite_channel *mite_request_channel_in_range(struct mite *mite,
struct mite_ring *ring,
unsigned int min_channel,
unsigned int max_channel)
{
int i;
unsigned long flags;
......@@ -468,7 +467,7 @@ EXPORT_SYMBOL_GPL(mite_dma_arm);
/**************************************/
int mite_buf_change(struct mite_dma_descriptor_ring *ring,
int mite_buf_change(struct mite_ring *ring,
struct comedi_subdevice *s)
{
struct comedi_async *async = s->async;
......@@ -512,7 +511,7 @@ EXPORT_SYMBOL_GPL(mite_buf_change);
* DMA data buffer. A command may call this function later to re-initialize and
* shorten the amount of memory that will be transferred.
*/
int mite_init_ring_descriptors(struct mite_dma_descriptor_ring *ring,
int mite_init_ring_descriptors(struct mite_ring *ring,
struct comedi_subdevice *s,
unsigned int nbytes)
{
......
......@@ -35,7 +35,7 @@ struct mite_dma_desc {
u32 dar;
};
struct mite_dma_descriptor_ring {
struct mite_ring {
struct device *hw_dev;
unsigned int n_links;
struct mite_dma_desc *descriptors;
......@@ -47,7 +47,7 @@ struct mite_channel {
unsigned int channel;
int dir;
int done;
struct mite_dma_descriptor_ring *ring;
struct mite_ring *ring;
};
struct mite {
......@@ -72,16 +72,15 @@ static inline int mite_setup(struct comedi_device *dev,
}
void mite_detach(struct mite *);
struct mite_dma_descriptor_ring *mite_alloc_ring(struct mite *);
void mite_free_ring(struct mite_dma_descriptor_ring *ring);
struct mite_channel *
mite_request_channel_in_range(struct mite *,
struct mite_dma_descriptor_ring *ring,
unsigned int min_channel,
unsigned int max_channel);
static inline struct mite_channel *
mite_request_channel(struct mite *mite,
struct mite_dma_descriptor_ring *ring)
struct mite_ring *mite_alloc_ring(struct mite *);
void mite_free_ring(struct mite_ring *ring);
struct mite_channel *mite_request_channel_in_range(struct mite *,
struct mite_ring *,
unsigned int min_channel,
unsigned int max_channel);
static inline struct mite_channel *mite_request_channel(struct mite *mite,
struct mite_ring *ring)
{
return mite_request_channel_in_range(mite, ring, 0,
mite->num_channels - 1);
......@@ -99,10 +98,8 @@ int mite_done(struct mite_channel *mite_chan);
void mite_prep_dma(struct mite_channel *mite_chan,
unsigned int num_device_bits, unsigned int num_memory_bits);
int mite_buf_change(struct mite_dma_descriptor_ring *ring,
struct comedi_subdevice *s);
int mite_init_ring_descriptors(struct mite_dma_descriptor_ring *ring,
struct comedi_subdevice *s,
int mite_buf_change(struct mite_ring *, struct comedi_subdevice *);
int mite_init_ring_descriptors(struct mite_ring *, struct comedi_subdevice *,
unsigned int nbytes);
/*
......
......@@ -255,8 +255,7 @@ static const struct ni_660x_board ni_660x_boards[] = {
struct ni_660x_private {
struct mite *mite;
struct ni_gpct_device *counter_dev;
struct mite_dma_descriptor_ring
*mite_rings[NI660X_MAX_CHIPS][NI660X_COUNTERS_PER_CHIP];
struct mite_ring *ring[NI660X_MAX_CHIPS][NI660X_COUNTERS_PER_CHIP];
/* protects mite channel request/release */
spinlock_t mite_channel_lock;
/* prevents races between interrupt and comedi_poll */
......@@ -339,12 +338,12 @@ static int ni_660x_request_mite_channel(struct comedi_device *dev,
enum comedi_io_direction direction)
{
struct ni_660x_private *devpriv = dev->private;
struct mite_dma_descriptor_ring *ring;
struct mite_ring *ring;
struct mite_channel *mite_chan;
unsigned long flags;
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
ring = devpriv->mite_rings[counter->chip_index][counter->counter_index];
ring = devpriv->ring[counter->chip_index][counter->counter_index];
mite_chan = mite_request_channel(devpriv->mite, ring);
if (!mite_chan) {
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
......@@ -470,10 +469,10 @@ static int ni_660x_buf_change(struct comedi_device *dev,
{
struct ni_660x_private *devpriv = dev->private;
struct ni_gpct *counter = s->private;
struct mite_dma_descriptor_ring *ring;
struct mite_ring *ring;
int ret;
ring = devpriv->mite_rings[counter->chip_index][counter->counter_index];
ring = devpriv->ring[counter->chip_index][counter->counter_index];
ret = mite_buf_change(ring, s);
if (ret < 0)
return ret;
......@@ -507,9 +506,8 @@ static int ni_660x_alloc_mite_rings(struct comedi_device *dev)
for (i = 0; i < board->n_chips; ++i) {
for (j = 0; j < NI660X_COUNTERS_PER_CHIP; ++j) {
devpriv->mite_rings[i][j] =
mite_alloc_ring(devpriv->mite);
if (!devpriv->mite_rings[i][j])
devpriv->ring[i][j] = mite_alloc_ring(devpriv->mite);
if (!devpriv->ring[i][j])
return -ENOMEM;
}
}
......@@ -525,7 +523,7 @@ static void ni_660x_free_mite_rings(struct comedi_device *dev)
for (i = 0; i < board->n_chips; ++i) {
for (j = 0; j < NI660X_COUNTERS_PER_CHIP; ++j)
mite_free_ring(devpriv->mite_rings[i][j]);
mite_free_ring(devpriv->ring[i][j]);
}
}
......
......@@ -1961,7 +1961,7 @@ static unsigned int ni_timer_to_ns(const struct comedi_device *dev, int timer)
return devpriv->clock_ns * (timer + 1);
}
static void ni_cmd_set_mite_transfer(struct mite_dma_descriptor_ring *ring,
static void ni_cmd_set_mite_transfer(struct mite_ring *ring,
struct comedi_subdevice *sdev,
const struct comedi_cmd *cmd,
unsigned int max_count) {
......
......@@ -289,7 +289,7 @@ struct nidio96_private {
int dio;
unsigned short OpModeBits;
struct mite_channel *di_mite_chan;
struct mite_dma_descriptor_ring *di_mite_ring;
struct mite_ring *di_mite_ring;
spinlock_t mite_channel_lock;
};
......
......@@ -1037,10 +1037,10 @@ struct ni_private {
struct mite_channel *ai_mite_chan;
struct mite_channel *ao_mite_chan;
struct mite_channel *cdo_mite_chan;
struct mite_dma_descriptor_ring *ai_mite_ring;
struct mite_dma_descriptor_ring *ao_mite_ring;
struct mite_dma_descriptor_ring *cdo_mite_ring;
struct mite_dma_descriptor_ring *gpct_mite_ring[NUM_GPCT];
struct mite_ring *ai_mite_ring;
struct mite_ring *ao_mite_ring;
struct mite_ring *cdo_mite_ring;
struct mite_ring *gpct_mite_ring[NUM_GPCT];
/* ni_pcimio board type flags (based on the boardinfo reg_type) */
unsigned int is_m_series:1;
......
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