Commit 6f97a28d authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: refactor aio_iiro_16 driver to remove forward declarations

Move the struct comedi_driver variable and the associated
attach/detach routines to remove the need for the forward
declarations.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 77114526
......@@ -67,30 +67,41 @@ struct aio_iiro_16_private {
#define devpriv ((struct aio_iiro_16_private *) dev->private)
static int aio_iiro_16_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int aio_iiro_16_dio_insn_bits_write(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
if (insn->n != 2)
return -EINVAL;
static int aio_iiro_16_detach(struct comedi_device *dev);
if (data[0]) {
s->state &= ~data[0];
s->state |= data[0] & data[1];
outb(s->state & 0xff, dev->iobase + AIO_IIRO_16_RELAY_0_7);
outb((s->state >> 8) & 0xff,
dev->iobase + AIO_IIRO_16_RELAY_8_15);
}
static struct comedi_driver driver_aio_iiro_16 = {
.driver_name = "aio_iiro_16",
.module = THIS_MODULE,
.attach = aio_iiro_16_attach,
.detach = aio_iiro_16_detach,
.board_name = &aio_iiro_16_boards[0].name,
.offset = sizeof(struct aio_iiro_16_board),
.num_names = ARRAY_SIZE(aio_iiro_16_boards),
};
data[1] = s->state;
return 2;
}
static int aio_iiro_16_dio_insn_bits_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
unsigned int *data)
{
if (insn->n != 2)
return -EINVAL;
static int aio_iiro_16_dio_insn_bits_write(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
data[1] = 0;
data[1] |= inb(dev->iobase + AIO_IIRO_16_INPUT_0_7);
data[1] |= inb(dev->iobase + AIO_IIRO_16_INPUT_8_15) << 8;
return 2;
}
static int aio_iiro_16_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
......@@ -148,53 +159,26 @@ static int aio_iiro_16_detach(struct comedi_device *dev)
return 0;
}
static int aio_iiro_16_dio_insn_bits_write(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
if (insn->n != 2)
return -EINVAL;
if (data[0]) {
s->state &= ~data[0];
s->state |= data[0] & data[1];
outb(s->state & 0xff, dev->iobase + AIO_IIRO_16_RELAY_0_7);
outb((s->state >> 8) & 0xff,
dev->iobase + AIO_IIRO_16_RELAY_8_15);
}
data[1] = s->state;
return 2;
}
static int aio_iiro_16_dio_insn_bits_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
if (insn->n != 2)
return -EINVAL;
data[1] = 0;
data[1] |= inb(dev->iobase + AIO_IIRO_16_INPUT_0_7);
data[1] |= inb(dev->iobase + AIO_IIRO_16_INPUT_8_15) << 8;
return 2;
}
static struct comedi_driver driver_aio_iiro_16 = {
.driver_name = "aio_iiro_16",
.module = THIS_MODULE,
.attach = aio_iiro_16_attach,
.detach = aio_iiro_16_detach,
.board_name = &aio_iiro_16_boards[0].name,
.offset = sizeof(struct aio_iiro_16_board),
.num_names = ARRAY_SIZE(aio_iiro_16_boards),
};
static int __init driver_aio_iiro_16_init_module(void)
{
return comedi_driver_register(&driver_aio_iiro_16);
}
module_init(driver_aio_iiro_16_init_module);
static void __exit driver_aio_iiro_16_cleanup_module(void)
{
comedi_driver_unregister(&driver_aio_iiro_16);
}
module_init(driver_aio_iiro_16_init_module);
module_exit(driver_aio_iiro_16_cleanup_module);
MODULE_AUTHOR("Comedi http://www.comedi.org");
......
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