Commit 858c8ada authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: amplc_dio200: add helper macros to check bus type

Add helper macro IS_ISA_BOARD(board) to check if the driver supports ISA
boards and this is an ISA board, and IS_PCI_BOARD(board) to check if the
driver supports PCI boards and this is a PCI board.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b7518888
...@@ -294,6 +294,9 @@ struct dio200_board { ...@@ -294,6 +294,9 @@ struct dio200_board {
enum dio200_layout layout; enum dio200_layout layout;
}; };
#define IS_ISA_BOARD(board) (DO_ISA && (board)->bustype == isa_bustype)
#define IS_PCI_BOARD(board) (DO_PCI && (board)->bustype == pci_bustype)
static const struct dio200_board dio200_boards[] = { static const struct dio200_board dio200_boards[] = {
#if DO_ISA #if DO_ISA
{ {
...@@ -1231,10 +1234,10 @@ static void dio200_report_attach(struct comedi_device *dev, unsigned int irq) ...@@ -1231,10 +1234,10 @@ static void dio200_report_attach(struct comedi_device *dev, unsigned int irq)
char tmpbuf[60]; char tmpbuf[60];
int tmplen; int tmplen;
if (DO_ISA && thisboard->bustype == isa_bustype) if (IS_ISA_BOARD(thisboard))
tmplen = scnprintf(tmpbuf, sizeof(tmpbuf), tmplen = scnprintf(tmpbuf, sizeof(tmpbuf),
"(base %#lx) ", dev->iobase); "(base %#lx) ", dev->iobase);
else if (DO_PCI && thisboard->bustype == pci_bustype) else if (IS_PCI_BOARD(thisboard))
tmplen = scnprintf(tmpbuf, sizeof(tmpbuf), tmplen = scnprintf(tmpbuf, sizeof(tmpbuf),
"(pci %s) ", pci_name(pcidev)); "(pci %s) ", pci_name(pcidev));
else else
...@@ -1362,7 +1365,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1362,7 +1365,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
} }
/* Process options and reserve resources according to bus type. */ /* Process options and reserve resources according to bus type. */
if (DO_ISA && thisboard->bustype == isa_bustype) { if (IS_ISA_BOARD(thisboard)) {
unsigned long iobase; unsigned long iobase;
unsigned int irq; unsigned int irq;
...@@ -1372,7 +1375,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1372,7 +1375,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
if (ret < 0) if (ret < 0)
return ret; return ret;
return dio200_common_attach(dev, iobase, irq, 0); return dio200_common_attach(dev, iobase, irq, 0);
} else if (DO_PCI && thisboard->bustype == pci_bustype) { } else if (IS_PCI_BOARD(thisboard)) {
struct pci_dev *pci_dev; struct pci_dev *pci_dev;
pci_dev = dio200_find_pci_dev(dev, it); pci_dev = dio200_find_pci_dev(dev, it);
......
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