staging: comedi: amplc_dio200.h: rename 'has_enhancements' in boardinfo
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 12 Aug 2014 18:17:20 +0000 (11:17 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 16 Aug 2014 19:23:25 +0000 (12:23 -0700)
This member of the boardinfor is only set for the PCIE boards. For
aeshetics, rename it to 'is_pcie'.

For clarity, use this flag in the (*auto_attach) to determine if the
dio200_pcie_board_setup() function needs to be called instead of using
the switch (context_model).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/amplc_dio200.h
drivers/staging/comedi/drivers/amplc_dio200_common.c
drivers/staging/comedi/drivers/amplc_dio200_pci.c

index 60b7ae1a6423f37e640ee915c9a682284f9ad810..306a9d68b2f6ee2f54c0ede001ec46837590e9be 100644 (file)
@@ -40,7 +40,7 @@ struct dio200_board {
        unsigned char sdinfo[DIO200_MAX_SUBDEVS];       /* depends on sdtype */
        bool has_int_sce:1;             /* has interrupt enable/status reg */
        bool has_clk_gat_sce:1;         /* has clock/gate selection registers */
-       bool has_enhancements:1;        /* has enhanced features */
+       bool is_pcie:1;                 /* has enhanced features */
 };
 
 int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq,
index 275795dbf6e94a11c9e5d702a8599cfa8b2066f9..2b33df716cc65b5718f066f167e6b482aa55be31 100644 (file)
@@ -638,7 +638,7 @@ static int dio200_subdev_8254_set_gate_src(struct comedi_device *dev,
                return -1;
        if (counter_number > 2)
                return -1;
-       if (gate_src > (board->has_enhancements ? 31 : 7))
+       if (gate_src > (board->is_pcie ? 31 : 7))
                return -1;
 
        subpriv->gate_src[counter_number] = gate_src;
@@ -676,7 +676,7 @@ static int dio200_subdev_8254_set_clock_src(struct comedi_device *dev,
                return -1;
        if (counter_number > 2)
                return -1;
-       if (clock_src > (board->has_enhancements ? 31 : 7))
+       if (clock_src > (board->is_pcie ? 31 : 7))
                return -1;
 
        subpriv->clock_src[counter_number] = clock_src;
index e3d6a73604fb5d5c785b411225875b468d86781c..4030c702455fef69ed57d6a4e8bafe78b9740597 100644 (file)
@@ -276,7 +276,7 @@ static const struct dio200_board dio200_pci_boards[] = {
                },
                .has_int_sce    = true,
                .has_clk_gat_sce = true,
-               .has_enhancements = true,
+               .is_pcie        = true,
        },
        [pcie236_model] = {
                .name           = "pcie236",
@@ -292,7 +292,7 @@ static const struct dio200_board dio200_pci_boards[] = {
                },
                .has_int_sce    = true,
                .has_clk_gat_sce = true,
-               .has_enhancements = true,
+               .is_pcie        = true,
        },
        [pcie296_model] = {
                .name           = "pcie296",
@@ -308,7 +308,7 @@ static const struct dio200_board dio200_pci_boards[] = {
                },
                .has_int_sce    = true,
                .has_clk_gat_sce = true,
-               .has_enhancements = true,
+               .is_pcie        = true,
        },
 };
 
@@ -351,16 +351,16 @@ static int dio200_pci_auto_attach(struct comedi_device *dev,
                                  unsigned long context_model)
 {
        struct pci_dev *pci_dev = comedi_to_pci_dev(dev);
-       const struct dio200_board *thisboard = NULL;
+       const struct dio200_board *board = NULL;
        unsigned int bar;
        int ret;
 
        if (context_model < ARRAY_SIZE(dio200_pci_boards))
-               thisboard = &dio200_pci_boards[context_model];
-       if (!thisboard)
+               board = &dio200_pci_boards[context_model];
+       if (!board)
                return -EINVAL;
-       dev->board_ptr = thisboard;
-       dev->board_name = thisboard->name;
+       dev->board_ptr = board;
+       dev->board_name = board->name;
 
        dev_info(dev->class_dev, "%s: attach pci %s (%s)\n",
                 dev->driver->driver_name, pci_name(pci_dev), dev->board_name);
@@ -369,7 +369,7 @@ static int dio200_pci_auto_attach(struct comedi_device *dev,
        if (ret)
                return ret;
 
-       bar = thisboard->mainbar;
+       bar = board->mainbar;
        if (pci_resource_flags(pci_dev, bar) & IORESOURCE_MEM) {
                dev->mmio = pci_ioremap_bar(pci_dev, bar);
                if (!dev->mmio) {
@@ -380,17 +380,13 @@ static int dio200_pci_auto_attach(struct comedi_device *dev,
        } else {
                dev->iobase = pci_resource_start(pci_dev, bar);
        }
-       switch (context_model) {
-       case pcie215_model:
-       case pcie236_model:
-       case pcie296_model:
+
+       if (board->is_pcie) {
                ret = dio200_pcie_board_setup(dev);
                if (ret < 0)
                        return ret;
-               break;
-       default:
-               break;
        }
+
        return amplc_dio200_common_attach(dev, pci_dev->irq, IRQF_SHARED);
 }