Commit ba2d6ccb authored by Karsten Keil's avatar Karsten Keil

ISDN: 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/

Modified some of the changes to avoid the extra define.
Signed-off-by: default avatarStoyan Gaydarov <sgayda2@uiuc.edu>
Signed-off-by: default avatarKarsten Keil <keil@b1-systems.de>
parent 3cad3da3
...@@ -78,7 +78,6 @@ static actcapi_msgdsc valid_msg[] = { ...@@ -78,7 +78,6 @@ static actcapi_msgdsc valid_msg[] = {
#endif #endif
{{ 0x00, 0x00}, NULL}, {{ 0x00, 0x00}, NULL},
}; };
#define num_valid_msg (sizeof(valid_msg)/sizeof(actcapi_msgdsc))
#define num_valid_imsg 27 /* MANUFACTURER_IND */ #define num_valid_imsg 27 /* MANUFACTURER_IND */
/* /*
...@@ -1025,7 +1024,7 @@ actcapi_debug_msg(struct sk_buff *skb, int direction) ...@@ -1025,7 +1024,7 @@ actcapi_debug_msg(struct sk_buff *skb, int direction)
#ifdef DEBUG_DUMP_SKB #ifdef DEBUG_DUMP_SKB
dump_skb(skb); dump_skb(skb);
#endif #endif
for (i = 0; i < num_valid_msg; i++) for (i = 0; i < ARRAY_SIZE(valid_msg); i++)
if ((msg->hdr.cmd.cmd == valid_msg[i].cmd.cmd) && if ((msg->hdr.cmd.cmd == valid_msg[i].cmd.cmd) &&
(msg->hdr.cmd.subcmd == valid_msg[i].cmd.subcmd)) { (msg->hdr.cmd.subcmd == valid_msg[i].cmd.subcmd)) {
descr = valid_msg[i].description; descr = valid_msg[i].description;
......
...@@ -23,7 +23,6 @@ static unsigned short act2000_isa_ports[] = ...@@ -23,7 +23,6 @@ static unsigned short act2000_isa_ports[] =
0x0200, 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380, 0x0200, 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380,
0xcfe0, 0xcfa0, 0xcf60, 0xcf20, 0xcee0, 0xcea0, 0xce60, 0xcfe0, 0xcfa0, 0xcf60, 0xcf20, 0xcee0, 0xcea0, 0xce60,
}; };
#define ISA_NRPORTS (sizeof(act2000_isa_ports)/sizeof(unsigned short))
static act2000_card *cards = (act2000_card *) NULL; static act2000_card *cards = (act2000_card *) NULL;
...@@ -686,21 +685,21 @@ act2000_addcard(int bus, int port, int irq, char *id) ...@@ -686,21 +685,21 @@ act2000_addcard(int bus, int port, int irq, char *id)
* This may result in more than one card detected. * This may result in more than one card detected.
*/ */
switch (bus) { switch (bus) {
case ACT2000_BUS_ISA: case ACT2000_BUS_ISA:
for (i = 0; i < ISA_NRPORTS; i++) for (i = 0; i < ARRAY_SIZE(act2000_isa_ports); i++)
if (act2000_isa_detect(act2000_isa_ports[i])) { if (act2000_isa_detect(act2000_isa_ports[i])) {
printk(KERN_INFO printk(KERN_INFO "act2000: Detected "
"act2000: Detected ISA card at port 0x%x\n", "ISA card at port 0x%x\n",
act2000_isa_ports[i]); act2000_isa_ports[i]);
act2000_alloccard(bus, act2000_isa_ports[i], irq, id); act2000_alloccard(bus,
} act2000_isa_ports[i], irq, id);
break; }
case ACT2000_BUS_MCA: break;
case ACT2000_BUS_PCMCIA: case ACT2000_BUS_MCA:
default: case ACT2000_BUS_PCMCIA:
printk(KERN_WARNING default:
"act2000: addcard: Invalid BUS type %d\n", printk(KERN_WARNING
bus); "act2000: addcard: Invalid BUS type %d\n", bus);
} }
} }
if (!cards) if (!cards)
......
...@@ -551,9 +551,7 @@ word api_put(APPL * appl, CAPI_MSG * msg) ...@@ -551,9 +551,7 @@ word api_put(APPL * appl, CAPI_MSG * msg)
dbug(1,dprintf("com=%x",msg->header.command)); dbug(1,dprintf("com=%x",msg->header.command));
for(j=0;j<MAX_MSG_PARMS+1;j++) msg_parms[j].length = 0; for(j=0;j<MAX_MSG_PARMS+1;j++) msg_parms[j].length = 0;
for(i=0, ret = _BAD_MSG; for(i=0, ret = _BAD_MSG; i < ARRAY_SIZE(ftable); i++) {
i<(sizeof(ftable)/sizeof(struct _ftable));
i++) {
if(ftable[i].command==msg->header.command) { if(ftable[i].command==msg->header.command) {
/* break loop if the message is correct, otherwise continue scan */ /* break loop if the message is correct, otherwise continue scan */
......
...@@ -149,8 +149,7 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a) ...@@ -149,8 +149,7 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
diva_os_xdi_adapter_t *diva_current; diva_os_xdi_adapter_t *diva_current;
diva_os_xdi_adapter_t *adapter_list[4]; diva_os_xdi_adapter_t *adapter_list[4];
PISDN_ADAPTER Slave; PISDN_ADAPTER Slave;
unsigned long bar_length[sizeof(_4bri_bar_length) / unsigned long bar_length[ARRAY_SIZE(_4bri_bar_length)];
sizeof(_4bri_bar_length[0])];
int v2 = _4bri_is_rev_2_card(a->CardOrdinal); int v2 = _4bri_is_rev_2_card(a->CardOrdinal);
int tasks = _4bri_is_rev_2_bri_card(a->CardOrdinal) ? 1 : MQ_INSTANCE_COUNT; int tasks = _4bri_is_rev_2_bri_card(a->CardOrdinal) ? 1 : MQ_INSTANCE_COUNT;
int factor = (tasks == 1) ? 1 : 2; int factor = (tasks == 1) ? 1 : 2;
......
...@@ -833,8 +833,6 @@ static struct FsmNode fnlist[] __initdata = ...@@ -833,8 +833,6 @@ static struct FsmNode fnlist[] __initdata =
}; };
/* *INDENT-ON* */ /* *INDENT-ON* */
#define FNCOUNT (sizeof(fnlist)/sizeof(struct FsmNode))
int __init int __init
CallcNew(void) CallcNew(void)
{ {
...@@ -842,7 +840,7 @@ CallcNew(void) ...@@ -842,7 +840,7 @@ CallcNew(void)
callcfsm.event_count = EVENT_COUNT; callcfsm.event_count = EVENT_COUNT;
callcfsm.strEvent = strEvent; callcfsm.strEvent = strEvent;
callcfsm.strState = strState; callcfsm.strState = strState;
return FsmNew(&callcfsm, fnlist, FNCOUNT); return FsmNew(&callcfsm, fnlist, ARRAY_SIZE(fnlist));
} }
void void
......
...@@ -647,8 +647,6 @@ static struct FsmNode L1SFnList[] __initdata = ...@@ -647,8 +647,6 @@ static struct FsmNode L1SFnList[] __initdata =
{ST_L1_F8, EV_TIMER_DEACT, l1_timer_deact}, {ST_L1_F8, EV_TIMER_DEACT, l1_timer_deact},
}; };
#define L1S_FN_COUNT (sizeof(L1SFnList)/sizeof(struct FsmNode))
#ifdef HISAX_UINTERFACE #ifdef HISAX_UINTERFACE
static void static void
l1_deact_req_u(struct FsmInst *fi, int event, void *arg) l1_deact_req_u(struct FsmInst *fi, int event, void *arg)
...@@ -706,8 +704,6 @@ static struct FsmNode L1UFnList[] __initdata = ...@@ -706,8 +704,6 @@ static struct FsmNode L1UFnList[] __initdata =
{ST_L1_RESET, EV_TIMER_DEACT, l1_timer_deact}, {ST_L1_RESET, EV_TIMER_DEACT, l1_timer_deact},
}; };
#define L1U_FN_COUNT (sizeof(L1UFnList)/sizeof(struct FsmNode))
#endif #endif
static void static void
...@@ -754,8 +750,6 @@ static struct FsmNode L1BFnList[] __initdata = ...@@ -754,8 +750,6 @@ static struct FsmNode L1BFnList[] __initdata =
{ST_L1_WAIT_DEACT, EV_TIMER_DEACT, l1b_timer_deact}, {ST_L1_WAIT_DEACT, EV_TIMER_DEACT, l1b_timer_deact},
}; };
#define L1B_FN_COUNT (sizeof(L1BFnList)/sizeof(struct FsmNode))
int __init int __init
Isdnl1New(void) Isdnl1New(void)
{ {
...@@ -765,7 +759,7 @@ Isdnl1New(void) ...@@ -765,7 +759,7 @@ Isdnl1New(void)
l1fsm_s.event_count = L1_EVENT_COUNT; l1fsm_s.event_count = L1_EVENT_COUNT;
l1fsm_s.strEvent = strL1Event; l1fsm_s.strEvent = strL1Event;
l1fsm_s.strState = strL1SState; l1fsm_s.strState = strL1SState;
retval = FsmNew(&l1fsm_s, L1SFnList, L1S_FN_COUNT); retval = FsmNew(&l1fsm_s, L1SFnList, ARRAY_SIZE(L1SFnList));
if (retval) if (retval)
return retval; return retval;
...@@ -773,7 +767,7 @@ Isdnl1New(void) ...@@ -773,7 +767,7 @@ Isdnl1New(void)
l1fsm_b.event_count = L1_EVENT_COUNT; l1fsm_b.event_count = L1_EVENT_COUNT;
l1fsm_b.strEvent = strL1Event; l1fsm_b.strEvent = strL1Event;
l1fsm_b.strState = strL1BState; l1fsm_b.strState = strL1BState;
retval = FsmNew(&l1fsm_b, L1BFnList, L1B_FN_COUNT); retval = FsmNew(&l1fsm_b, L1BFnList, ARRAY_SIZE(L1BFnList));
if (retval) { if (retval) {
FsmFree(&l1fsm_s); FsmFree(&l1fsm_s);
return retval; return retval;
...@@ -783,7 +777,7 @@ Isdnl1New(void) ...@@ -783,7 +777,7 @@ Isdnl1New(void)
l1fsm_u.event_count = L1_EVENT_COUNT; l1fsm_u.event_count = L1_EVENT_COUNT;
l1fsm_u.strEvent = strL1Event; l1fsm_u.strEvent = strL1Event;
l1fsm_u.strState = strL1UState; l1fsm_u.strState = strL1UState;
retval = FsmNew(&l1fsm_u, L1UFnList, L1U_FN_COUNT); retval = FsmNew(&l1fsm_u, L1UFnList, ARRAY_SIZE(L1UFnList));
if (retval) { if (retval) {
FsmFree(&l1fsm_s); FsmFree(&l1fsm_s);
FsmFree(&l1fsm_b); FsmFree(&l1fsm_b);
......
...@@ -1623,8 +1623,6 @@ static struct FsmNode L2FnList[] __initdata = ...@@ -1623,8 +1623,6 @@ static struct FsmNode L2FnList[] __initdata =
{ST_L2_8, EV_L1_DEACTIVATE, l2_persistent_da}, {ST_L2_8, EV_L1_DEACTIVATE, l2_persistent_da},
}; };
#define L2_FN_COUNT (sizeof(L2FnList)/sizeof(struct FsmNode))
static void static void
isdnl2_l1l2(struct PStack *st, int pr, void *arg) isdnl2_l1l2(struct PStack *st, int pr, void *arg)
{ {
...@@ -1836,7 +1834,7 @@ Isdnl2New(void) ...@@ -1836,7 +1834,7 @@ Isdnl2New(void)
l2fsm.event_count = L2_EVENT_COUNT; l2fsm.event_count = L2_EVENT_COUNT;
l2fsm.strEvent = strL2Event; l2fsm.strEvent = strL2Event;
l2fsm.strState = strL2State; l2fsm.strState = strL2State;
return FsmNew(&l2fsm, L2FnList, L2_FN_COUNT); return FsmNew(&l2fsm, L2FnList, ARRAY_SIZE(L2FnList));
} }
void void
......
...@@ -543,8 +543,6 @@ static struct FsmNode L3FnList[] __initdata = ...@@ -543,8 +543,6 @@ static struct FsmNode L3FnList[] __initdata =
}; };
/* *INDENT-ON* */ /* *INDENT-ON* */
#define L3_FN_COUNT (sizeof(L3FnList)/sizeof(struct FsmNode))
void void
l3_msg(struct PStack *st, int pr, void *arg) l3_msg(struct PStack *st, int pr, void *arg)
{ {
...@@ -587,7 +585,7 @@ Isdnl3New(void) ...@@ -587,7 +585,7 @@ Isdnl3New(void)
l3fsm.event_count = L3_EVENT_COUNT; l3fsm.event_count = L3_EVENT_COUNT;
l3fsm.strEvent = strL3Event; l3fsm.strEvent = strL3Event;
l3fsm.strState = strL3State; l3fsm.strState = strL3State;
return FsmNew(&l3fsm, L3FnList, L3_FN_COUNT); return FsmNew(&l3fsm, L3FnList, ARRAY_SIZE(L3FnList));
} }
void void
......
...@@ -698,9 +698,6 @@ static struct stateentry downstl[] = ...@@ -698,9 +698,6 @@ static struct stateentry downstl[] =
CC_T308_2, l3_1tr6_t308_2}, CC_T308_2, l3_1tr6_t308_2},
}; };
#define DOWNSTL_LEN \
(sizeof(downstl) / sizeof(struct stateentry))
static struct stateentry datastln1[] = static struct stateentry datastln1[] =
{ {
{SBIT(0), {SBIT(0),
...@@ -735,9 +732,6 @@ static struct stateentry datastln1[] = ...@@ -735,9 +732,6 @@ static struct stateentry datastln1[] =
MT_N1_REL_ACK, l3_1tr6_rel_ack} MT_N1_REL_ACK, l3_1tr6_rel_ack}
}; };
#define DATASTLN1_LEN \
(sizeof(datastln1) / sizeof(struct stateentry))
static struct stateentry manstatelist[] = static struct stateentry manstatelist[] =
{ {
{SBIT(2), {SBIT(2),
...@@ -746,8 +740,6 @@ static struct stateentry manstatelist[] = ...@@ -746,8 +740,6 @@ static struct stateentry manstatelist[] =
DL_RELEASE | INDICATION, l3_1tr6_dl_release}, DL_RELEASE | INDICATION, l3_1tr6_dl_release},
}; };
#define MANSLLEN \
(sizeof(manstatelist) / sizeof(struct stateentry))
/* *INDENT-ON* */ /* *INDENT-ON* */
static void static void
...@@ -840,11 +832,11 @@ up1tr6(struct PStack *st, int pr, void *arg) ...@@ -840,11 +832,11 @@ up1tr6(struct PStack *st, int pr, void *arg)
mt = MT_N1_INVALID; mt = MT_N1_INVALID;
} }
} }
for (i = 0; i < DATASTLN1_LEN; i++) for (i = 0; i < ARRAY_SIZE(datastln1); i++)
if ((mt == datastln1[i].primitive) && if ((mt == datastln1[i].primitive) &&
((1 << proc->state) & datastln1[i].state)) ((1 << proc->state) & datastln1[i].state))
break; break;
if (i == DATASTLN1_LEN) { if (i == ARRAY_SIZE(datastln1)) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
if (st->l3.debug & L3_DEB_STATE) { if (st->l3.debug & L3_DEB_STATE) {
sprintf(tmp, "up1tr6%sstate %d mt %x unhandled", sprintf(tmp, "up1tr6%sstate %d mt %x unhandled",
...@@ -892,11 +884,11 @@ down1tr6(struct PStack *st, int pr, void *arg) ...@@ -892,11 +884,11 @@ down1tr6(struct PStack *st, int pr, void *arg)
proc = arg; proc = arg;
} }
for (i = 0; i < DOWNSTL_LEN; i++) for (i = 0; i < ARRAY_SIZE(downstl); i++)
if ((pr == downstl[i].primitive) && if ((pr == downstl[i].primitive) &&
((1 << proc->state) & downstl[i].state)) ((1 << proc->state) & downstl[i].state))
break; break;
if (i == DOWNSTL_LEN) { if (i == ARRAY_SIZE(downstl)) {
if (st->l3.debug & L3_DEB_STATE) { if (st->l3.debug & L3_DEB_STATE) {
sprintf(tmp, "down1tr6 state %d prim %d unhandled", sprintf(tmp, "down1tr6 state %d prim %d unhandled",
proc->state, pr); proc->state, pr);
...@@ -922,11 +914,11 @@ man1tr6(struct PStack *st, int pr, void *arg) ...@@ -922,11 +914,11 @@ man1tr6(struct PStack *st, int pr, void *arg)
printk(KERN_ERR "HiSax man1tr6 without proc pr=%04x\n", pr); printk(KERN_ERR "HiSax man1tr6 without proc pr=%04x\n", pr);
return; return;
} }
for (i = 0; i < MANSLLEN; i++) for (i = 0; i < ARRAY_SIZE(manstatelist); i++)
if ((pr == manstatelist[i].primitive) && if ((pr == manstatelist[i].primitive) &&
((1 << proc->state) & manstatelist[i].state)) ((1 << proc->state) & manstatelist[i].state))
break; break;
if (i == MANSLLEN) { if (i == ARRAY_SIZE(manstatelist)) {
if (st->l3.debug & L3_DEB_STATE) { if (st->l3.debug & L3_DEB_STATE) {
l3_debug(st, "cr %d man1tr6 state %d prim %d unhandled", l3_debug(st, "cr %d man1tr6 state %d prim %d unhandled",
proc->callref & 0x7f, proc->state, pr); proc->callref & 0x7f, proc->state, pr);
......
...@@ -2820,9 +2820,6 @@ static struct stateentry downstatelist[] = ...@@ -2820,9 +2820,6 @@ static struct stateentry downstatelist[] =
CC_T309, l3dss1_dl_release}, CC_T309, l3dss1_dl_release},
}; };
#define DOWNSLLEN \
(sizeof(downstatelist) / sizeof(struct stateentry))
static struct stateentry datastatelist[] = static struct stateentry datastatelist[] =
{ {
{ALL_STATES, {ALL_STATES,
...@@ -2875,9 +2872,6 @@ static struct stateentry datastatelist[] = ...@@ -2875,9 +2872,6 @@ static struct stateentry datastatelist[] =
MT_RESUME_REJECT, l3dss1_resume_rej}, MT_RESUME_REJECT, l3dss1_resume_rej},
}; };
#define DATASLLEN \
(sizeof(datastatelist) / sizeof(struct stateentry))
static struct stateentry globalmes_list[] = static struct stateentry globalmes_list[] =
{ {
{ALL_STATES, {ALL_STATES,
...@@ -2888,8 +2882,6 @@ static struct stateentry globalmes_list[] = ...@@ -2888,8 +2882,6 @@ static struct stateentry globalmes_list[] =
MT_RESTART_ACKNOWLEDGE, l3dss1_restart_ack}, MT_RESTART_ACKNOWLEDGE, l3dss1_restart_ack},
*/ */
}; };
#define GLOBALM_LEN \
(sizeof(globalmes_list) / sizeof(struct stateentry))
static struct stateentry manstatelist[] = static struct stateentry manstatelist[] =
{ {
...@@ -2903,8 +2895,6 @@ static struct stateentry manstatelist[] = ...@@ -2903,8 +2895,6 @@ static struct stateentry manstatelist[] =
DL_RELEASE | INDICATION, l3dss1_dl_release}, DL_RELEASE | INDICATION, l3dss1_dl_release},
}; };
#define MANSLLEN \
(sizeof(manstatelist) / sizeof(struct stateentry))
/* *INDENT-ON* */ /* *INDENT-ON* */
...@@ -2918,11 +2908,11 @@ global_handler(struct PStack *st, int mt, struct sk_buff *skb) ...@@ -2918,11 +2908,11 @@ global_handler(struct PStack *st, int mt, struct sk_buff *skb)
struct l3_process *proc = st->l3.global; struct l3_process *proc = st->l3.global;
proc->callref = skb->data[2]; /* cr flag */ proc->callref = skb->data[2]; /* cr flag */
for (i = 0; i < GLOBALM_LEN; i++) for (i = 0; i < ARRAY_SIZE(globalmes_list); i++)
if ((mt == globalmes_list[i].primitive) && if ((mt == globalmes_list[i].primitive) &&
((1 << proc->state) & globalmes_list[i].state)) ((1 << proc->state) & globalmes_list[i].state))
break; break;
if (i == GLOBALM_LEN) { if (i == ARRAY_SIZE(globalmes_list)) {
if (st->l3.debug & L3_DEB_STATE) { if (st->l3.debug & L3_DEB_STATE) {
l3_debug(st, "dss1 global state %d mt %x unhandled", l3_debug(st, "dss1 global state %d mt %x unhandled",
proc->state, mt); proc->state, mt);
...@@ -3097,11 +3087,11 @@ dss1up(struct PStack *st, int pr, void *arg) ...@@ -3097,11 +3087,11 @@ dss1up(struct PStack *st, int pr, void *arg)
} }
if ((p = findie(skb->data, skb->len, IE_DISPLAY, 0)) != NULL) if ((p = findie(skb->data, skb->len, IE_DISPLAY, 0)) != NULL)
l3dss1_deliver_display(proc, pr, p); /* Display IE included */ l3dss1_deliver_display(proc, pr, p); /* Display IE included */
for (i = 0; i < DATASLLEN; i++) for (i = 0; i < ARRAY_SIZE(datastatelist); i++)
if ((mt == datastatelist[i].primitive) && if ((mt == datastatelist[i].primitive) &&
((1 << proc->state) & datastatelist[i].state)) ((1 << proc->state) & datastatelist[i].state))
break; break;
if (i == DATASLLEN) { if (i == ARRAY_SIZE(datastatelist)) {
if (st->l3.debug & L3_DEB_STATE) { if (st->l3.debug & L3_DEB_STATE) {
l3_debug(st, "dss1up%sstate %d mt %#x unhandled", l3_debug(st, "dss1up%sstate %d mt %#x unhandled",
(pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ", (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ",
...@@ -3156,11 +3146,11 @@ dss1down(struct PStack *st, int pr, void *arg) ...@@ -3156,11 +3146,11 @@ dss1down(struct PStack *st, int pr, void *arg)
return; return;
} }
for (i = 0; i < DOWNSLLEN; i++) for (i = 0; i < ARRAY_SIZE(downstatelist); i++)
if ((pr == downstatelist[i].primitive) && if ((pr == downstatelist[i].primitive) &&
((1 << proc->state) & downstatelist[i].state)) ((1 << proc->state) & downstatelist[i].state))
break; break;
if (i == DOWNSLLEN) { if (i == ARRAY_SIZE(downstatelist)) {
if (st->l3.debug & L3_DEB_STATE) { if (st->l3.debug & L3_DEB_STATE) {
l3_debug(st, "dss1down state %d prim %#x unhandled", l3_debug(st, "dss1down state %d prim %#x unhandled",
proc->state, pr); proc->state, pr);
...@@ -3184,11 +3174,11 @@ dss1man(struct PStack *st, int pr, void *arg) ...@@ -3184,11 +3174,11 @@ dss1man(struct PStack *st, int pr, void *arg)
printk(KERN_ERR "HiSax dss1man without proc pr=%04x\n", pr); printk(KERN_ERR "HiSax dss1man without proc pr=%04x\n", pr);
return; return;
} }
for (i = 0; i < MANSLLEN; i++) for (i = 0; i < ARRAY_SIZE(manstatelist); i++)
if ((pr == manstatelist[i].primitive) && if ((pr == manstatelist[i].primitive) &&
((1 << proc->state) & manstatelist[i].state)) ((1 << proc->state) & manstatelist[i].state))
break; break;
if (i == MANSLLEN) { if (i == ARRAY_SIZE(manstatelist)) {
if (st->l3.debug & L3_DEB_STATE) { if (st->l3.debug & L3_DEB_STATE) {
l3_debug(st, "cr %d dss1man state %d prim %#x unhandled", l3_debug(st, "cr %d dss1man state %d prim %#x unhandled",
proc->callref & 0x7f, proc->state, pr); proc->callref & 0x7f, proc->state, pr);
......
...@@ -2755,9 +2755,6 @@ static struct stateentry downstatelist[] = ...@@ -2755,9 +2755,6 @@ static struct stateentry downstatelist[] =
CC_TSPID, l3ni1_spid_tout }, CC_TSPID, l3ni1_spid_tout },
}; };
#define DOWNSLLEN \
(sizeof(downstatelist) / sizeof(struct stateentry))
static struct stateentry datastatelist[] = static struct stateentry datastatelist[] =
{ {
{ALL_STATES, {ALL_STATES,
...@@ -2810,9 +2807,6 @@ static struct stateentry datastatelist[] = ...@@ -2810,9 +2807,6 @@ static struct stateentry datastatelist[] =
MT_RESUME_REJECT, l3ni1_resume_rej}, MT_RESUME_REJECT, l3ni1_resume_rej},
}; };
#define DATASLLEN \
(sizeof(datastatelist) / sizeof(struct stateentry))
static struct stateentry globalmes_list[] = static struct stateentry globalmes_list[] =
{ {
{ALL_STATES, {ALL_STATES,
...@@ -2825,8 +2819,6 @@ static struct stateentry globalmes_list[] = ...@@ -2825,8 +2819,6 @@ static struct stateentry globalmes_list[] =
{ SBIT( 0 ), MT_DL_ESTABLISHED, l3ni1_spid_send }, { SBIT( 0 ), MT_DL_ESTABLISHED, l3ni1_spid_send },
{ SBIT( 20 ) | SBIT( 21 ) | SBIT( 22 ), MT_INFORMATION, l3ni1_spid_epid }, { SBIT( 20 ) | SBIT( 21 ) | SBIT( 22 ), MT_INFORMATION, l3ni1_spid_epid },
}; };
#define GLOBALM_LEN \
(sizeof(globalmes_list) / sizeof(struct stateentry))
static struct stateentry manstatelist[] = static struct stateentry manstatelist[] =
{ {
...@@ -2840,8 +2832,6 @@ static struct stateentry manstatelist[] = ...@@ -2840,8 +2832,6 @@ static struct stateentry manstatelist[] =
DL_RELEASE | INDICATION, l3ni1_dl_release}, DL_RELEASE | INDICATION, l3ni1_dl_release},
}; };
#define MANSLLEN \
(sizeof(manstatelist) / sizeof(struct stateentry))
/* *INDENT-ON* */ /* *INDENT-ON* */
...@@ -2858,11 +2848,11 @@ global_handler(struct PStack *st, int mt, struct sk_buff *skb) ...@@ -2858,11 +2848,11 @@ global_handler(struct PStack *st, int mt, struct sk_buff *skb)
proc->callref = skb->data[2]; /* cr flag */ proc->callref = skb->data[2]; /* cr flag */
else else
proc->callref = 0; proc->callref = 0;
for (i = 0; i < GLOBALM_LEN; i++) for (i = 0; i < ARRAY_SIZE(globalmes_list); i++)
if ((mt == globalmes_list[i].primitive) && if ((mt == globalmes_list[i].primitive) &&
((1 << proc->state) & globalmes_list[i].state)) ((1 << proc->state) & globalmes_list[i].state))
break; break;
if (i == GLOBALM_LEN) { if (i == ARRAY_SIZE(globalmes_list)) {
if (st->l3.debug & L3_DEB_STATE) { if (st->l3.debug & L3_DEB_STATE) {
l3_debug(st, "ni1 global state %d mt %x unhandled", l3_debug(st, "ni1 global state %d mt %x unhandled",
proc->state, mt); proc->state, mt);
...@@ -3049,11 +3039,11 @@ ni1up(struct PStack *st, int pr, void *arg) ...@@ -3049,11 +3039,11 @@ ni1up(struct PStack *st, int pr, void *arg)
} }
if ((p = findie(skb->data, skb->len, IE_DISPLAY, 0)) != NULL) if ((p = findie(skb->data, skb->len, IE_DISPLAY, 0)) != NULL)
l3ni1_deliver_display(proc, pr, p); /* Display IE included */ l3ni1_deliver_display(proc, pr, p); /* Display IE included */
for (i = 0; i < DATASLLEN; i++) for (i = 0; i < ARRAY_SIZE(datastatelist); i++)
if ((mt == datastatelist[i].primitive) && if ((mt == datastatelist[i].primitive) &&
((1 << proc->state) & datastatelist[i].state)) ((1 << proc->state) & datastatelist[i].state))
break; break;
if (i == DATASLLEN) { if (i == ARRAY_SIZE(datastatelist)) {
if (st->l3.debug & L3_DEB_STATE) { if (st->l3.debug & L3_DEB_STATE) {
l3_debug(st, "ni1up%sstate %d mt %#x unhandled", l3_debug(st, "ni1up%sstate %d mt %#x unhandled",
(pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ", (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ",
...@@ -3108,11 +3098,11 @@ ni1down(struct PStack *st, int pr, void *arg) ...@@ -3108,11 +3098,11 @@ ni1down(struct PStack *st, int pr, void *arg)
return; return;
} }
for (i = 0; i < DOWNSLLEN; i++) for (i = 0; i < ARRAY_SIZE(downstatelist); i++)
if ((pr == downstatelist[i].primitive) && if ((pr == downstatelist[i].primitive) &&
((1 << proc->state) & downstatelist[i].state)) ((1 << proc->state) & downstatelist[i].state))
break; break;
if (i == DOWNSLLEN) { if (i == ARRAY_SIZE(downstatelist)) {
if (st->l3.debug & L3_DEB_STATE) { if (st->l3.debug & L3_DEB_STATE) {
l3_debug(st, "ni1down state %d prim %#x unhandled", l3_debug(st, "ni1down state %d prim %#x unhandled",
proc->state, pr); proc->state, pr);
...@@ -3136,11 +3126,11 @@ ni1man(struct PStack *st, int pr, void *arg) ...@@ -3136,11 +3126,11 @@ ni1man(struct PStack *st, int pr, void *arg)
printk(KERN_ERR "HiSax ni1man without proc pr=%04x\n", pr); printk(KERN_ERR "HiSax ni1man without proc pr=%04x\n", pr);
return; return;
} }
for (i = 0; i < MANSLLEN; i++) for (i = 0; i < ARRAY_SIZE(manstatelist); i++)
if ((pr == manstatelist[i].primitive) && if ((pr == manstatelist[i].primitive) &&
((1 << proc->state) & manstatelist[i].state)) ((1 << proc->state) & manstatelist[i].state))
break; break;
if (i == MANSLLEN) { if (i == ARRAY_SIZE(manstatelist)) {
if (st->l3.debug & L3_DEB_STATE) { if (st->l3.debug & L3_DEB_STATE) {
l3_debug(st, "cr %d ni1man state %d prim %#x unhandled", l3_debug(st, "cr %d ni1man state %d prim %#x unhandled",
proc->callref & 0x7f, proc->state, pr); proc->callref & 0x7f, proc->state, pr);
......
...@@ -140,7 +140,7 @@ struct MessageType { ...@@ -140,7 +140,7 @@ struct MessageType {
} }
}; };
#define MTSIZE sizeof(mtlist)/sizeof(struct MessageType) #define MTSIZE ARRAY_SIZE(mtlist)
static static
struct MessageType mt_n0[] = struct MessageType mt_n0[] =
...@@ -157,7 +157,7 @@ struct MessageType mt_n0[] = ...@@ -157,7 +157,7 @@ struct MessageType mt_n0[] =
{MT_N0_CLO_ACK, "CLOse ACKnowledge"} {MT_N0_CLO_ACK, "CLOse ACKnowledge"}
}; };
#define MT_N0_LEN (sizeof(mt_n0) / sizeof(struct MessageType)) #define MT_N0_LEN ARRAY_SIZE(mt_n0)
static static
struct MessageType mt_n1[] = struct MessageType mt_n1[] =
...@@ -194,7 +194,7 @@ struct MessageType mt_n1[] = ...@@ -194,7 +194,7 @@ struct MessageType mt_n1[] =
{MT_N1_STAT, "STATus"} {MT_N1_STAT, "STATus"}
}; };
#define MT_N1_LEN (sizeof(mt_n1) / sizeof(struct MessageType)) #define MT_N1_LEN ARRAY_SIZE(mt_n1)
static int static int
...@@ -438,7 +438,7 @@ struct CauseValue { ...@@ -438,7 +438,7 @@ struct CauseValue {
}, },
}; };
#define CVSIZE sizeof(cvlist)/sizeof(struct CauseValue) #define CVSIZE ARRAY_SIZE(cvlist)
static static
int int
...@@ -516,7 +516,7 @@ struct MessageType cause_1tr6[] = ...@@ -516,7 +516,7 @@ struct MessageType cause_1tr6[] =
{CAUSE_UserInfoDiscarded, "User Info Discarded"} {CAUSE_UserInfoDiscarded, "User Info Discarded"}
}; };
static int cause_1tr6_len = (sizeof(cause_1tr6) / sizeof(struct MessageType)); static int cause_1tr6_len = ARRAY_SIZE(cause_1tr6);
static int static int
prcause_1tr6(char *dest, u_char * p) prcause_1tr6(char *dest, u_char * p)
...@@ -865,7 +865,7 @@ struct DTag { /* Display tags */ ...@@ -865,7 +865,7 @@ struct DTag { /* Display tags */
{ 0x96, "Redirection name" }, { 0x96, "Redirection name" },
{ 0x9e, "Text" }, { 0x9e, "Text" },
}; };
#define DTAGSIZE sizeof(dtaglist)/sizeof(struct DTag) #define DTAGSIZE ARRAY_SIZE(dtaglist)
static int static int
disptext_ni1(char *dest, u_char * p) disptext_ni1(char *dest, u_char * p)
...@@ -1074,7 +1074,7 @@ struct InformationElement { ...@@ -1074,7 +1074,7 @@ struct InformationElement {
}; };
#define IESIZE sizeof(ielist)/sizeof(struct InformationElement) #define IESIZE ARRAY_SIZE(ielist)
static static
struct InformationElement ielist_ni1[] = { struct InformationElement ielist_ni1[] = {
...@@ -1102,7 +1102,7 @@ struct InformationElement ielist_ni1[] = { ...@@ -1102,7 +1102,7 @@ struct InformationElement ielist_ni1[] = {
}; };
#define IESIZE_NI1 sizeof(ielist_ni1)/sizeof(struct InformationElement) #define IESIZE_NI1 ARRAY_SIZE(ielist_ni1)
static static
struct InformationElement ielist_ni1_cs5[] = { struct InformationElement ielist_ni1_cs5[] = {
...@@ -1110,14 +1110,14 @@ struct InformationElement ielist_ni1_cs5[] = { ...@@ -1110,14 +1110,14 @@ struct InformationElement ielist_ni1_cs5[] = {
{ 0x2a, "Display text", disptext_ni1 }, { 0x2a, "Display text", disptext_ni1 },
}; };
#define IESIZE_NI1_CS5 sizeof(ielist_ni1_cs5)/sizeof(struct InformationElement) #define IESIZE_NI1_CS5 ARRAY_SIZE(ielist_ni1_cs5)
static static
struct InformationElement ielist_ni1_cs6[] = { struct InformationElement ielist_ni1_cs6[] = {
{ 0x7b, "Call appearance", general_ni1 }, { 0x7b, "Call appearance", general_ni1 },
}; };
#define IESIZE_NI1_CS6 sizeof(ielist_ni1_cs6)/sizeof(struct InformationElement) #define IESIZE_NI1_CS6 ARRAY_SIZE(ielist_ni1_cs6)
static struct InformationElement we_0[] = static struct InformationElement we_0[] =
{ {
...@@ -1133,7 +1133,7 @@ static struct InformationElement we_0[] = ...@@ -1133,7 +1133,7 @@ static struct InformationElement we_0[] =
{WE0_userInfo, "User Info", general} {WE0_userInfo, "User Info", general}
}; };
#define WE_0_LEN (sizeof(we_0) / sizeof(struct InformationElement)) #define WE_0_LEN ARRAY_SIZE(we_0)
static struct InformationElement we_6[] = static struct InformationElement we_6[] =
{ {
...@@ -1145,7 +1145,7 @@ static struct InformationElement we_6[] = ...@@ -1145,7 +1145,7 @@ static struct InformationElement we_6[] =
{WE6_statusCalled, "Status Called", general}, {WE6_statusCalled, "Status Called", general},
{WE6_addTransAttr, "Additional Transmission Attributes", general} {WE6_addTransAttr, "Additional Transmission Attributes", general}
}; };
#define WE_6_LEN (sizeof(we_6) / sizeof(struct InformationElement)) #define WE_6_LEN ARRAY_SIZE(we_6)
int int
QuickHex(char *txt, u_char * p, int cnt) QuickHex(char *txt, u_char * p, int cnt)
......
...@@ -447,8 +447,6 @@ static struct FsmNode TeiFnList[] __initdata = ...@@ -447,8 +447,6 @@ static struct FsmNode TeiFnList[] __initdata =
{ST_TEI_IDVERIFY, EV_CHKREQ, tei_id_chk_req}, {ST_TEI_IDVERIFY, EV_CHKREQ, tei_id_chk_req},
}; };
#define TEI_FN_COUNT (sizeof(TeiFnList)/sizeof(struct FsmNode))
int __init int __init
TeiNew(void) TeiNew(void)
{ {
...@@ -456,7 +454,7 @@ TeiNew(void) ...@@ -456,7 +454,7 @@ TeiNew(void)
teifsm.event_count = TEI_EVENT_COUNT; teifsm.event_count = TEI_EVENT_COUNT;
teifsm.strEvent = strTeiEvent; teifsm.strEvent = strTeiEvent;
teifsm.strState = strTeiState; teifsm.strState = strTeiState;
return FsmNew(&teifsm, TeiFnList, TEI_FN_COUNT); return FsmNew(&teifsm, TeiFnList, ARRAY_SIZE(TeiFnList));
} }
void void
......
...@@ -1832,8 +1832,6 @@ static struct FsmNode L2FnList[] = ...@@ -1832,8 +1832,6 @@ static struct FsmNode L2FnList[] =
{ST_L2_8, EV_L1_DEACTIVATE, l2_persistant_da}, {ST_L2_8, EV_L1_DEACTIVATE, l2_persistant_da},
}; };
#define L2_FN_COUNT (sizeof(L2FnList)/sizeof(struct FsmNode))
static int static int
ph_data_indication(struct layer2 *l2, struct mISDNhead *hh, struct sk_buff *skb) ph_data_indication(struct layer2 *l2, struct mISDNhead *hh, struct sk_buff *skb)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment