diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-05 11:06:45 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-05 11:06:45 -0700 |
commit | 3516c6a8dc0b1153c611c4cf0dc4a51631f052bb (patch) | |
tree | c54a5fc916cbe73e43dee20902642f367f44a551 /drivers/staging/comedi/kcomedilib/kcomedilib_main.c | |
parent | 714f83d5d9f7c785f622259dad1f4fad12d64664 (diff) | |
parent | ba0e1ebb7ea0616eebc29d2077355bacea62a9d8 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (714 commits)
Staging: sxg: slicoss: Specify the license for Sahara SXG and Slicoss drivers
Staging: serqt_usb: fix build due to proc tty changes
Staging: serqt_usb: fix checkpatch errors
Staging: serqt_usb: add TODO file
Staging: serqt_usb: Lindent the code
Staging: add USB serial Quatech driver
staging: document that the wifi staging drivers a bit better
Staging: echo cleanup
Staging: BUG to BUG_ON changes
Staging: remove some pointless conditionals before kfree_skb()
Staging: line6: fix build error, select SND_RAWMIDI
Staging: line6: fix checkpatch errors in variax.c
Staging: line6: fix checkpatch errors in toneport.c
Staging: line6: fix checkpatch errors in pcm.c
Staging: line6: fix checkpatch errors in midibuf.c
Staging: line6: fix checkpatch errors in midi.c
Staging: line6: fix checkpatch errors in dumprequest.c
Staging: line6: fix checkpatch errors in driver.c
Staging: line6: fix checkpatch errors in audio.c
Staging: line6: fix checkpatch errors in pod.c
...
Diffstat (limited to 'drivers/staging/comedi/kcomedilib/kcomedilib_main.c')
-rw-r--r-- | drivers/staging/comedi/kcomedilib/kcomedilib_main.c | 138 |
1 files changed, 70 insertions, 68 deletions
diff --git a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c index 510fbdcec49..a4fa9571c58 100644 --- a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c +++ b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c @@ -42,10 +42,10 @@ MODULE_AUTHOR("David Schleef <ds@schleef.org>"); MODULE_DESCRIPTION("Comedi kernel library"); MODULE_LICENSE("GPL"); -comedi_t *comedi_open(const char *filename) +void *comedi_open(const char *filename) { struct comedi_device_file_info *dev_file_info; - comedi_device *dev; + struct comedi_device *dev; unsigned int minor; if (strncmp(filename, "/dev/comedi", 11) != 0) @@ -57,41 +57,41 @@ comedi_t *comedi_open(const char *filename) return NULL; dev_file_info = comedi_get_device_file_info(minor); - if(dev_file_info == NULL) + if (dev_file_info == NULL) return NULL; dev = dev_file_info->device; - if(dev == NULL || !dev->attached) + if (dev == NULL || !dev->attached) return NULL; if (!try_module_get(dev->driver->module)) return NULL; - return (comedi_t *) dev; + return (void *) dev; } -comedi_t *comedi_open_old(unsigned int minor) +void *comedi_open_old(unsigned int minor) { struct comedi_device_file_info *dev_file_info; - comedi_device *dev; + struct comedi_device *dev; if (minor >= COMEDI_NUM_MINORS) return NULL; dev_file_info = comedi_get_device_file_info(minor); - if(dev_file_info == NULL) + if (dev_file_info == NULL) return NULL; dev = dev_file_info->device; - if(dev == NULL || !dev->attached) + if (dev == NULL || !dev->attached) return NULL; - return (comedi_t *) dev; + return (void *) dev; } -int comedi_close(comedi_t * d) +int comedi_close(void *d) { - comedi_device *dev = (comedi_device *) d; + struct comedi_device *dev = (struct comedi_device *) d; module_put(dev->driver->module); @@ -113,19 +113,19 @@ char *comedi_strerror(int err) return "unknown error"; } -int comedi_fileno(comedi_t * d) +int comedi_fileno(void *d) { - comedi_device *dev = (comedi_device *) d; + struct comedi_device *dev = (struct comedi_device *) d; /* return something random */ return dev->minor; } -int comedi_command(comedi_t * d, comedi_cmd * cmd) +int comedi_command(void *d, struct comedi_cmd *cmd) { - comedi_device *dev = (comedi_device *) d; - comedi_subdevice *s; - comedi_async *async; + struct comedi_device *dev = (struct comedi_device *) d; + struct comedi_subdevice *s; + struct comedi_async *async; unsigned runflags; if (cmd->subdev >= dev->n_subdevices) @@ -161,10 +161,10 @@ int comedi_command(comedi_t * d, comedi_cmd * cmd) return s->do_cmd(dev, s); } -int comedi_command_test(comedi_t * d, comedi_cmd * cmd) +int comedi_command_test(void *d, struct comedi_cmd *cmd) { - comedi_device *dev = (comedi_device *) d; - comedi_subdevice *s; + struct comedi_device *dev = (struct comedi_device *) d; + struct comedi_subdevice *s; if (cmd->subdev >= dev->n_subdevices) return -ENODEV; @@ -183,10 +183,10 @@ int comedi_command_test(comedi_t * d, comedi_cmd * cmd) * COMEDI_INSN * perform an instruction */ -int comedi_do_insn(comedi_t * d, comedi_insn * insn) +int comedi_do_insn(void *d, struct comedi_insn *insn) { - comedi_device *dev = (comedi_device *) d; - comedi_subdevice *s; + struct comedi_device *dev = (struct comedi_device *) d; + struct comedi_subdevice *s; int ret = 0; if (insn->insn & INSN_MASK_SPECIAL) { @@ -256,7 +256,8 @@ int comedi_do_insn(comedi_t * d, comedi_insn * insn) /* XXX check lock */ - if ((ret = check_chanlist(s, 1, &insn->chanspec)) < 0) { + ret = check_chanlist(s, 1, &insn->chanspec); + if (ret < 0) { rt_printk("bad chanspec\n"); ret = -EINVAL; goto error; @@ -323,16 +324,16 @@ int comedi_do_insn(comedi_t * d, comedi_insn * insn) - lock while subdevice being programmed */ -int comedi_lock(comedi_t * d, unsigned int subdevice) +int comedi_lock(void *d, unsigned int subdevice) { - comedi_device *dev = (comedi_device *) d; - comedi_subdevice *s; + struct comedi_device *dev = (struct comedi_device *) d; + struct comedi_subdevice *s; unsigned long flags; int ret = 0; - if (subdevice >= dev->n_subdevices) { + if (subdevice >= dev->n_subdevices) return -EINVAL; - } + s = dev->subdevices + subdevice; comedi_spin_lock_irqsave(&s->spin_lock, flags); @@ -366,17 +367,17 @@ int comedi_lock(comedi_t * d, unsigned int subdevice) none */ -int comedi_unlock(comedi_t * d, unsigned int subdevice) +int comedi_unlock(void *d, unsigned int subdevice) { - comedi_device *dev = (comedi_device *) d; - comedi_subdevice *s; + struct comedi_device *dev = (struct comedi_device *) d; + struct comedi_subdevice *s; unsigned long flags; - comedi_async *async; + struct comedi_async *async; int ret; - if (subdevice >= dev->n_subdevices) { + if (subdevice >= dev->n_subdevices) return -EINVAL; - } + s = dev->subdevices + subdevice; async = s->async; @@ -418,15 +419,15 @@ int comedi_unlock(comedi_t * d, unsigned int subdevice) nothing */ -int comedi_cancel(comedi_t * d, unsigned int subdevice) +int comedi_cancel(void *d, unsigned int subdevice) { - comedi_device *dev = (comedi_device *) d; - comedi_subdevice *s; + struct comedi_device *dev = (struct comedi_device *) d; + struct comedi_subdevice *s; int ret = 0; - if (subdevice >= dev->n_subdevices) { + if (subdevice >= dev->n_subdevices) return -EINVAL; - } + s = dev->subdevices + subdevice; if (s->lock && s->lock != d) @@ -443,13 +444,15 @@ int comedi_cancel(comedi_t * d, unsigned int subdevice) if (!s->cancel || !s->async) return -EINVAL; - if ((ret = s->cancel(dev, s))) + ret = s->cancel(dev, s); + + if (ret) return ret; #ifdef CONFIG_COMEDI_RT - if (comedi_get_subdevice_runflags(s) & SRF_RT) { + if (comedi_get_subdevice_runflags(s) & SRF_RT) comedi_switch_to_non_rt(dev); - } + #endif comedi_set_subdevice_runflags(s, SRF_RUNNING | SRF_RT, 0); s->async->inttrig = NULL; @@ -461,16 +464,16 @@ int comedi_cancel(comedi_t * d, unsigned int subdevice) /* registration of callback functions */ -int comedi_register_callback(comedi_t * d, unsigned int subdevice, +int comedi_register_callback(void *d, unsigned int subdevice, unsigned int mask, int (*cb) (unsigned int, void *), void *arg) { - comedi_device *dev = (comedi_device *) d; - comedi_subdevice *s; - comedi_async *async; + struct comedi_device *dev = (struct comedi_device *) d; + struct comedi_subdevice *s; + struct comedi_async *async; - if (subdevice >= dev->n_subdevices) { + if (subdevice >= dev->n_subdevices) return -EINVAL; - } + s = dev->subdevices + subdevice; async = s->async; @@ -498,15 +501,15 @@ int comedi_register_callback(comedi_t * d, unsigned int subdevice, return 0; } -int comedi_poll(comedi_t * d, unsigned int subdevice) +int comedi_poll(void *d, unsigned int subdevice) { - comedi_device *dev = (comedi_device *) d; - comedi_subdevice *s = dev->subdevices; - comedi_async *async; + struct comedi_device *dev = (struct comedi_device *) d; + struct comedi_subdevice *s = dev->subdevices; + struct comedi_async *async; - if (subdevice >= dev->n_subdevices) { + if (subdevice >= dev->n_subdevices) return -EINVAL; - } + s = dev->subdevices + subdevice; async = s->async; @@ -525,22 +528,21 @@ int comedi_poll(comedi_t * d, unsigned int subdevice) } /* WARNING: not portable */ -int comedi_map(comedi_t * d, unsigned int subdevice, void *ptr) +int comedi_map(void *d, unsigned int subdevice, void *ptr) { - comedi_device *dev = (comedi_device *) d; - comedi_subdevice *s; + struct comedi_device *dev = (struct comedi_device *) d; + struct comedi_subdevice *s; - if (subdevice >= dev->n_subdevices) { + if (subdevice >= dev->n_subdevices) return -EINVAL; - } + s = dev->subdevices + subdevice; if (!s->async) return -EINVAL; - if (ptr) { + if (ptr) *((void **)ptr) = s->async->prealloc_buf; - } /* XXX no reference counting */ @@ -548,14 +550,14 @@ int comedi_map(comedi_t * d, unsigned int subdevice, void *ptr) } /* WARNING: not portable */ -int comedi_unmap(comedi_t * d, unsigned int subdevice) +int comedi_unmap(void *d, unsigned int subdevice) { - comedi_device *dev = (comedi_device *) d; - comedi_subdevice *s; + struct comedi_device *dev = (struct comedi_device *) d; + struct comedi_subdevice *s; - if (subdevice >= dev->n_subdevices) { + if (subdevice >= dev->n_subdevices) return -EINVAL; - } + s = dev->subdevices + subdevice; if (!s->async) |