Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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,
+2 −2
Original line number Diff line number Diff line
@@ -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;
+12 −16
Original line number Diff line number Diff line
@@ -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);
}