Skip to content

Commit

Permalink
Staging: comedi: kcomedilib: kcomedilib_main.c: remove unused functions
Browse files Browse the repository at this point in the history
Remove the unused functions from the kcomedilib_main.c file as they are
not needed.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Greg Kroah-Hartman committed May 11, 2010
1 parent c9f7725 commit 6b18af1
Showing 1 changed file with 0 additions and 354 deletions.
354 changes: 0 additions & 354 deletions drivers/staging/comedi/kcomedilib/kcomedilib_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,6 @@ void *comedi_open(const char *filename)
}
EXPORT_SYMBOL(comedi_open);

void *comedi_open_old(unsigned int minor)
{
struct comedi_device_file_info *dev_file_info;
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)
return NULL;
dev = dev_file_info->device;

if (dev == NULL || !dev->attached)
return NULL;

return (void *)dev;
}

int comedi_close(void *d)
{
struct comedi_device *dev = (struct comedi_device *)d;
Expand All @@ -99,83 +80,6 @@ int comedi_close(void *d)
}
EXPORT_SYMBOL(comedi_close);

int comedi_loglevel(int newlevel)
{
return 0;
}

void comedi_perror(const char *message)
{
printk(KERN_ERR "%s: unknown error\n", message);
}

char *comedi_strerror(int err)
{
return "unknown error";
}

int comedi_fileno(void *d)
{
struct comedi_device *dev = (struct comedi_device *)d;

/* return something random */
return dev->minor;
}

int comedi_command(void *d, struct comedi_cmd *cmd)
{
struct comedi_device *dev = (struct comedi_device *)d;
struct comedi_subdevice *s;
struct comedi_async *async;
unsigned runflags;

if (cmd->subdev >= dev->n_subdevices)
return -ENODEV;

s = dev->subdevices + cmd->subdev;
if (s->type == COMEDI_SUBD_UNUSED)
return -EIO;

async = s->async;
if (async == NULL)
return -ENODEV;

if (s->busy)
return -EBUSY;
s->busy = d;

if (async->cb_mask & COMEDI_CB_EOS)
cmd->flags |= TRIG_WAKE_EOS;

async->cmd = *cmd;

runflags = SRF_RUNNING;

comedi_set_subdevice_runflags(s, ~0, runflags);

comedi_reset_async_buf(async);

return s->do_cmd(dev, s);
}

int comedi_command_test(void *d, struct comedi_cmd *cmd)
{
struct comedi_device *dev = (struct comedi_device *)d;
struct comedi_subdevice *s;

if (cmd->subdev >= dev->n_subdevices)
return -ENODEV;

s = dev->subdevices + cmd->subdev;
if (s->type == COMEDI_SUBD_UNUSED)
return -EIO;

if (s->async == NULL)
return -ENODEV;

return s->do_cmdtest(dev, s, cmd);
}

/*
* COMEDI_INSN
* perform an instruction
Expand Down Expand Up @@ -302,261 +206,3 @@ int comedi_do_insn(void *d, struct comedi_insn *insn)
return ret;
}

/*
COMEDI_LOCK
lock subdevice
arg:
subdevice number
reads:
none
writes:
none
necessary locking:
- ioctl/rt lock (this type)
- lock while subdevice busy
- lock while subdevice being programmed
*/
int comedi_lock(void *d, unsigned int subdevice)
{
struct comedi_device *dev = (struct comedi_device *)d;
struct comedi_subdevice *s;
unsigned long flags;
int ret = 0;

if (subdevice >= dev->n_subdevices)
return -EINVAL;

s = dev->subdevices + subdevice;

spin_lock_irqsave(&s->spin_lock, flags);

if (s->busy) {
ret = -EBUSY;
} else {
if (s->lock) {
ret = -EBUSY;
} else {
s->lock = d;
}
}

spin_unlock_irqrestore(&s->spin_lock, flags);

return ret;
}

/*
COMEDI_UNLOCK
unlock subdevice
arg:
subdevice number
reads:
none
writes:
none
*/
int comedi_unlock(void *d, unsigned int subdevice)
{
struct comedi_device *dev = (struct comedi_device *)d;
struct comedi_subdevice *s;
unsigned long flags;
struct comedi_async *async;
int ret;

if (subdevice >= dev->n_subdevices)
return -EINVAL;

s = dev->subdevices + subdevice;

async = s->async;

spin_lock_irqsave(&s->spin_lock, flags);

if (s->busy) {
ret = -EBUSY;
} else if (s->lock && s->lock != (void *)d) {
ret = -EACCES;
} else {
s->lock = NULL;

if (async) {
async->cb_mask = 0;
async->cb_func = NULL;
async->cb_arg = NULL;
}

ret = 0;
}

spin_unlock_irqrestore(&s->spin_lock, flags);

return ret;
}

/*
COMEDI_CANCEL
cancel acquisition ioctl
arg:
subdevice number
reads:
nothing
writes:
nothing
*/
int comedi_cancel(void *d, unsigned int subdevice)
{
struct comedi_device *dev = (struct comedi_device *)d;
struct comedi_subdevice *s;
int ret = 0;

if (subdevice >= dev->n_subdevices)
return -EINVAL;

s = dev->subdevices + subdevice;

if (s->lock && s->lock != d)
return -EACCES;

#if 0
if (!s->busy)
return 0;

if (s->busy != d)
return -EBUSY;
#endif

if (!s->cancel || !s->async)
return -EINVAL;

ret = s->cancel(dev, s);

if (ret)
return ret;

comedi_set_subdevice_runflags(s, SRF_RUNNING | SRF_RT, 0);
s->async->inttrig = NULL;
s->busy = NULL;

return 0;
}

/*
registration of callback functions
*/
int comedi_register_callback(void *d, unsigned int subdevice,
unsigned int mask, int (*cb) (unsigned int,
void *), void *arg)
{
struct comedi_device *dev = (struct comedi_device *)d;
struct comedi_subdevice *s;
struct comedi_async *async;

if (subdevice >= dev->n_subdevices)
return -EINVAL;

s = dev->subdevices + subdevice;

async = s->async;
if (s->type == COMEDI_SUBD_UNUSED || !async)
return -EIO;

/* are we locked? (ioctl lock) */
if (s->lock && s->lock != d)
return -EACCES;

/* are we busy? */
if (s->busy)
return -EBUSY;

if (!mask) {
async->cb_mask = 0;
async->cb_func = NULL;
async->cb_arg = NULL;
} else {
async->cb_mask = mask;
async->cb_func = cb;
async->cb_arg = arg;
}

return 0;
}

int comedi_poll(void *d, unsigned int subdevice)
{
struct comedi_device *dev = (struct comedi_device *)d;
struct comedi_subdevice *s = dev->subdevices;
struct comedi_async *async;

if (subdevice >= dev->n_subdevices)
return -EINVAL;

s = dev->subdevices + subdevice;

async = s->async;
if (s->type == COMEDI_SUBD_UNUSED || !async)
return -EIO;

/* are we locked? (ioctl lock) */
if (s->lock && s->lock != d)
return -EACCES;

/* are we running? XXX wrong? */
if (!s->busy)
return -EIO;

return s->poll(dev, s);
}

/* WARNING: not portable */
int comedi_map(void *d, unsigned int subdevice, void *ptr)
{
struct comedi_device *dev = (struct comedi_device *)d;
struct comedi_subdevice *s;

if (subdevice >= dev->n_subdevices)
return -EINVAL;

s = dev->subdevices + subdevice;

if (!s->async)
return -EINVAL;

if (ptr)
*((void **)ptr) = s->async->prealloc_buf;

/* XXX no reference counting */

return 0;
}

/* WARNING: not portable */
int comedi_unmap(void *d, unsigned int subdevice)
{
struct comedi_device *dev = (struct comedi_device *)d;
struct comedi_subdevice *s;

if (subdevice >= dev->n_subdevices)
return -EINVAL;

s = dev->subdevices + subdevice;

if (!s->async)
return -EINVAL;

/* XXX no reference counting */

return 0;
}

0 comments on commit 6b18af1

Please sign in to comment.