staging: comedi: adl_pci6208: remove multiple board type support
authorIan Abbott <abbotti@mev.co.uk>
Fri, 27 Feb 2015 15:07:36 +0000 (15:07 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Mar 2015 02:57:40 +0000 (18:57 -0800)
This driver module now only supports a single board type, so remove the
infrastructure for describing multiple board types.  The comedi
"auto_attach" handler, `pci6208_auto_attach()` doesn't need to set the
comedi device's `board_name` or `board_ptr` members.  The former is
automatically pointed to the comedi driver's `driver_name` by the core
comedi module, and the latter is not used anywhere else.  The AO
subdevice's `n_chans` member can be set to 16 without looking it up in
the single element of `pci6208_boards[]`.  There is no need to pass a
board index from the PCI device table to the "auto_attach" handler.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/adl_pci6208.c

index 6fb41d47f8913cfe2e03ffb204058073e201798a..11c663aa277c867edccc44035fa70e76d527bfb5 100644 (file)
 #define PCI6208_DIO_DI_MASK            (0xf0)
 #define PCI6208_DIO_DI_SHIFT           (4)
 
-enum pci6208_boardid {
-       BOARD_PCI6208,
-};
-
-struct pci6208_board {
-       const char *name;
-       int ao_chans;
-};
-
-static const struct pci6208_board pci6208_boards[] = {
-       [BOARD_PCI6208] = {
-               .name           = "adl_pci6208",
-               .ao_chans       = 16,   /* Only 8 usable on PCI-6208 */
-       },
-};
-
 static int pci6208_ao_eoc(struct comedi_device *dev,
                          struct comedi_subdevice *s,
                          struct comedi_insn *insn,
@@ -135,21 +119,13 @@ static int pci6208_do_insn_bits(struct comedi_device *dev,
 }
 
 static int pci6208_auto_attach(struct comedi_device *dev,
-                              unsigned long context)
+                              unsigned long context_unused)
 {
        struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-       const struct pci6208_board *boardinfo = NULL;
        struct comedi_subdevice *s;
        unsigned int val;
        int ret;
 
-       if (context < ARRAY_SIZE(pci6208_boards))
-               boardinfo = &pci6208_boards[context];
-       if (!boardinfo)
-               return -ENODEV;
-       dev->board_ptr = boardinfo;
-       dev->board_name = boardinfo->name;
-
        ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
@@ -163,7 +139,7 @@ static int pci6208_auto_attach(struct comedi_device *dev,
        /* analog output subdevice */
        s->type         = COMEDI_SUBD_AO;
        s->subdev_flags = SDF_WRITABLE;
-       s->n_chan       = boardinfo->ao_chans;
+       s->n_chan       = 16;   /* Only 8 usable on PCI-6208 */
        s->maxdata      = 0xffff;
        s->range_table  = &range_bipolar10;
        s->insn_write   = pci6208_ao_insn_write;
@@ -216,7 +192,7 @@ static int adl_pci6208_pci_probe(struct pci_dev *dev,
 }
 
 static const struct pci_device_id adl_pci6208_pci_table[] = {
-       { PCI_VDEVICE(ADLINK, 0x6208), BOARD_PCI6208 },
+       { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, 0x6208) },
        { 0 }
 };
 MODULE_DEVICE_TABLE(pci, adl_pci6208_pci_table);
This page took 0.025824 seconds and 5 git commands to generate.