summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/drivers/adv_pci1710.c
diff options
context:
space:
mode:
authorH Hartley Sweeten <hartleys@visionengravers.com>2012-04-20 12:05:04 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-20 15:12:13 -0700
commit542038f4df5a9d5d806a4af8725d2d21c4423a15 (patch)
treed3c834386bd516b38c531741aa0573d093171ed0 /drivers/staging/comedi/drivers/adv_pci1710.c
parentea9f10f2fd207bb70a730ee3b356f75bc00ff41d (diff)
staging: comedi: use ARRAY_SIZE instead of custom n_boardtypes macros
The n_boardtypes macros are simply open-coded versions of the kernels ARRAY_SIZE macro. Use the kernel provided macro. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Frank Mori Hess <fmhess@users.sourceforge.net> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers/adv_pci1710.c')
-rw-r--r--drivers/staging/comedi/drivers/adv_pci1710.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c
index dc6fe3dbc860..dc762e724edb 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -264,14 +264,12 @@ static const struct boardtype boardtypes[] = {
{.name = DRV_NAME},
};
-#define n_boardtypes (sizeof(boardtypes)/sizeof(struct boardtype))
-
static struct comedi_driver driver_pci1710 = {
.driver_name = DRV_NAME,
.module = THIS_MODULE,
.attach = pci1710_attach,
.detach = pci1710_detach,
- .num_names = n_boardtypes,
+ .num_names = ARRAY_SIZE(boardtypes),
.board_name = &boardtypes[0].name,
.offset = sizeof(struct boardtype),
};
@@ -1398,13 +1396,13 @@ static int pci1710_attach(struct comedi_device *dev,
while (NULL != (pcidev = pci_get_device(PCI_VENDOR_ID_ADVANTECH,
PCI_ANY_ID, pcidev))) {
if (strcmp(this_board->name, DRV_NAME) == 0) {
- for (i = 0; i < n_boardtypes; ++i) {
+ for (i = 0; i < ARRAY_SIZE(boardtypes); ++i) {
if (pcidev->device == boardtypes[i].device_id) {
board_index = i;
break;
}
}
- if (i == n_boardtypes)
+ if (i == ARRAY_SIZE(boardtypes))
continue;
} else {
if (pcidev->device != boardtypes[board_index].device_id)