/*
* Useful for shorthand access to the particular board structure
*/
-#define n_pci230_boards (sizeof(pci230_boards)/sizeof(pci230_boards[0]))
+#define n_pci230_boards ARRAY_SIZE(pci230_boards)
#define thisboard ((const struct pci230_board *)dev->board_ptr)
/* this structure is for data unique to this hardware driver. If
},
};
-#define n_boards (sizeof(das16cs_boards)/sizeof(das16cs_boards[0]))
+#define n_boards ARRAY_SIZE(das16cs_boards)
#define thisboard ((const struct das16cs_board *)dev->board_ptr)
struct das16cs_private {
.attach = das08_cs_attach,
.detach = das08_common_detach,
.board_name = &das08_cs_boards[0].name,
- .num_names = sizeof(das08_cs_boards) /
- sizeof(struct das08_board_struct),
+ .num_names = ARRAY_SIZE(das08_cs_boards),
.offset = sizeof(struct das08_board_struct),
};
},
};
-#define n_ni6527_boards (sizeof(ni6527_boards)/sizeof(ni6527_boards[0]))
+#define n_ni6527_boards ARRAY_SIZE(ni6527_boards)
#define this_board ((const struct ni6527_board *)dev->board_ptr)
static DEFINE_PCI_DEVICE_TABLE(ni6527_pci_table) = {
},
};
-#define n_ni_65xx_boards (sizeof(ni_65xx_boards)/sizeof(ni_65xx_boards[0]))
+#define n_ni_65xx_boards ARRAY_SIZE(ni_65xx_boards)
static inline const struct ni_65xx_board *board(struct comedi_device *dev)
{
return dev->board_ptr;
return dev->board_ptr;
}
-#define n_ni_660x_boards (sizeof(ni_660x_boards)/sizeof(ni_660x_boards[0]))
+#define n_ni_660x_boards ARRAY_SIZE(ni_660x_boards)
static int ni_660x_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
};
#define devpriv ((struct ni_670x_private *)dev->private)
-#define n_ni_670x_boards (sizeof(ni_670x_boards)/sizeof(ni_670x_boards[0]))
+#define n_ni_670x_boards ARRAY_SIZE(ni_670x_boards)
static int ni_670x_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
},
};
-#define n_atmio16_boards sizeof(atmio16_boards)/sizeof(atmio16_boards[0])
+#define n_atmio16_boards ARRAY_SIZE(atmio16_boards)
#define boardtype ((const struct atmio16_board_t *)dev->board_ptr)
},
};
-#define n_nidio_boards (sizeof(nidio_boards)/sizeof(nidio_boards[0]))
+#define n_nidio_boards ARRAY_SIZE(nidio_boards)
#define this_board ((const struct nidio_board *)dev->board_ptr)
static DEFINE_PCI_DEVICE_TABLE(ni_pcidio_pci_table) = {
},
};
-#define n_pcimio_boards ((sizeof(ni_boards)/sizeof(ni_boards[0])))
+#define n_pcimio_boards ARRAY_SIZE(ni_boards)
static int pcimio_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
};
#define this_board ((const struct pcmad_board_struct *)(dev->board_ptr))
-#define n_pcmad_boards (sizeof(pcmad_boards)/sizeof(pcmad_boards[0]))
+#define n_pcmad_boards ARRAY_SIZE(pcmad_boards)
struct pcmad_priv_struct {
int differential;
},
};
-#define n_boards (sizeof(boards)/sizeof(boards[0]))
+#define n_boards ARRAY_SIZE(boards)
#define this_board ((const struct boarddef_struct *)dev->board_ptr)
static struct comedi_driver driver_poc = {
// initialize and link pointers in instance structure to frame tables
EplDllkInstance_g.m_pTxBuffer = aEplDllkTxBuffer_l;
EplDllkInstance_g.m_uiMaxTxFrames =
- sizeof(aEplDllkTxBuffer_l) / sizeof(tEdrvTxBuffer);
+ ARRAY_SIZE(aEplDllkTxBuffer_l);
// initialize state
EplDllkInstance_g.m_DllState = kEplDllGsInit;
{
if (bTracePointNumber_p >=
- (sizeof(aatmDbgTracePoint_l) / sizeof(aatmDbgTracePoint_l[0]))) {
+ ARRAY_SIZE(aatmDbgTracePoint_l)) {
goto Exit;
}
nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
"DbgTracePoints:\n");
for (nNum = 0;
- nNum < (sizeof(aatmDbgTracePoint_l) / sizeof(atomic_t));
+ nNum < ARRAY_SIZE(aatmDbgTracePoint_l);
nNum++) {
nSize +=
snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
return -ENODEV;
/* check vendor and product id */
- for (devtype = sizeof(line6_id_table) / sizeof(line6_id_table[0]) - 1; devtype--;)
+ for (devtype = ARRAY_SIZE(line6_id_table) - 1; devtype--;)
if ((le16_to_cpu(usbdev->descriptor.idVendor) == line6_id_table[devtype].idVendor) &&
(le16_to_cpu(usbdev->descriptor.idProduct) == line6_id_table[devtype].idProduct))
break;
{0},
};
-#define ME0600_DEVICE_VERSIONS (sizeof(me0600_versions) / sizeof(me0600_version_t) - 1) /**< Returns the number of entries in #me0600_versions. */
+#define ME0600_DEVICE_VERSIONS (ARRAY_SIZE(me0600_versions) - 1) /**< Returns the number of entries in #me0600_versions. */
/**
* @brief Returns the index of the device entry in #me0600_versions.
{0},
};
-#define ME0900_DEVICE_VERSIONS (sizeof(me0900_versions) / sizeof(me0900_version_t) - 1) /**< Returns the number of entries in #me0900_versions. */
+#define ME0900_DEVICE_VERSIONS (ARRAY_SIZE(me0900_versions) - 1) /**< Returns the number of entries in #me0900_versions. */
/**
* @brief Returns the index of the device entry in #me0900_versions.
{0}
};
-#define ME1400_DEVICE_VERSIONS (sizeof(me1400_versions) / sizeof(me1400_version_t) - 1) /**< Returns the number of entries in #me1400_versions. */
+#define ME1400_DEVICE_VERSIONS (ARRAY_SIZE(me1400_versions) - 1) /**< Returns the number of entries in #me1400_versions. */
/**
* @brief Returns the index of the device entry in #me1400_versions.
};
/**< Returns the number of entries in #me1600_versions. */
-#define ME1600_DEVICE_VERSIONS (sizeof(me1600_versions) / sizeof(me1600_version_t) - 1)
+#define ME1600_DEVICE_VERSIONS (ARRAY_SIZE(me1600_versions) - 1)
/**
* @brief Returns the index of the device entry in #me1600_versions.
{0},
};
-#define ME4600_DEVICE_VERSIONS (sizeof(me4600_versions) / sizeof(me4600_version_t) - 1) /**< Returns the number of entries in #me4600_versions. */
+#define ME4600_DEVICE_VERSIONS (ARRAY_SIZE(me4600_versions) - 1) /**< Returns the number of entries in #me4600_versions. */
/**
* @brief Returns the index of the device entry in #me4600_versions.
{0},
};
-#define ME6000_DEVICE_VERSIONS (sizeof(me6000_versions) / sizeof(me6000_version_t) - 1) /**< Returns the number of entries in #me6000_versions. */
+#define ME6000_DEVICE_VERSIONS (ARRAY_SIZE(me6000_versions) - 1) /**< Returns the number of entries in #me6000_versions. */
/**
* @brief Returns the index of the device entry in #me6000_versions.
{0},
};
-#define ME8100_DEVICE_VERSIONS (sizeof(me8100_versions) / sizeof(me8100_version_t) - 1) /**< Returns the number of entries in #me8100_versions. */
+#define ME8100_DEVICE_VERSIONS (ARRAY_SIZE(me8100_versions) - 1) /**< Returns the number of entries in #me8100_versions. */
/**
* @brief Returns the index of the device entry in #me8100_versions.
{0},
};
-#define ME8200_DEVICE_VERSIONS (sizeof(me8200_versions) / sizeof(me8200_version_t) - 1) /**< Returns the number of entries in #me8200_versions. */
+#define ME8200_DEVICE_VERSIONS (ARRAY_SIZE(me8200_versions) - 1) /**< Returns the number of entries in #me8200_versions. */
/**
* @brief Returns the index of the device entry in #me8200_versions.
{0},
};
-#define METEMPL_DEVICE_VERSIONS (sizeof(metempl_versions) / sizeof(metempl_version_t) - 1) /**< Returns the number of entries in #metempl_versions. */
+#define METEMPL_DEVICE_VERSIONS (ARRAY_SIZE(metempl_versions) - 1) /**< Returns the number of entries in #metempl_versions. */
/**
* @brief Returns the index of the device entry in #metempl_versions.
u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
-#define RATE_COUNT (sizeof(rtl8180_rates)/sizeof(rtl8180_rates[0]))
+#define RATE_COUNT ARRAY_SIZE(rtl8180_rates)
static CHANNEL_LIST DefaultChannelPlan[] = {
// {{1,2,3,4,5,6,7,8,9,10,11,12,13,14},14}, //Default channel plan
struct iw_handler_def r8180_wx_handlers_def={
.standard = r8180_wx_handlers,
- .num_standard = sizeof(r8180_wx_handlers) / sizeof(iw_handler),
+ .num_standard = ARRAY_SIZE(r8180_wx_handlers),
.private = r8180_private_handler,
- .num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
+ .num_private = ARRAY_SIZE(r8180_private_handler),
.num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
.get_wireless_stats = r8180_get_wireless_stats,
.private_args = (struct iw_priv_args *)r8180_private_args,
}
/* Add the protocol name */
iwe.cmd = SIOCGIWNAME;
- for(i=0; i<(sizeof(ieee80211_modes)/sizeof(ieee80211_modes[0])); i++) {
+ for(i=0; i<ARRAY_SIZE(ieee80211_modes); i++) {
if(network->mode&(1<<i)) {
sprintf(pname,ieee80211_modes[i].mode_string,ieee80211_modes[i].mode_size);
pname +=ieee80211_modes[i].mode_size;
struct iw_handler_def r8192_wx_handlers_def={
.standard = r8192_wx_handlers,
- .num_standard = sizeof(r8192_wx_handlers) / sizeof(iw_handler),
+ .num_standard = ARRAY_SIZE(r8192_wx_handlers),
.private = r8192_private_handler,
- .num_private = sizeof(r8192_private_handler) / sizeof(iw_handler),
+ .num_private = ARRAY_SIZE(r8192_private_handler),
.num_private_args = sizeof(r8192_private_args) / sizeof(struct iw_priv_args),
.get_wireless_stats = r8192_get_wireless_stats,
.private_args = (struct iw_priv_args *)r8192_private_args,
static int p[] = { 0, 1, 2, 4, 5, 7, 8, 10, 11, 12, 16, 22, 23, 26 };
- for (i = 0; i < sizeof(p) / sizeof(int); i++)
+ for (i = 0; i < ARRAY_SIZE(p); i++)
e |= 1L << (31 - p[i]);
for (i = 1; i < 256; i++) {
static int p[] = { 0, 1, 2, 4, 5, 7, 8, 10, 11, 12, 16, 22, 23, 26 };
- for (i = 0; i < sizeof(p) / sizeof(int); i++) {
+ for (i = 0; i < ARRAY_SIZE(p); i++) {
e |= 1L << (31 - p[i]);
}