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

staging: comedi: amplc_dio200.h: rename 'has_enhancements' in boardinfo

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 42c6767b
...@@ -40,7 +40,7 @@ struct dio200_board { ...@@ -40,7 +40,7 @@ struct dio200_board {
unsigned char sdinfo[DIO200_MAX_SUBDEVS]; /* depends on sdtype */ unsigned char sdinfo[DIO200_MAX_SUBDEVS]; /* depends on sdtype */
bool has_int_sce:1; /* has interrupt enable/status reg */ bool has_int_sce:1; /* has interrupt enable/status reg */
bool has_clk_gat_sce:1; /* has clock/gate selection registers */ 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, int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq,
......
...@@ -638,7 +638,7 @@ static int dio200_subdev_8254_set_gate_src(struct comedi_device *dev, ...@@ -638,7 +638,7 @@ static int dio200_subdev_8254_set_gate_src(struct comedi_device *dev,
return -1; return -1;
if (counter_number > 2) if (counter_number > 2)
return -1; return -1;
if (gate_src > (board->has_enhancements ? 31 : 7)) if (gate_src > (board->is_pcie ? 31 : 7))
return -1; return -1;
subpriv->gate_src[counter_number] = gate_src; subpriv->gate_src[counter_number] = gate_src;
...@@ -676,7 +676,7 @@ static int dio200_subdev_8254_set_clock_src(struct comedi_device *dev, ...@@ -676,7 +676,7 @@ static int dio200_subdev_8254_set_clock_src(struct comedi_device *dev,
return -1; return -1;
if (counter_number > 2) if (counter_number > 2)
return -1; return -1;
if (clock_src > (board->has_enhancements ? 31 : 7)) if (clock_src > (board->is_pcie ? 31 : 7))
return -1; return -1;
subpriv->clock_src[counter_number] = clock_src; subpriv->clock_src[counter_number] = clock_src;
......
...@@ -276,7 +276,7 @@ static const struct dio200_board dio200_pci_boards[] = { ...@@ -276,7 +276,7 @@ static const struct dio200_board dio200_pci_boards[] = {
}, },
.has_int_sce = true, .has_int_sce = true,
.has_clk_gat_sce = true, .has_clk_gat_sce = true,
.has_enhancements = true, .is_pcie = true,
}, },
[pcie236_model] = { [pcie236_model] = {
.name = "pcie236", .name = "pcie236",
...@@ -292,7 +292,7 @@ static const struct dio200_board dio200_pci_boards[] = { ...@@ -292,7 +292,7 @@ static const struct dio200_board dio200_pci_boards[] = {
}, },
.has_int_sce = true, .has_int_sce = true,
.has_clk_gat_sce = true, .has_clk_gat_sce = true,
.has_enhancements = true, .is_pcie = true,
}, },
[pcie296_model] = { [pcie296_model] = {
.name = "pcie296", .name = "pcie296",
...@@ -308,7 +308,7 @@ static const struct dio200_board dio200_pci_boards[] = { ...@@ -308,7 +308,7 @@ static const struct dio200_board dio200_pci_boards[] = {
}, },
.has_int_sce = true, .has_int_sce = true,
.has_clk_gat_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, ...@@ -351,16 +351,16 @@ static int dio200_pci_auto_attach(struct comedi_device *dev,
unsigned long context_model) unsigned long context_model)
{ {
struct pci_dev *pci_dev = comedi_to_pci_dev(dev); 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; unsigned int bar;
int ret; int ret;
if (context_model < ARRAY_SIZE(dio200_pci_boards)) if (context_model < ARRAY_SIZE(dio200_pci_boards))
thisboard = &dio200_pci_boards[context_model]; board = &dio200_pci_boards[context_model];
if (!thisboard) if (!board)
return -EINVAL; return -EINVAL;
dev->board_ptr = thisboard; dev->board_ptr = board;
dev->board_name = thisboard->name; dev->board_name = board->name;
dev_info(dev->class_dev, "%s: attach pci %s (%s)\n", dev_info(dev->class_dev, "%s: attach pci %s (%s)\n",
dev->driver->driver_name, pci_name(pci_dev), dev->board_name); 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, ...@@ -369,7 +369,7 @@ static int dio200_pci_auto_attach(struct comedi_device *dev,
if (ret) if (ret)
return ret; return ret;
bar = thisboard->mainbar; bar = board->mainbar;
if (pci_resource_flags(pci_dev, bar) & IORESOURCE_MEM) { if (pci_resource_flags(pci_dev, bar) & IORESOURCE_MEM) {
dev->mmio = pci_ioremap_bar(pci_dev, bar); dev->mmio = pci_ioremap_bar(pci_dev, bar);
if (!dev->mmio) { if (!dev->mmio) {
...@@ -380,17 +380,13 @@ static int dio200_pci_auto_attach(struct comedi_device *dev, ...@@ -380,17 +380,13 @@ static int dio200_pci_auto_attach(struct comedi_device *dev,
} else { } else {
dev->iobase = pci_resource_start(pci_dev, bar); dev->iobase = pci_resource_start(pci_dev, bar);
} }
switch (context_model) {
case pcie215_model: if (board->is_pcie) {
case pcie236_model:
case pcie296_model:
ret = dio200_pcie_board_setup(dev); ret = dio200_pcie_board_setup(dev);
if (ret < 0) if (ret < 0)
return ret; return ret;
break;
default:
break;
} }
return amplc_dio200_common_attach(dev, pci_dev->irq, IRQF_SHARED); return amplc_dio200_common_attach(dev, pci_dev->irq, IRQF_SHARED);
} }
......
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