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>
This commit is contained in:
parent
ea9f10f2fd
commit
542038f4df
|
@ -36,7 +36,6 @@ static const struct boardtype boardtypes[] = {
|
|||
{"p16r16dio", P16R16DIO_SIZE,},
|
||||
};
|
||||
|
||||
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct boardtype))
|
||||
#define this_board ((const struct boardtype *)dev->board_ptr)
|
||||
|
||||
static struct comedi_driver driver_acl7225b = {
|
||||
|
@ -45,7 +44,7 @@ static struct comedi_driver driver_acl7225b = {
|
|||
.attach = acl7225b_attach,
|
||||
.detach = acl7225b_detach,
|
||||
.board_name = &boardtypes[0].name,
|
||||
.num_names = n_boardtypes,
|
||||
.num_names = ARRAY_SIZE(boardtypes),
|
||||
.offset = sizeof(struct boardtype),
|
||||
};
|
||||
|
||||
|
|
|
@ -2528,14 +2528,12 @@ static const struct addi_board boardtypes[] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct addi_board))
|
||||
|
||||
static struct comedi_driver driver_addi = {
|
||||
.driver_name = ADDIDATA_DRIVER_NAME,
|
||||
.module = THIS_MODULE,
|
||||
.attach = i_ADDI_Attach,
|
||||
.detach = i_ADDI_Detach,
|
||||
.num_names = n_boardtypes,
|
||||
.num_names = ARRAY_SIZE(boardtypes),
|
||||
.board_name = &boardtypes[0].pc_DriverName,
|
||||
.offset = sizeof(struct addi_board),
|
||||
};
|
||||
|
|
|
@ -277,14 +277,12 @@ static const struct boardtype boardtypes[] = {
|
|||
10000, 40, 512},
|
||||
};
|
||||
|
||||
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct boardtype))
|
||||
|
||||
static struct comedi_driver driver_pci9118 = {
|
||||
.driver_name = "adl_pci9118",
|
||||
.module = THIS_MODULE,
|
||||
.attach = pci9118_attach,
|
||||
.detach = pci9118_detach,
|
||||
.num_names = n_boardtypes,
|
||||
.num_names = ARRAY_SIZE(boardtypes),
|
||||
.board_name = &boardtypes[0].name,
|
||||
.offset = sizeof(struct boardtype),
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -171,8 +171,6 @@ static int pci1723_attach(struct comedi_device *dev,
|
|||
struct comedi_devconfig *it);
|
||||
static int pci1723_detach(struct comedi_device *dev);
|
||||
|
||||
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct pci1723_board))
|
||||
|
||||
static struct comedi_driver driver_pci1723 = {
|
||||
.driver_name = "adv_pci1723",
|
||||
.module = THIS_MODULE,
|
||||
|
|
|
@ -406,8 +406,6 @@ static const struct dio_boardtype boardtypes[] = {
|
|||
IO_16b}
|
||||
};
|
||||
|
||||
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct dio_boardtype))
|
||||
|
||||
static struct comedi_driver driver_pci_dio = {
|
||||
.driver_name = "adv_pci_dio",
|
||||
.module = THIS_MODULE,
|
||||
|
@ -1134,7 +1132,7 @@ static int pci_dio_attach(struct comedi_device *dev,
|
|||
|
||||
for_each_pci_dev(pcidev) {
|
||||
/* loop through cards supported by this driver */
|
||||
for (i = 0; i < n_boardtypes; ++i) {
|
||||
for (i = 0; i < ARRAY_SIZE(boardtypes); ++i) {
|
||||
if (boardtypes[i].vendor_id != pcidev->vendor)
|
||||
continue;
|
||||
if (boardtypes[i].device_id != pcidev->device)
|
||||
|
|
|
@ -321,7 +321,6 @@ static const struct daq200_boardtype boardtypes[] = {
|
|||
{"ids4", DAQBOARD2000_SUBSYSTEM_IDS4},
|
||||
};
|
||||
|
||||
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct daq200_boardtype))
|
||||
#define this_board ((const struct daq200_boardtype *)dev->board_ptr)
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(daqboard2000_pci_table) = {
|
||||
|
@ -761,7 +760,7 @@ static int daqboard2000_attach(struct comedi_device *dev,
|
|||
devpriv->pci_dev = card;
|
||||
id = ((u32) card->
|
||||
subsystem_device << 16) | card->subsystem_vendor;
|
||||
for (i = 0; i < n_boardtypes; i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(boardtypes); i++) {
|
||||
if (boardtypes[i].id == id) {
|
||||
dev_dbg(dev->hw_dev, "%s\n",
|
||||
boardtypes[i].name);
|
||||
|
|
|
@ -350,7 +350,6 @@ static const struct dt282x_board boardtypes[] = {
|
|||
},
|
||||
};
|
||||
|
||||
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct dt282x_board))
|
||||
#define this_board ((const struct dt282x_board *)dev->board_ptr)
|
||||
|
||||
struct dt282x_private {
|
||||
|
@ -420,7 +419,7 @@ static struct comedi_driver driver_dt282x = {
|
|||
.attach = dt282x_attach,
|
||||
.detach = dt282x_detach,
|
||||
.board_name = &boardtypes[0].name,
|
||||
.num_names = n_boardtypes,
|
||||
.num_names = ARRAY_SIZE(boardtypes),
|
||||
.offset = sizeof(struct dt282x_board),
|
||||
};
|
||||
|
||||
|
|
|
@ -173,14 +173,12 @@ static const struct boardtype boardtypes[] = {
|
|||
&range_analog}, /* Rangelist for D/A */
|
||||
};
|
||||
|
||||
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct boardtype))
|
||||
|
||||
static struct comedi_driver driver_icp_multi = {
|
||||
.driver_name = "icp_multi",
|
||||
.module = THIS_MODULE,
|
||||
.attach = icp_multi_attach,
|
||||
.detach = icp_multi_detach,
|
||||
.num_names = n_boardtypes,
|
||||
.num_names = ARRAY_SIZE(boardtypes),
|
||||
.board_name = &boardtypes[0].name,
|
||||
.offset = sizeof(struct boardtype),
|
||||
};
|
||||
|
|
|
@ -155,7 +155,6 @@ static const struct pcl711_board boardtypes[] = {
|
|||
{"acl8112dg", 0, 1, 1, 9, 16, 2, 15, &range_acl8112dg_ai},
|
||||
};
|
||||
|
||||
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct pcl711_board))
|
||||
#define this_board ((const struct pcl711_board *)dev->board_ptr)
|
||||
|
||||
static int pcl711_attach(struct comedi_device *dev,
|
||||
|
@ -167,7 +166,7 @@ static struct comedi_driver driver_pcl711 = {
|
|||
.attach = pcl711_attach,
|
||||
.detach = pcl711_detach,
|
||||
.board_name = &boardtypes[0].name,
|
||||
.num_names = n_boardtypes,
|
||||
.num_names = ARRAY_SIZE(boardtypes),
|
||||
.offset = sizeof(struct pcl711_board),
|
||||
};
|
||||
|
||||
|
|
|
@ -80,7 +80,6 @@ static const struct pcl724_board boardtypes[] = {
|
|||
{"pet48dio", 48, 2, 0x9eb8, PET48_SIZE, 0, 1,},
|
||||
};
|
||||
|
||||
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct pcl724_board))
|
||||
#define this_board ((const struct pcl724_board *)dev->board_ptr)
|
||||
|
||||
static struct comedi_driver driver_pcl724 = {
|
||||
|
@ -89,7 +88,7 @@ static struct comedi_driver driver_pcl724 = {
|
|||
.attach = pcl724_attach,
|
||||
.detach = pcl724_detach,
|
||||
.board_name = &boardtypes[0].name,
|
||||
.num_names = n_boardtypes,
|
||||
.num_names = ARRAY_SIZE(boardtypes),
|
||||
.offset = sizeof(struct pcl724_board),
|
||||
};
|
||||
|
||||
|
|
|
@ -149,7 +149,6 @@ static const struct pcl726_board boardtypes[] = {
|
|||
&rangelist_728[0],},
|
||||
};
|
||||
|
||||
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct pcl726_board))
|
||||
#define this_board ((const struct pcl726_board *)dev->board_ptr)
|
||||
|
||||
static struct comedi_driver driver_pcl726 = {
|
||||
|
@ -158,7 +157,7 @@ static struct comedi_driver driver_pcl726 = {
|
|||
.attach = pcl726_attach,
|
||||
.detach = pcl726_detach,
|
||||
.board_name = &boardtypes[0].name,
|
||||
.num_names = n_boardtypes,
|
||||
.num_names = ARRAY_SIZE(boardtypes),
|
||||
.offset = sizeof(struct pcl726_board),
|
||||
};
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@ static const struct pcl730_board boardtypes[] = {
|
|||
{"acl7130", ACL7130_SIZE,},
|
||||
};
|
||||
|
||||
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct pcl730_board))
|
||||
#define this_board ((const struct pcl730_board *)dev->board_ptr)
|
||||
|
||||
static struct comedi_driver driver_pcl730 = {
|
||||
|
@ -51,7 +50,7 @@ static struct comedi_driver driver_pcl730 = {
|
|||
.attach = pcl730_attach,
|
||||
.detach = pcl730_detach,
|
||||
.board_name = &boardtypes[0].name,
|
||||
.num_names = n_boardtypes,
|
||||
.num_names = ARRAY_SIZE(boardtypes),
|
||||
.offset = sizeof(struct pcl730_board),
|
||||
};
|
||||
|
||||
|
|
|
@ -397,7 +397,6 @@ static const struct pcl812_board boardtypes[] = {
|
|||
0xdcfc, 0x0a, PCLx1x_IORANGE, 0},
|
||||
};
|
||||
|
||||
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct pcl812_board))
|
||||
#define this_board ((const struct pcl812_board *)dev->board_ptr)
|
||||
|
||||
static struct comedi_driver driver_pcl812 = {
|
||||
|
@ -406,7 +405,7 @@ static struct comedi_driver driver_pcl812 = {
|
|||
.attach = pcl812_attach,
|
||||
.detach = pcl812_detach,
|
||||
.board_name = &boardtypes[0].name,
|
||||
.num_names = n_boardtypes,
|
||||
.num_names = ARRAY_SIZE(boardtypes),
|
||||
.offset = sizeof(struct pcl812_board),
|
||||
};
|
||||
|
||||
|
|
|
@ -146,7 +146,6 @@ static const struct pcl816_board boardtypes[] = {
|
|||
100},
|
||||
};
|
||||
|
||||
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct pcl816_board))
|
||||
#define devpriv ((struct pcl816_private *)dev->private)
|
||||
#define this_board ((const struct pcl816_board *)dev->board_ptr)
|
||||
|
||||
|
@ -165,7 +164,7 @@ static struct comedi_driver driver_pcl816 = {
|
|||
.attach = pcl816_attach,
|
||||
.detach = pcl816_detach,
|
||||
.board_name = &boardtypes[0].name,
|
||||
.num_names = n_boardtypes,
|
||||
.num_names = ARRAY_SIZE(boardtypes),
|
||||
.offset = sizeof(struct pcl816_board),
|
||||
};
|
||||
|
||||
|
|
|
@ -302,15 +302,13 @@ static const struct pcl818_board boardtypes[] = {
|
|||
0x0a, 0xfff, 0xfff, 0, 1 /* XXX ? */ },
|
||||
};
|
||||
|
||||
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct pcl818_board))
|
||||
|
||||
static struct comedi_driver driver_pcl818 = {
|
||||
.driver_name = "pcl818",
|
||||
.module = THIS_MODULE,
|
||||
.attach = pcl818_attach,
|
||||
.detach = pcl818_detach,
|
||||
.board_name = &boardtypes[0].name,
|
||||
.num_names = n_boardtypes,
|
||||
.num_names = ARRAY_SIZE(boardtypes),
|
||||
.offset = sizeof(struct pcl818_board),
|
||||
};
|
||||
|
||||
|
|
|
@ -84,7 +84,6 @@ static const struct pcm3724_board boardtypes[] = {
|
|||
{"pcm3724", 48, 2, 0x00fc, PCM3724_SIZE,},
|
||||
};
|
||||
|
||||
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct pcm3724_board))
|
||||
#define this_board ((const struct pcm3724_board *)dev->board_ptr)
|
||||
|
||||
static struct comedi_driver driver_pcm3724 = {
|
||||
|
@ -93,7 +92,7 @@ static struct comedi_driver driver_pcm3724 = {
|
|||
.attach = pcm3724_attach,
|
||||
.detach = pcm3724_detach,
|
||||
.board_name = &boardtypes[0].name,
|
||||
.num_names = n_boardtypes,
|
||||
.num_names = ARRAY_SIZE(boardtypes),
|
||||
.offset = sizeof(struct pcm3724_board),
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue