staging: replace open-coded ARRAY_SIZEs
spatch http://coccinelle.lip6.fr/rules/array.cocci did these. Signed-off-by: Jim Cromie <jim.cromie@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
487db48506
commit
b330f606ed
|
@ -1115,20 +1115,20 @@ int download_ddr_settings(PMINI_ADAPTER Adapter)
|
|||
{
|
||||
case DDR_80_MHZ:
|
||||
psDDRSetting = asT3LP_DDRSetting80MHz;
|
||||
RegCount = (sizeof(asT3LP_DDRSetting80MHz)/sizeof(DDR_SET_NODE));
|
||||
RegCount = ARRAY_SIZE(asT3LP_DDRSetting80MHz);
|
||||
RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ;
|
||||
psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
|
||||
break;
|
||||
case DDR_100_MHZ:
|
||||
psDDRSetting = asT3LP_DDRSetting100MHz;
|
||||
RegCount = (sizeof(asT3LP_DDRSetting100MHz)/sizeof(DDR_SET_NODE));
|
||||
RegCount = ARRAY_SIZE(asT3LP_DDRSetting100MHz);
|
||||
RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ;
|
||||
psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
|
||||
break;
|
||||
case DDR_133_MHZ:
|
||||
bOverrideSelfRefresh = TRUE;
|
||||
psDDRSetting = asT3LP_DDRSetting133MHz;
|
||||
RegCount = (sizeof(asT3LP_DDRSetting133MHz)/sizeof(DDR_SET_NODE));
|
||||
RegCount = ARRAY_SIZE(asT3LP_DDRSetting133MHz);
|
||||
RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
|
||||
psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
|
||||
break;
|
||||
|
@ -1146,20 +1146,20 @@ int download_ddr_settings(PMINI_ADAPTER Adapter)
|
|||
{
|
||||
case DDR_80_MHZ:
|
||||
psDDRSetting = asT3LPB_DDRSetting80MHz;
|
||||
RegCount=(sizeof(asT3LPB_DDRSetting80MHz)/sizeof(DDR_SET_NODE));
|
||||
RegCount=ARRAY_SIZE(asT3LPB_DDRSetting80MHz);
|
||||
RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ;
|
||||
psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
|
||||
break;
|
||||
case DDR_100_MHZ:
|
||||
psDDRSetting = asT3LPB_DDRSetting100MHz;
|
||||
RegCount = (sizeof(asT3LPB_DDRSetting100MHz)/sizeof(DDR_SET_NODE));
|
||||
RegCount = ARRAY_SIZE(asT3LPB_DDRSetting100MHz);
|
||||
RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ;
|
||||
psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
|
||||
break;
|
||||
case DDR_133_MHZ:
|
||||
bOverrideSelfRefresh = TRUE;
|
||||
psDDRSetting = asT3LPB_DDRSetting133MHz;
|
||||
RegCount = (sizeof(asT3LPB_DDRSetting133MHz)/sizeof(DDR_SET_NODE));
|
||||
RegCount = ARRAY_SIZE(asT3LPB_DDRSetting133MHz);
|
||||
RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
|
||||
psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
|
||||
break;
|
||||
|
@ -1167,7 +1167,7 @@ int download_ddr_settings(PMINI_ADAPTER Adapter)
|
|||
case DDR_160_MHZ:
|
||||
bOverrideSelfRefresh = TRUE;
|
||||
psDDRSetting = asT3LPB_DDRSetting160MHz;
|
||||
RegCount = sizeof(asT3LPB_DDRSetting160MHz)/sizeof(DDR_SET_NODE);
|
||||
RegCount = ARRAY_SIZE(asT3LPB_DDRSetting160MHz);
|
||||
RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_160MHZ;
|
||||
psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_160MHZ;
|
||||
|
||||
|
@ -1181,19 +1181,19 @@ int download_ddr_settings(PMINI_ADAPTER Adapter)
|
|||
{
|
||||
case DDR_80_MHZ:
|
||||
psDDRSetting = asT3_DDRSetting80MHz;
|
||||
RegCount = (sizeof(asT3_DDRSetting80MHz)/sizeof(DDR_SET_NODE));
|
||||
RegCount = ARRAY_SIZE(asT3_DDRSetting80MHz);
|
||||
RegCount-=T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ;
|
||||
psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
|
||||
break;
|
||||
case DDR_100_MHZ:
|
||||
psDDRSetting = asT3_DDRSetting100MHz;
|
||||
RegCount = (sizeof(asT3_DDRSetting100MHz)/sizeof(DDR_SET_NODE));
|
||||
RegCount = ARRAY_SIZE(asT3_DDRSetting100MHz);
|
||||
RegCount-=T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ;
|
||||
psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
|
||||
break;
|
||||
case DDR_133_MHZ:
|
||||
psDDRSetting = asT3_DDRSetting133MHz;
|
||||
RegCount = (sizeof(asT3_DDRSetting133MHz)/sizeof(DDR_SET_NODE));
|
||||
RegCount = ARRAY_SIZE(asT3_DDRSetting133MHz);
|
||||
RegCount-=T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
|
||||
psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
|
||||
break;
|
||||
|
@ -1207,20 +1207,20 @@ int download_ddr_settings(PMINI_ADAPTER Adapter)
|
|||
{
|
||||
case DDR_80_MHZ:
|
||||
psDDRSetting = asT3B_DDRSetting80MHz;
|
||||
RegCount = (sizeof(asT3B_DDRSetting80MHz)/sizeof(DDR_SET_NODE));
|
||||
RegCount = ARRAY_SIZE(asT3B_DDRSetting80MHz);
|
||||
RegCount -= T3B_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ;
|
||||
psDDRSetting += T3B_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
|
||||
break;
|
||||
case DDR_100_MHZ:
|
||||
psDDRSetting = asT3B_DDRSetting100MHz;
|
||||
RegCount = (sizeof(asT3B_DDRSetting100MHz)/sizeof(DDR_SET_NODE));
|
||||
RegCount = ARRAY_SIZE(asT3B_DDRSetting100MHz);
|
||||
RegCount -= T3B_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ;
|
||||
psDDRSetting += T3B_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
|
||||
break;
|
||||
case DDR_133_MHZ:
|
||||
bOverrideSelfRefresh = TRUE;
|
||||
psDDRSetting = asT3B_DDRSetting133MHz;
|
||||
RegCount = (sizeof(asT3B_DDRSetting133MHz)/sizeof(DDR_SET_NODE));
|
||||
RegCount = ARRAY_SIZE(asT3B_DDRSetting133MHz);
|
||||
RegCount -= T3B_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
|
||||
psDDRSetting += T3B_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
|
||||
break;
|
||||
|
|
|
@ -367,7 +367,7 @@ static int as102_usb_probe(struct usb_interface *intf,
|
|||
ENTER();
|
||||
|
||||
/* This should never actually happen */
|
||||
if ((sizeof(as102_usb_id_table) / sizeof(struct usb_device_id)) !=
|
||||
if (ARRAY_SIZE(as102_usb_id_table) !=
|
||||
(sizeof(as102_device_names) / sizeof(const char *))) {
|
||||
pr_err("Device names table invalid size");
|
||||
return -EINVAL;
|
||||
|
@ -380,8 +380,7 @@ static int as102_usb_probe(struct usb_interface *intf,
|
|||
}
|
||||
|
||||
/* Assign the user-friendly device name */
|
||||
for (i = 0; i < (sizeof(as102_usb_id_table) /
|
||||
sizeof(struct usb_device_id)); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(as102_usb_id_table); i++) {
|
||||
if (id == &as102_usb_id_table[i]) {
|
||||
as102_dev->name = as102_device_names[i];
|
||||
as102_dev->elna_cfg = as102_elna_cfg[i];
|
||||
|
|
|
@ -1322,9 +1322,9 @@ static 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,
|
||||
|
|
|
@ -88,7 +88,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
|
|||
}
|
||||
/* Add the protocol name */
|
||||
iwe.cmd = SIOCGIWNAME;
|
||||
for (i = 0; i < (sizeof(rtllib_modes)/sizeof(rtllib_modes[0])); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(rtllib_modes); i++) {
|
||||
if (network->mode&(1<<i)) {
|
||||
sprintf(pname, rtllib_modes[i].mode_string,
|
||||
rtllib_modes[i].mode_size);
|
||||
|
|
|
@ -1211,9 +1211,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),
|
||||
#if WIRELESS_EXT >= 17
|
||||
.get_wireless_stats = r8192_get_wireless_stats,
|
||||
|
|
|
@ -2389,10 +2389,10 @@ static struct iw_statistics *r871x_get_wireless_stats(struct net_device *dev)
|
|||
|
||||
struct iw_handler_def r871x_handlers_def = {
|
||||
.standard = r8711_handlers,
|
||||
.num_standard = sizeof(r8711_handlers) / sizeof(iw_handler),
|
||||
.num_standard = ARRAY_SIZE(r8711_handlers),
|
||||
.private = r8711_private_handler,
|
||||
.private_args = (struct iw_priv_args *)r8711_private_args,
|
||||
.num_private = sizeof(r8711_private_handler) / sizeof(iw_handler),
|
||||
.num_private = ARRAY_SIZE(r8711_private_handler),
|
||||
.num_private_args = sizeof(r8711_private_args) /
|
||||
sizeof(struct iw_priv_args),
|
||||
.get_wireless_stats = r871x_get_wireless_stats
|
||||
|
|
|
@ -148,7 +148,7 @@ WPA_ParseRSN (
|
|||
{
|
||||
j = 0;
|
||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d, sizeof(pBSSList->abyPKType): %zu\n", pRSN->wPKCount, sizeof(pBSSList->abyPKType));
|
||||
for(i = 0; (i < pRSN->wPKCount) && (j < sizeof(pBSSList->abyPKType)/sizeof(unsigned char)); i++) {
|
||||
for(i = 0; (i < pRSN->wPKCount) && (j < ARRAY_SIZE(pBSSList->abyPKType)); i++) {
|
||||
if(pRSN->len >= 12+i*4+4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*i)
|
||||
if ( !memcmp(pRSN->PKSList[i].abyOUI, abyOUI00, 4))
|
||||
pBSSList->abyPKType[j++] = WPA_NONE;
|
||||
|
@ -180,7 +180,7 @@ WPA_ParseRSN (
|
|||
j = 0;
|
||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d, sizeof(pBSSList->abyAuthType): %zu\n",
|
||||
pIE_RSN_Auth->wAuthCount, sizeof(pBSSList->abyAuthType));
|
||||
for(i = 0; (i < pIE_RSN_Auth->wAuthCount) && (j < sizeof(pBSSList->abyAuthType)/sizeof(unsigned char)); i++) {
|
||||
for(i = 0; (i < pIE_RSN_Auth->wAuthCount) && (j < ARRAY_SIZE(pBSSList->abyAuthType)); i++) {
|
||||
if(pRSN->len >= 14+4+(m+i)*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)+AKS(4*i)
|
||||
if ( !memcmp(pIE_RSN_Auth->AuthKSList[i].abyOUI, abyOUI01, 4))
|
||||
pBSSList->abyAuthType[j++] = WPA_AUTH_IEEE802_1X;
|
||||
|
|
|
@ -149,7 +149,7 @@ WPA_ParseRSN(
|
|||
j = 0;
|
||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d, sizeof(pBSSList->abyPKType): %zu\n", pRSN->wPKCount, sizeof(pBSSList->abyPKType));
|
||||
for (i = 0; (i < pRSN->wPKCount) &&
|
||||
(j < sizeof(pBSSList->abyPKType)/sizeof(BYTE)); i++) {
|
||||
(j < ARRAY_SIZE(pBSSList->abyPKType)); i++) {
|
||||
if(pRSN->len >= 12+i*4+4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*i)
|
||||
if ( !memcmp(pRSN->PKSList[i].abyOUI, abyOUI00, 4))
|
||||
pBSSList->abyPKType[j++] = WPA_NONE;
|
||||
|
@ -182,7 +182,7 @@ WPA_ParseRSN(
|
|||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d, sizeof(pBSSList->abyAuthType): %zu\n",
|
||||
pIE_RSN_Auth->wAuthCount, sizeof(pBSSList->abyAuthType));
|
||||
for (i = 0; (i < pIE_RSN_Auth->wAuthCount) &&
|
||||
(j < sizeof(pBSSList->abyAuthType)/sizeof(BYTE)); i++) {
|
||||
(j < ARRAY_SIZE(pBSSList->abyAuthType)); i++) {
|
||||
if(pRSN->len >= 14+4+(m+i)*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)+AKS(4*i)
|
||||
if ( !memcmp(pIE_RSN_Auth->AuthKSList[i].abyOUI, abyOUI01, 4))
|
||||
pBSSList->abyAuthType[j++] = WPA_AUTH_IEEE802_1X;
|
||||
|
|
Loading…
Reference in New Issue