Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 324537
b: refs/heads/master
c: c2dea97
h: refs/heads/master
i:
  324535: 3820e22
v: v3
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Aug 15, 2012
1 parent d1b0cc5 commit c095ca5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8c3714d60c0b681179000e3e1b5aae15d99e6218
refs/heads/master: c2dea97429788d920bf51d33cba6c4cf72617726
27 changes: 17 additions & 10 deletions trunk/drivers/staging/comedi/drivers/amplc_dio200.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,6 @@ struct dio200_board {
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[] = {
#if DO_ISA
{
Expand Down Expand Up @@ -455,6 +452,16 @@ struct dio200_subdev_intr {
int continuous;
};

static inline bool is_pci_board(const struct dio200_board *board)
{
return DO_PCI && board->bustype == pci_bustype;
}

static inline bool is_isa_board(const struct dio200_board *board)
{
return DO_ISA && board->bustype == isa_bustype;
}

/*
* This function looks for a board matching the supplied PCI device.
*/
Expand All @@ -464,7 +471,7 @@ dio200_find_pci_board(struct pci_dev *pci_dev)
unsigned int i;

for (i = 0; i < ARRAY_SIZE(dio200_boards); i++)
if (dio200_boards[i].bustype == pci_bustype &&
if (is_pci_board(&dio200_boards[i]) &&
pci_dev->device == dio200_boards[i].devid)
return &dio200_boards[i];
return NULL;
Expand Down Expand Up @@ -1234,10 +1241,10 @@ static void dio200_report_attach(struct comedi_device *dev, unsigned int irq)
char tmpbuf[60];
int tmplen;

if (IS_ISA_BOARD(thisboard))
if (is_isa_board(thisboard))
tmplen = scnprintf(tmpbuf, sizeof(tmpbuf),
"(base %#lx) ", dev->iobase);
else if (IS_PCI_BOARD(thisboard))
else if (is_pci_board(thisboard))
tmplen = scnprintf(tmpbuf, sizeof(tmpbuf),
"(pci %s) ", pci_name(pcidev));
else
Expand Down Expand Up @@ -1365,7 +1372,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
}

/* Process options and reserve resources according to bus type. */
if (IS_ISA_BOARD(thisboard)) {
if (is_isa_board(thisboard)) {
unsigned long iobase;
unsigned int irq;

Expand All @@ -1375,7 +1382,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
if (ret < 0)
return ret;
return dio200_common_attach(dev, iobase, irq, 0);
} else if (IS_PCI_BOARD(thisboard)) {
} else if (is_pci_board(thisboard)) {
struct pci_dev *pci_dev;

pci_dev = dio200_find_pci_dev(dev, it);
Expand Down Expand Up @@ -1444,10 +1451,10 @@ static void dio200_detach(struct comedi_device *dev)
}
}
}
if (IS_ISA_BOARD(thisboard)) {
if (is_isa_board(thisboard)) {
if (dev->iobase)
release_region(dev->iobase, DIO200_IO_SIZE);
} else if (IS_PCI_BOARD(thisboard)) {
} else if (is_pci_board(thisboard)) {
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
if (pcidev) {
if (dev->iobase)
Expand Down

0 comments on commit c095ca5

Please sign in to comment.