mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-26 05:34:13 +08:00
Staging: ARRAY_SIZE changes
These changes were a direct result of using a semantic patch More information can be found at http://www.emn.fr/x-info/coccinelle/ Signed-off-by: Stoyan Gaydarov <sgayda2@uiuc.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
2e9ab1e72c
commit
b6ac161364
@ -513,7 +513,7 @@ MODULE_DEVICE_TABLE(pci, pci230_pci_table);
|
||||
/*
|
||||
* 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
|
||||
|
@ -78,7 +78,7 @@ static const struct das16cs_board das16cs_boards[] = {
|
||||
},
|
||||
};
|
||||
|
||||
#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 {
|
||||
|
@ -65,8 +65,7 @@ static struct comedi_driver driver_das08_cs = {
|
||||
.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),
|
||||
};
|
||||
|
||||
|
@ -103,7 +103,7 @@ static const struct ni6527_board ni6527_boards[] = {
|
||||
},
|
||||
};
|
||||
|
||||
#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) = {
|
||||
|
@ -246,7 +246,7 @@ static const struct ni_65xx_board ni_65xx_boards[] = {
|
||||
},
|
||||
};
|
||||
|
||||
#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;
|
||||
|
@ -454,7 +454,7 @@ static inline const struct ni_660x_board *board(struct comedi_device *dev)
|
||||
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);
|
||||
|
@ -111,7 +111,7 @@ struct ni_670x_private {
|
||||
};
|
||||
|
||||
#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);
|
||||
|
@ -121,7 +121,7 @@ static const struct atmio16_board_t atmio16_boards[] = {
|
||||
},
|
||||
};
|
||||
|
||||
#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)
|
||||
|
||||
|
@ -374,7 +374,7 @@ static const struct nidio_board nidio_boards[] = {
|
||||
},
|
||||
};
|
||||
|
||||
#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) = {
|
||||
|
@ -1208,7 +1208,7 @@ static const struct ni_board_struct ni_boards[] = {
|
||||
},
|
||||
};
|
||||
|
||||
#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);
|
||||
|
@ -69,7 +69,7 @@ static const struct pcmad_board_struct pcmad_boards[] = {
|
||||
};
|
||||
|
||||
#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;
|
||||
|
@ -102,7 +102,7 @@ static const struct boarddef_struct boards[] = {
|
||||
},
|
||||
};
|
||||
|
||||
#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 = {
|
||||
|
@ -328,7 +328,7 @@ tEplKernel EplDllkAddInstance(tEplDllkInitParam * pInitParam_p)
|
||||
// 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;
|
||||
|
@ -196,7 +196,7 @@ void TgtDbgSignalTracePoint(u8 bTracePointNumber_p)
|
||||
{
|
||||
|
||||
if (bTracePointNumber_p >=
|
||||
(sizeof(aatmDbgTracePoint_l) / sizeof(aatmDbgTracePoint_l[0]))) {
|
||||
ARRAY_SIZE(aatmDbgTracePoint_l)) {
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
@ -330,7 +330,7 @@ static int EplLinProcRead(char *pcBuffer_p,
|
||||
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,
|
||||
|
@ -682,7 +682,7 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_
|
||||
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;
|
||||
|
@ -54,7 +54,7 @@ static me0600_version_t me0600_versions[] = {
|
||||
{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.
|
||||
|
@ -53,7 +53,7 @@ static me0900_version_t me0900_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.
|
||||
|
@ -60,7 +60,7 @@ static me1400_version_t me1400_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.
|
||||
|
@ -58,7 +58,7 @@ static me1600_version_t me1600_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.
|
||||
|
@ -80,7 +80,7 @@ static me4600_version_t me4600_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.
|
||||
|
@ -103,7 +103,7 @@ static me6000_version_t me6000_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.
|
||||
|
@ -53,7 +53,7 @@ static me8100_version_t me8100_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.
|
||||
|
@ -53,7 +53,7 @@ static me8200_version_t me8200_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.
|
||||
|
@ -50,7 +50,7 @@ static metempl_version_t metempl_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.
|
||||
|
@ -27,7 +27,7 @@
|
||||
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
|
||||
@ -1578,9 +1578,9 @@ static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
|
||||
|
||||
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,
|
||||
|
@ -87,7 +87,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
|
||||
}
|
||||
/* 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;
|
||||
|
@ -1221,9 +1221,9 @@ struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
|
||||
|
||||
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,
|
||||
|
@ -1306,7 +1306,7 @@ static void slic_mcast_init_crc32(void)
|
||||
|
||||
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++) {
|
||||
|
@ -3500,7 +3500,7 @@ static void sxg_mcast_init_crc32(void)
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user