Skip to content

Commit

Permalink
Staging: comedi: Remove comedi_async typedef
Browse files Browse the repository at this point in the history
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Bill Pemberton authored and Greg Kroah-Hartman committed Apr 3, 2009
1 parent 34c4392 commit d163679
Show file tree
Hide file tree
Showing 27 changed files with 127 additions and 124 deletions.
18 changes: 9 additions & 9 deletions drivers/staging/comedi/comedi_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ static int do_devconfig_ioctl(struct comedi_device *dev, comedi_devconfig *arg)
static int do_bufconfig_ioctl(struct comedi_device *dev, void *arg)
{
comedi_bufconfig bc;
comedi_async *async;
struct comedi_async *async;
struct comedi_subdevice *s;
int ret = 0;

Expand Down Expand Up @@ -558,7 +558,7 @@ static int do_bufinfo_ioctl(struct comedi_device *dev, void *arg)
{
comedi_bufinfo bi;
struct comedi_subdevice *s;
comedi_async *async;
struct comedi_async *async;

if (copy_from_user(&bi, arg, sizeof(comedi_bufinfo)))
return -EFAULT;
Expand Down Expand Up @@ -979,7 +979,7 @@ static int do_cmd_ioctl(struct comedi_device *dev, void *arg, void *file)
{
comedi_cmd user_cmd;
struct comedi_subdevice *s;
comedi_async *async;
struct comedi_async *async;
int ret = 0;
unsigned int *chanlist_saver = NULL;

Expand Down Expand Up @@ -1384,7 +1384,7 @@ static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s)

void comedi_unmap(struct vm_area_struct *area)
{
comedi_async *async;
struct comedi_async *async;
struct comedi_device *dev;

async = area->vm_private_data;
Expand All @@ -1405,7 +1405,7 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma)
struct comedi_device_file_info *dev_file_info =
comedi_get_device_file_info(minor);
struct comedi_device *dev = dev_file_info->device;
comedi_async *async = NULL;
struct comedi_async *async = NULL;
unsigned long start = vma->vm_start;
unsigned long size;
int n_pages;
Expand Down Expand Up @@ -1524,7 +1524,7 @@ static ssize_t comedi_write(struct file *file, const char *buf, size_t nbytes,
loff_t *offset)
{
struct comedi_subdevice *s;
comedi_async *async;
struct comedi_async *async;
int n, m, count = 0, retval = 0;
DECLARE_WAITQUEUE(wait, current);
const unsigned minor = iminor(file->f_dentry->d_inode);
Expand Down Expand Up @@ -1626,7 +1626,7 @@ static ssize_t comedi_read(struct file *file, char *buf, size_t nbytes,
loff_t *offset)
{
struct comedi_subdevice *s;
comedi_async *async;
struct comedi_async *async;
int n, m, count = 0, retval = 0;
DECLARE_WAITQUEUE(wait, current);
const unsigned minor = iminor(file->f_dentry->d_inode);
Expand Down Expand Up @@ -1735,7 +1735,7 @@ static ssize_t comedi_read(struct file *file, char *buf, size_t nbytes,
*/
void do_become_nonbusy(struct comedi_device *dev, struct comedi_subdevice *s)
{
comedi_async *async = s->async;
struct comedi_async *async = s->async;

comedi_set_subdevice_runflags(s, SRF_RUNNING, 0);
#ifdef CONFIG_COMEDI_RT
Expand Down Expand Up @@ -2008,7 +2008,7 @@ void comedi_error(const struct comedi_device *dev, const char *s)

void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s)
{
comedi_async *async = s->async;
struct comedi_async *async = s->async;
unsigned runflags = 0;
unsigned runflags_mask = 0;

Expand Down
33 changes: 16 additions & 17 deletions drivers/staging/comedi/comedidev.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@
#define COMEDI_NUM_BOARD_MINORS 0x30
#define COMEDI_FIRST_SUBDEVICE_MINOR COMEDI_NUM_BOARD_MINORS

typedef struct comedi_async_struct comedi_async;
typedef struct comedi_driver_struct comedi_driver;
typedef struct comedi_lrange_struct comedi_lrange;

Expand All @@ -139,7 +138,7 @@ struct comedi_subdevice {

void *private;

comedi_async *async;
struct comedi_async *async;

void *lock;
void *busy;
Expand Down Expand Up @@ -196,7 +195,7 @@ struct comedi_buf_page {
dma_addr_t dma_addr;
};

struct comedi_async_struct {
struct comedi_async {
struct comedi_subdevice *subdevice;

void *prealloc_buf; /* pre-allocated buffer */
Expand Down Expand Up @@ -469,31 +468,31 @@ static inline void comedi_set_hw_dev(struct comedi_device *dev, struct device *h
}
}

int comedi_buf_put(comedi_async *async, short x);
int comedi_buf_get(comedi_async *async, short *x);
int comedi_buf_put(struct comedi_async *async, short x);
int comedi_buf_get(struct comedi_async *async, short *x);

unsigned int comedi_buf_write_n_available(comedi_async *async);
unsigned int comedi_buf_write_alloc(comedi_async *async, unsigned int nbytes);
unsigned int comedi_buf_write_alloc_strict(comedi_async *async,
unsigned int comedi_buf_write_n_available(struct comedi_async *async);
unsigned int comedi_buf_write_alloc(struct comedi_async *async, unsigned int nbytes);
unsigned int comedi_buf_write_alloc_strict(struct comedi_async *async,
unsigned int nbytes);
unsigned comedi_buf_write_free(comedi_async *async, unsigned int nbytes);
unsigned comedi_buf_read_alloc(comedi_async *async, unsigned nbytes);
unsigned comedi_buf_read_free(comedi_async *async, unsigned int nbytes);
unsigned int comedi_buf_read_n_available(comedi_async *async);
void comedi_buf_memcpy_to(comedi_async *async, unsigned int offset,
unsigned comedi_buf_write_free(struct comedi_async *async, unsigned int nbytes);
unsigned comedi_buf_read_alloc(struct comedi_async *async, unsigned nbytes);
unsigned comedi_buf_read_free(struct comedi_async *async, unsigned int nbytes);
unsigned int comedi_buf_read_n_available(struct comedi_async *async);
void comedi_buf_memcpy_to(struct comedi_async *async, unsigned int offset,
const void *source, unsigned int num_bytes);
void comedi_buf_memcpy_from(comedi_async *async, unsigned int offset,
void comedi_buf_memcpy_from(struct comedi_async *async, unsigned int offset,
void *destination, unsigned int num_bytes);
static inline unsigned comedi_buf_write_n_allocated(comedi_async *async)
static inline unsigned comedi_buf_write_n_allocated(struct comedi_async *async)
{
return async->buf_write_alloc_count - async->buf_write_count;
}
static inline unsigned comedi_buf_read_n_allocated(comedi_async *async)
static inline unsigned comedi_buf_read_n_allocated(struct comedi_async *async)
{
return async->buf_read_alloc_count - async->buf_read_count;
}

void comedi_reset_async_buf(comedi_async *async);
void comedi_reset_async_buf(struct comedi_async *async);

static inline void *comedi_aux_data(int options[], int n)
{
Expand Down
32 changes: 16 additions & 16 deletions drivers/staging/comedi/drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static int postconfig(struct comedi_device *dev)
{
int i;
struct comedi_subdevice *s;
comedi_async *async = NULL;
struct comedi_async *async = NULL;
int ret;

for (i = 0; i < dev->n_subdevices; i++) {
Expand All @@ -245,7 +245,7 @@ static int postconfig(struct comedi_device *dev)
SDF_CMD_WRITE)) == 0);
BUG_ON(!s->do_cmdtest);

async = kzalloc(sizeof(comedi_async), GFP_KERNEL);
async = kzalloc(sizeof(struct comedi_async), GFP_KERNEL);
if (async == NULL) {
printk("failed to allocate async struct\n");
return -ENOMEM;
Expand Down Expand Up @@ -415,7 +415,7 @@ static inline unsigned long kvirt_to_kva(unsigned long adr)
int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
unsigned long new_size)
{
comedi_async *async = s->async;
struct comedi_async *async = s->async;

/* Round up new_size to multiple of PAGE_SIZE */
new_size = (new_size + PAGE_SIZE - 1) & PAGE_MASK;
Expand Down Expand Up @@ -536,7 +536,7 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,

/* munging is applied to data by core as it passes between user
* and kernel space */
unsigned int comedi_buf_munge(comedi_async *async, unsigned int num_bytes)
unsigned int comedi_buf_munge(struct comedi_async *async, unsigned int num_bytes)
{
struct comedi_subdevice *s = async->subdevice;
unsigned int count = 0;
Expand Down Expand Up @@ -580,7 +580,7 @@ unsigned int comedi_buf_munge(comedi_async *async, unsigned int num_bytes)
return count;
}

unsigned int comedi_buf_write_n_available(comedi_async *async)
unsigned int comedi_buf_write_n_available(struct comedi_async *async)
{
unsigned int free_end;
unsigned int nbytes;
Expand All @@ -600,7 +600,7 @@ unsigned int comedi_buf_write_n_available(comedi_async *async)
}

/* allocates chunk for the writer from free buffer space */
unsigned int comedi_buf_write_alloc(comedi_async *async, unsigned int nbytes)
unsigned int comedi_buf_write_alloc(struct comedi_async *async, unsigned int nbytes)
{
unsigned int free_end = async->buf_read_count + async->prealloc_bufsz;

Expand All @@ -615,7 +615,7 @@ unsigned int comedi_buf_write_alloc(comedi_async *async, unsigned int nbytes)
}

/* allocates nothing unless it can completely fulfill the request */
unsigned int comedi_buf_write_alloc_strict(comedi_async *async,
unsigned int comedi_buf_write_alloc_strict(struct comedi_async *async,
unsigned int nbytes)
{
unsigned int free_end = async->buf_read_count + async->prealloc_bufsz;
Expand All @@ -631,7 +631,7 @@ unsigned int comedi_buf_write_alloc_strict(comedi_async *async,
}

/* transfers a chunk from writer to filled buffer space */
unsigned comedi_buf_write_free(comedi_async *async, unsigned int nbytes)
unsigned comedi_buf_write_free(struct comedi_async *async, unsigned int nbytes)
{
if ((int)(async->buf_write_count + nbytes -
async->buf_write_alloc_count) > 0) {
Expand All @@ -649,7 +649,7 @@ unsigned comedi_buf_write_free(comedi_async *async, unsigned int nbytes)
}

/* allocates a chunk for the reader from filled (and munged) buffer space */
unsigned comedi_buf_read_alloc(comedi_async *async, unsigned nbytes)
unsigned comedi_buf_read_alloc(struct comedi_async *async, unsigned nbytes)
{
if ((int)(async->buf_read_alloc_count + nbytes - async->munge_count) >
0) {
Expand All @@ -663,7 +663,7 @@ unsigned comedi_buf_read_alloc(comedi_async *async, unsigned nbytes)
}

/* transfers control of a chunk from reader to free buffer space */
unsigned comedi_buf_read_free(comedi_async *async, unsigned int nbytes)
unsigned comedi_buf_read_free(struct comedi_async *async, unsigned int nbytes)
{
/* barrier insures data has been read out of buffer before read count is incremented */
smp_mb();
Expand All @@ -679,7 +679,7 @@ unsigned comedi_buf_read_free(comedi_async *async, unsigned int nbytes)
return nbytes;
}

void comedi_buf_memcpy_to(comedi_async *async, unsigned int offset,
void comedi_buf_memcpy_to(struct comedi_async *async, unsigned int offset,
const void *data, unsigned int num_bytes)
{
unsigned int write_ptr = async->buf_write_ptr + offset;
Expand All @@ -704,7 +704,7 @@ void comedi_buf_memcpy_to(comedi_async *async, unsigned int offset,
}
}

void comedi_buf_memcpy_from(comedi_async *async, unsigned int offset,
void comedi_buf_memcpy_from(struct comedi_async *async, unsigned int offset,
void *dest, unsigned int nbytes)
{
void *src;
Expand All @@ -730,7 +730,7 @@ void comedi_buf_memcpy_from(comedi_async *async, unsigned int offset,
}
}

unsigned int comedi_buf_read_n_available(comedi_async *async)
unsigned int comedi_buf_read_n_available(struct comedi_async *async)
{
unsigned num_bytes;

Expand All @@ -745,7 +745,7 @@ unsigned int comedi_buf_read_n_available(comedi_async *async)
return num_bytes;
}

int comedi_buf_get(comedi_async *async, short *x)
int comedi_buf_get(struct comedi_async *async, short *x)
{
unsigned int n = comedi_buf_read_n_available(async);

Expand All @@ -757,7 +757,7 @@ int comedi_buf_get(comedi_async *async, short *x)
return 1;
}

int comedi_buf_put(comedi_async *async, short x)
int comedi_buf_put(struct comedi_async *async, short x)
{
unsigned int n = comedi_buf_write_alloc_strict(async, sizeof(short));

Expand All @@ -770,7 +770,7 @@ int comedi_buf_put(comedi_async *async, short x)
return 1;
}

void comedi_reset_async_buf(comedi_async *async)
void comedi_reset_async_buf(struct comedi_async *async)
{
async->buf_write_alloc_count = 0;
async->buf_write_count = 0;
Expand Down
9 changes: 5 additions & 4 deletions drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
Original file line number Diff line number Diff line change
Expand Up @@ -1630,14 +1630,15 @@ void v_APCI3120_Interrupt(int irq, void *d)
+----------------------------------------------------------------------------+
*/

/*int i_APCI3120_InterruptHandleEos(struct comedi_device *dev)
/*
* int i_APCI3120_InterruptHandleEos(struct comedi_device *dev)
{
int n_chan,i;
short *data;
struct comedi_subdevice *s=dev->subdevices+0;
comedi_async *async = s->async;
data=async->data+async->buf_int_ptr;//new samples added from here onwards
n_chan=devpriv->ui_AiNbrofChannels;
struct comedi_async *async = s->async;
data=async->data+async->buf_int_ptr;
n_chan=devpriv->ui_AiNbrofChannels;
for(i=0;i<n_chan;i++)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/comedi/drivers/adl_pci9111.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device PT_REGS_ARG)
{
struct comedi_device *dev = p_device;
struct comedi_subdevice *subdevice = dev->read_subdev;
comedi_async *async;
struct comedi_async *async;
unsigned long irq_flags;
unsigned char intcsr;

Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/comedi/drivers/amplc_pci224.c
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ static void
pci224_ao_munge(struct comedi_device * dev, struct comedi_subdevice * s, void *data,
unsigned int num_bytes, unsigned int chan_index)
{
comedi_async *async = s->async;
struct comedi_async *async = s->async;
short *array = data;
unsigned int length = num_bytes / sizeof(*array);
unsigned int offset;
Expand Down
12 changes: 6 additions & 6 deletions drivers/staging/comedi/drivers/amplc_pci230.c
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ static int pci230_ao_inttrig_scan_begin(struct comedi_device * dev,

static void pci230_ao_start(struct comedi_device * dev, struct comedi_subdevice * s)
{
comedi_async *async = s->async;
struct comedi_async *async = s->async;
comedi_cmd *cmd = &async->cmd;
unsigned long irqflags;

Expand Down Expand Up @@ -2147,7 +2147,7 @@ static void pci230_ai_start(struct comedi_device * dev, struct comedi_subdevice
{
unsigned long irqflags;
unsigned short conv;
comedi_async *async = s->async;
struct comedi_async *async = s->async;
comedi_cmd *cmd = &async->cmd;

set_bit(AI_CMD_STARTED, &devpriv->state);
Expand Down Expand Up @@ -2300,7 +2300,7 @@ static int pci230_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s
unsigned char zgat;

/* Get the command. */
comedi_async *async = s->async;
struct comedi_async *async = s->async;
comedi_cmd *cmd = &async->cmd;

/*
Expand Down Expand Up @@ -2626,7 +2626,7 @@ static void pci230_handle_ao_nofifo(struct comedi_device * dev, struct comedi_su
{
short data;
int i, ret;
comedi_async *async = s->async;
struct comedi_async *async = s->async;
comedi_cmd *cmd = &async->cmd;

if (!devpriv->ao_continuous && (devpriv->ao_scan_count == 0)) {
Expand Down Expand Up @@ -2661,7 +2661,7 @@ static void pci230_handle_ao_nofifo(struct comedi_device * dev, struct comedi_su
/* Returns 0 if AO finished due to completion or error, 1 if still going. */
static int pci230_handle_ao_fifo(struct comedi_device * dev, struct comedi_subdevice * s)
{
comedi_async *async = s->async;
struct comedi_async *async = s->async;
comedi_cmd *cmd = &async->cmd;
unsigned int num_scans;
unsigned int room;
Expand Down Expand Up @@ -2769,7 +2769,7 @@ static void pci230_handle_ai(struct comedi_device * dev, struct comedi_subdevice
unsigned int i;
unsigned int todo;
unsigned int fifoamount;
comedi_async *async = s->async;
struct comedi_async *async = s->async;
unsigned int scanlen = async->cmd.scan_end_arg;

/* Determine number of samples to read. */
Expand Down
Loading

0 comments on commit d163679

Please sign in to comment.