From 02baee8cd8a0465d33231c4ee01f0a572bd1e0ae Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 10 Sep 2012 18:59:02 -0700 Subject: [PATCH] staging: comedi: adl_pci9111: analog input subdevice is fixed The analog input subdevice is the same for all boards supported by this driver. Remove the boardinfo just open-code the values in the attach function. Note: the only other board that could be supported by this driver is the ADLink PCI-9111DG board. This board has 12-bit analog inputs instead of the 16-bit inputs of the PCI-9111HR board. Unfortunately these boards share the same PCI vendor/device id. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9111.c | 58 ++++++-------------- 1 file changed, 16 insertions(+), 42 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index 98b4f5da7fea..38faa466be91 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -92,16 +92,6 @@ a multiple of chanlist_len*convert_arg. #define PCI9111_FIFO_HALF_SIZE 512 -#define PCI9111_AI_CHANNEL_NBR 16 - -#define PCI9111_AI_RESOLUTION 12 -#define PCI9111_AI_RESOLUTION_MASK 0x0FFF -#define PCI9111_AI_RESOLUTION_2_CMP_BIT 0x0800 - -#define PCI9111_HR_AI_RESOLUTION 16 -#define PCI9111_HR_AI_RESOLUTION_MASK 0xFFFF -#define PCI9111_HR_AI_RESOLUTION_2_CMP_BIT 0x8000 - #define PCI9111_AI_ACQUISITION_PERIOD_MIN_NS 10000 #define PCI9111_RANGE_SETTING_DELAY 10 @@ -231,22 +221,13 @@ static const struct comedi_lrange pci9111_hr_ai_range = { struct pci9111_board { const char *name; /* driver name */ int device_id; - int ai_channel_nbr; /* num of A/D chans */ - int ai_resolution; /* resolution of A/D */ - int ai_resolution_mask; - const struct comedi_lrange *ai_range_list; /* rangelist for A/D */ - unsigned int ai_acquisition_period_min_ns; }; static const struct pci9111_board pci9111_boards[] = { { .name = "pci9111_hr", .device_id = PCI9111_HR_DEVICE_ID, - .ai_channel_nbr = PCI9111_AI_CHANNEL_NBR, - .ai_resolution = PCI9111_HR_AI_RESOLUTION, - .ai_resolution_mask = PCI9111_HR_AI_RESOLUTION_MASK, - .ai_range_list = &pci9111_hr_ai_range, - .ai_acquisition_period_min_ns = PCI9111_AI_ACQUISITION_PERIOD_MIN_NS} + }, }; /* Private data structure */ @@ -467,7 +448,6 @@ pci9111_ai_do_cmd_test(struct comedi_device *dev, int error = 0; int range, reference; int i; - struct pci9111_board *board = (struct pci9111_board *)dev->board_ptr; /* Step 1 : check if trigger are trivialy valid */ @@ -520,8 +500,8 @@ pci9111_ai_do_cmd_test(struct comedi_device *dev, } if ((cmd->convert_src == TRIG_TIMER) && - (cmd->convert_arg < board->ai_acquisition_period_min_ns)) { - cmd->convert_arg = board->ai_acquisition_period_min_ns; + (cmd->convert_arg < PCI9111_AI_ACQUISITION_PERIOD_MIN_NS)) { + cmd->convert_arg = PCI9111_AI_ACQUISITION_PERIOD_MIN_NS; error++; } if ((cmd->convert_src == TRIG_EXT) && (cmd->convert_arg != 0)) { @@ -530,8 +510,8 @@ pci9111_ai_do_cmd_test(struct comedi_device *dev, } if ((cmd->scan_begin_src == TRIG_TIMER) && - (cmd->scan_begin_arg < board->ai_acquisition_period_min_ns)) { - cmd->scan_begin_arg = board->ai_acquisition_period_min_ns; + (cmd->scan_begin_arg < PCI9111_AI_ACQUISITION_PERIOD_MIN_NS)) { + cmd->scan_begin_arg = PCI9111_AI_ACQUISITION_PERIOD_MIN_NS; error++; } if ((cmd->scan_begin_src == TRIG_FOLLOW) @@ -1187,23 +1167,17 @@ static int pci9111_attach(struct comedi_device *dev, s = &dev->subdevices[0]; dev->read_subdev = s; - - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_CMD_READ; - - /* TODO: Add external multiplexer data */ - /* if (devpriv->usemux) { s->n_chan = devpriv->usemux; } */ - /* else { s->n_chan = this_board->n_aichan; } */ - - s->n_chan = board->ai_channel_nbr; - s->maxdata = board->ai_resolution_mask; - s->len_chanlist = board->ai_channel_nbr; - s->range_table = board->ai_range_list; - s->cancel = pci9111_ai_cancel; - s->insn_read = pci9111_ai_insn_read; - s->do_cmdtest = pci9111_ai_do_cmd_test; - s->do_cmd = pci9111_ai_do_cmd; - s->munge = pci9111_ai_munge; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_CMD_READ; + s->n_chan = 16; + s->maxdata = 0xffff; + s->len_chanlist = 16; + s->range_table = &pci9111_hr_ai_range; + s->cancel = pci9111_ai_cancel; + s->insn_read = pci9111_ai_insn_read; + s->do_cmdtest = pci9111_ai_do_cmd_test; + s->do_cmd = pci9111_ai_do_cmd; + s->munge = pci9111_ai_munge; s = &dev->subdevices[1]; s->type = COMEDI_SUBD_AO;