staging: comedi: pcmmio: remove boardinfo
This driver only supports a single "boardtype". Remove the unneeded boardinfo struct and its use in the driver. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
04a542d4f7
commit
1633912541
@ -145,35 +145,6 @@ Configuration Options:
|
||||
#define PAGE_ENAB 2
|
||||
#define PAGE_INT_ID 3
|
||||
|
||||
/*
|
||||
* Board descriptions for two imaginary boards. Describing the
|
||||
* boards in this way is optional, and completely driver-dependent.
|
||||
* Some drivers use arrays such as this, other do not.
|
||||
*/
|
||||
struct pcmmio_board {
|
||||
const char *name;
|
||||
const int dio_num_asics;
|
||||
const int dio_num_ports;
|
||||
const int total_iosize;
|
||||
const int ai_bits;
|
||||
const int ao_bits;
|
||||
const int n_ai_chans;
|
||||
const int n_ao_chans;
|
||||
const struct comedi_lrange *ai_range_table, *ao_range_table;
|
||||
int (*ai_rinsn) (struct comedi_device *dev,
|
||||
struct comedi_subdevice *s,
|
||||
struct comedi_insn *insn,
|
||||
unsigned int *data);
|
||||
int (*ao_rinsn) (struct comedi_device *dev,
|
||||
struct comedi_subdevice *s,
|
||||
struct comedi_insn *insn,
|
||||
unsigned int *data);
|
||||
int (*ao_winsn) (struct comedi_device *dev,
|
||||
struct comedi_subdevice *s,
|
||||
struct comedi_insn *insn,
|
||||
unsigned int *data);
|
||||
};
|
||||
|
||||
static const struct comedi_lrange ranges_ai = {
|
||||
4, {RANGE(-5., 5.), RANGE(-10., 10.), RANGE(0., 5.), RANGE(0., 10.)}
|
||||
};
|
||||
@ -416,9 +387,7 @@ static int pcmmio_dio_insn_config(struct comedi_device *dev,
|
||||
|
||||
static void switch_page(struct comedi_device *dev, int asic, int page)
|
||||
{
|
||||
const struct pcmmio_board *board = comedi_board(dev);
|
||||
|
||||
if (asic < 0 || asic >= board->dio_num_asics)
|
||||
if (asic < 0 || asic >= 1)
|
||||
return; /* paranoia */
|
||||
if (page < 0 || page >= NUM_PAGES)
|
||||
return; /* more paranoia */
|
||||
@ -434,10 +403,9 @@ static void switch_page(struct comedi_device *dev, int asic, int page)
|
||||
static void init_asics(struct comedi_device *dev)
|
||||
{ /* sets up an
|
||||
ASIC chip to defaults */
|
||||
const struct pcmmio_board *board = comedi_board(dev);
|
||||
int asic;
|
||||
|
||||
for (asic = 0; asic < board->dio_num_asics; ++asic) {
|
||||
for (asic = 0; asic < 1; ++asic) {
|
||||
int port, page;
|
||||
unsigned long baseaddr = devpriv->asics[asic].iobase;
|
||||
|
||||
@ -472,9 +440,7 @@ static void init_asics(struct comedi_device *dev)
|
||||
#ifdef notused
|
||||
static void lock_port(struct comedi_device *dev, int asic, int port)
|
||||
{
|
||||
const struct pcmmio_board *board = comedi_board(dev);
|
||||
|
||||
if (asic < 0 || asic >= board->dio_num_asics)
|
||||
if (asic < 0 || asic >= 1)
|
||||
return; /* paranoia */
|
||||
if (port < 0 || port >= PORTS_PER_ASIC)
|
||||
return; /* more paranoia */
|
||||
@ -488,9 +454,7 @@ static void lock_port(struct comedi_device *dev, int asic, int port)
|
||||
|
||||
static void unlock_port(struct comedi_device *dev, int asic, int port)
|
||||
{
|
||||
const struct pcmmio_board *board = comedi_board(dev);
|
||||
|
||||
if (asic < 0 || asic >= board->dio_num_asics)
|
||||
if (asic < 0 || asic >= 1)
|
||||
return; /* paranoia */
|
||||
if (port < 0 || port >= PORTS_PER_ASIC)
|
||||
return; /* more paranoia */
|
||||
@ -1012,7 +976,6 @@ static int ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
|
||||
|
||||
static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
||||
{
|
||||
const struct pcmmio_board *board = comedi_board(dev);
|
||||
struct comedi_subdevice *s;
|
||||
int sdev_no, chans_left, n_dio_subdevs, n_subdevs, port, asic,
|
||||
thisasic_chanct = 0;
|
||||
@ -1020,23 +983,21 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
||||
unsigned int irq[MAX_ASICS];
|
||||
int ret;
|
||||
|
||||
dev->board_name = dev->driver->driver_name;
|
||||
|
||||
iobase = it->options[0];
|
||||
irq[0] = it->options[1];
|
||||
|
||||
printk(KERN_INFO "comedi%d: %s: io: %lx attaching...\n", dev->minor,
|
||||
dev->driver->driver_name, iobase);
|
||||
dev->board_name, iobase);
|
||||
|
||||
dev->iobase = iobase;
|
||||
|
||||
if (!iobase || !request_region(iobase,
|
||||
board->total_iosize,
|
||||
dev->driver->driver_name)) {
|
||||
if (!iobase || !request_region(iobase, 32, dev->board_name)) {
|
||||
printk(KERN_ERR "comedi%d: I/O port conflict\n", dev->minor);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
dev->board_name = board->name;
|
||||
|
||||
/*
|
||||
* Allocate the private structure area. alloc_private() is a
|
||||
* convenient macro defined in comedidev.h.
|
||||
@ -1059,7 +1020,7 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
||||
spin_lock_init(&devpriv->asics[asic].spinlock);
|
||||
}
|
||||
|
||||
chans_left = CHANS_PER_ASIC * board->dio_num_asics;
|
||||
chans_left = CHANS_PER_ASIC * 1;
|
||||
n_dio_subdevs = CALC_N_DIO_SUBDEVS(chans_left);
|
||||
n_subdevs = n_dio_subdevs + 2;
|
||||
devpriv->sprivs =
|
||||
@ -1078,13 +1039,13 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
||||
/* First, AI */
|
||||
s = &dev->subdevices[0];
|
||||
s->private = &devpriv->sprivs[0];
|
||||
s->maxdata = (1 << board->ai_bits) - 1;
|
||||
s->range_table = board->ai_range_table;
|
||||
s->maxdata = 0xffff;
|
||||
s->range_table = &ranges_ai;
|
||||
s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF;
|
||||
s->type = COMEDI_SUBD_AI;
|
||||
s->n_chan = board->n_ai_chans;
|
||||
s->n_chan = 16;
|
||||
s->len_chanlist = s->n_chan;
|
||||
s->insn_read = board->ai_rinsn;
|
||||
s->insn_read = ai_rinsn;
|
||||
subpriv->iobase = dev->iobase + 0;
|
||||
/* initialize the resource enable register by clearing it */
|
||||
outb(0, subpriv->iobase + 3);
|
||||
@ -1093,14 +1054,14 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
||||
/* Next, AO */
|
||||
s = &dev->subdevices[1];
|
||||
s->private = &devpriv->sprivs[1];
|
||||
s->maxdata = (1 << board->ao_bits) - 1;
|
||||
s->range_table = board->ao_range_table;
|
||||
s->maxdata = 0xffff;
|
||||
s->range_table = &ranges_ao;
|
||||
s->subdev_flags = SDF_READABLE;
|
||||
s->type = COMEDI_SUBD_AO;
|
||||
s->n_chan = board->n_ao_chans;
|
||||
s->n_chan = 8;
|
||||
s->len_chanlist = s->n_chan;
|
||||
s->insn_read = board->ao_rinsn;
|
||||
s->insn_write = board->ao_winsn;
|
||||
s->insn_read = ao_rinsn;
|
||||
s->insn_write = ao_winsn;
|
||||
subpriv->iobase = dev->iobase + 8;
|
||||
/* initialize the resource enable register by clearing it */
|
||||
outb(0, subpriv->iobase + 3);
|
||||
@ -1180,7 +1141,7 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
||||
for (asic = 0; irq[0] && asic < MAX_ASICS; ++asic) {
|
||||
if (irq[asic]
|
||||
&& request_irq(irq[asic], interrupt_pcmmio,
|
||||
IRQF_SHARED, board->name, dev)) {
|
||||
IRQF_SHARED, dev->board_name, dev)) {
|
||||
int i;
|
||||
/* unroll the allocated irqs.. */
|
||||
for (i = asic - 1; i >= 0; --i) {
|
||||
@ -1204,11 +1165,10 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
||||
|
||||
static void pcmmio_detach(struct comedi_device *dev)
|
||||
{
|
||||
const struct pcmmio_board *board = comedi_board(dev);
|
||||
int i;
|
||||
|
||||
if (dev->iobase)
|
||||
release_region(dev->iobase, board->total_iosize);
|
||||
release_region(dev->iobase, 32);
|
||||
for (i = 0; i < MAX_ASICS; ++i) {
|
||||
if (devpriv && devpriv->asics[i].irq)
|
||||
free_irq(devpriv->asics[i].irq, dev);
|
||||
@ -1217,32 +1177,11 @@ static void pcmmio_detach(struct comedi_device *dev)
|
||||
kfree(devpriv->sprivs);
|
||||
}
|
||||
|
||||
static const struct pcmmio_board pcmmio_boards[] = {
|
||||
{
|
||||
.name = "pcmmio",
|
||||
.dio_num_asics = 1,
|
||||
.dio_num_ports = 6,
|
||||
.total_iosize = 32,
|
||||
.ai_bits = 16,
|
||||
.ao_bits = 16,
|
||||
.n_ai_chans = 16,
|
||||
.n_ao_chans = 8,
|
||||
.ai_range_table = &ranges_ai,
|
||||
.ao_range_table = &ranges_ao,
|
||||
.ai_rinsn = ai_rinsn,
|
||||
.ao_rinsn = ao_rinsn,
|
||||
.ao_winsn = ao_winsn
|
||||
},
|
||||
};
|
||||
|
||||
static struct comedi_driver pcmmio_driver = {
|
||||
.driver_name = "pcmmio",
|
||||
.module = THIS_MODULE,
|
||||
.attach = pcmmio_attach,
|
||||
.detach = pcmmio_detach,
|
||||
.board_name = &pcmmio_boards[0].name,
|
||||
.offset = sizeof(struct pcmmio_board),
|
||||
.num_names = ARRAY_SIZE(pcmmio_boards),
|
||||
};
|
||||
module_comedi_driver(pcmmio_driver);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user