aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/isdn/act2000/capi.c3
-rw-r--r--drivers/isdn/act2000/module.c31
-rw-r--r--drivers/isdn/hardware/eicon/message.c4
-rw-r--r--drivers/isdn/hardware/eicon/os_4bri.c3
-rw-r--r--drivers/isdn/hisax/callc.c4
-rw-r--r--drivers/isdn/hisax/isdnl1.c12
-rw-r--r--drivers/isdn/hisax/isdnl2.c4
-rw-r--r--drivers/isdn/hisax/isdnl3.c4
-rw-r--r--drivers/isdn/hisax/l3_1tr6.c20
-rw-r--r--drivers/isdn/hisax/l3dss1.c26
-rw-r--r--drivers/isdn/hisax/l3ni1.c26
-rw-r--r--drivers/isdn/hisax/q931.c24
-rw-r--r--drivers/isdn/hisax/tei.c4
-rw-r--r--drivers/isdn/mISDN/layer2.c2
14 files changed, 59 insertions, 108 deletions
diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 946c38cf6f8a..1f0a94906465 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -78,7 +78,6 @@ static actcapi_msgdsc valid_msg[] = {
78#endif 78#endif
79 {{ 0x00, 0x00}, NULL}, 79 {{ 0x00, 0x00}, NULL},
80}; 80};
81#define num_valid_msg (sizeof(valid_msg)/sizeof(actcapi_msgdsc))
82#define num_valid_imsg 27 /* MANUFACTURER_IND */ 81#define num_valid_imsg 27 /* MANUFACTURER_IND */
83 82
84/* 83/*
@@ -1025,7 +1024,7 @@ actcapi_debug_msg(struct sk_buff *skb, int direction)
1025#ifdef DEBUG_DUMP_SKB 1024#ifdef DEBUG_DUMP_SKB
1026 dump_skb(skb); 1025 dump_skb(skb);
1027#endif 1026#endif
1028 for (i = 0; i < num_valid_msg; i++) 1027 for (i = 0; i < ARRAY_SIZE(valid_msg); i++)
1029 if ((msg->hdr.cmd.cmd == valid_msg[i].cmd.cmd) && 1028 if ((msg->hdr.cmd.cmd == valid_msg[i].cmd.cmd) &&
1030 (msg->hdr.cmd.subcmd == valid_msg[i].cmd.subcmd)) { 1029 (msg->hdr.cmd.subcmd == valid_msg[i].cmd.subcmd)) {
1031 descr = valid_msg[i].description; 1030 descr = valid_msg[i].description;
diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 8325022e2bed..f774e12bb64d 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -23,7 +23,6 @@ static unsigned short act2000_isa_ports[] =
23 0x0200, 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380, 23 0x0200, 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380,
24 0xcfe0, 0xcfa0, 0xcf60, 0xcf20, 0xcee0, 0xcea0, 0xce60, 24 0xcfe0, 0xcfa0, 0xcf60, 0xcf20, 0xcee0, 0xcea0, 0xce60,
25}; 25};
26#define ISA_NRPORTS (sizeof(act2000_isa_ports)/sizeof(unsigned short))
27 26
28static act2000_card *cards = (act2000_card *) NULL; 27static act2000_card *cards = (act2000_card *) NULL;
29 28
@@ -686,21 +685,21 @@ act2000_addcard(int bus, int port, int irq, char *id)
686 * This may result in more than one card detected. 685 * This may result in more than one card detected.
687 */ 686 */
688 switch (bus) { 687 switch (bus) {
689 case ACT2000_BUS_ISA: 688 case ACT2000_BUS_ISA:
690 for (i = 0; i < ISA_NRPORTS; i++) 689 for (i = 0; i < ARRAY_SIZE(act2000_isa_ports); i++)
691 if (act2000_isa_detect(act2000_isa_ports[i])) { 690 if (act2000_isa_detect(act2000_isa_ports[i])) {
692 printk(KERN_INFO 691 printk(KERN_INFO "act2000: Detected "
693 "act2000: Detected ISA card at port 0x%x\n", 692 "ISA card at port 0x%x\n",
694 act2000_isa_ports[i]); 693 act2000_isa_ports[i]);
695 act2000_alloccard(bus, act2000_isa_ports[i], irq, id); 694 act2000_alloccard(bus,
696 } 695 act2000_isa_ports[i], irq, id);
697 break; 696 }
698 case ACT2000_BUS_MCA: 697 break;
699 case ACT2000_BUS_PCMCIA: 698 case ACT2000_BUS_MCA:
700 default: 699 case ACT2000_BUS_PCMCIA:
701 printk(KERN_WARNING 700 default:
702 "act2000: addcard: Invalid BUS type %d\n", 701 printk(KERN_WARNING
703 bus); 702 "act2000: addcard: Invalid BUS type %d\n", bus);
704 } 703 }
705 } 704 }
706 if (!cards) 705 if (!cards)
diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
index 31f91c18c698..27d5dd68f4fb 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -551,9 +551,7 @@ word api_put(APPL * appl, CAPI_MSG * msg)
551 dbug(1,dprintf("com=%x",msg->header.command)); 551 dbug(1,dprintf("com=%x",msg->header.command));
552 552
553 for(j=0;j<MAX_MSG_PARMS+1;j++) msg_parms[j].length = 0; 553 for(j=0;j<MAX_MSG_PARMS+1;j++) msg_parms[j].length = 0;
554 for(i=0, ret = _BAD_MSG; 554 for(i=0, ret = _BAD_MSG; i < ARRAY_SIZE(ftable); i++) {
555 i<(sizeof(ftable)/sizeof(struct _ftable));
556 i++) {
557 555
558 if(ftable[i].command==msg->header.command) { 556 if(ftable[i].command==msg->header.command) {
559 /* break loop if the message is correct, otherwise continue scan */ 557 /* break loop if the message is correct, otherwise continue scan */
diff --git a/drivers/isdn/hardware/eicon/os_4bri.c b/drivers/isdn/hardware/eicon/os_4bri.c
index c964b8d91ada..cb7616c5b60a 100644
--- a/drivers/isdn/hardware/eicon/os_4bri.c
+++ b/drivers/isdn/hardware/eicon/os_4bri.c
@@ -149,8 +149,7 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
149 diva_os_xdi_adapter_t *diva_current; 149 diva_os_xdi_adapter_t *diva_current;
150 diva_os_xdi_adapter_t *adapter_list[4]; 150 diva_os_xdi_adapter_t *adapter_list[4];
151 PISDN_ADAPTER Slave; 151 PISDN_ADAPTER Slave;
152 unsigned long bar_length[sizeof(_4bri_bar_length) / 152 unsigned long bar_length[ARRAY_SIZE(_4bri_bar_length)];
153 sizeof(_4bri_bar_length[0])];
154 int v2 = _4bri_is_rev_2_card(a->CardOrdinal); 153 int v2 = _4bri_is_rev_2_card(a->CardOrdinal);
155 int tasks = _4bri_is_rev_2_bri_card(a->CardOrdinal) ? 1 : MQ_INSTANCE_COUNT; 154 int tasks = _4bri_is_rev_2_bri_card(a->CardOrdinal) ? 1 : MQ_INSTANCE_COUNT;
156 int factor = (tasks == 1) ? 1 : 2; 155 int factor = (tasks == 1) ? 1 : 2;
diff --git a/drivers/isdn/hisax/callc.c b/drivers/isdn/hisax/callc.c
index 025a20d487c5..475b1a020003 100644
--- a/drivers/isdn/hisax/callc.c
+++ b/drivers/isdn/hisax/callc.c
@@ -833,8 +833,6 @@ static struct FsmNode fnlist[] __initdata =
833}; 833};
834/* *INDENT-ON* */ 834/* *INDENT-ON* */
835 835
836#define FNCOUNT (sizeof(fnlist)/sizeof(struct FsmNode))
837
838int __init 836int __init
839CallcNew(void) 837CallcNew(void)
840{ 838{
@@ -842,7 +840,7 @@ CallcNew(void)
842 callcfsm.event_count = EVENT_COUNT; 840 callcfsm.event_count = EVENT_COUNT;
843 callcfsm.strEvent = strEvent; 841 callcfsm.strEvent = strEvent;
844 callcfsm.strState = strState; 842 callcfsm.strState = strState;
845 return FsmNew(&callcfsm, fnlist, FNCOUNT); 843 return FsmNew(&callcfsm, fnlist, ARRAY_SIZE(fnlist));
846} 844}
847 845
848void 846void
diff --git a/drivers/isdn/hisax/isdnl1.c b/drivers/isdn/hisax/isdnl1.c
index 317f16f516f2..9ce6abe05b1a 100644
--- a/drivers/isdn/hisax/isdnl1.c
+++ b/drivers/isdn/hisax/isdnl1.c
@@ -647,8 +647,6 @@ static struct FsmNode L1SFnList[] __initdata =
647 {ST_L1_F8, EV_TIMER_DEACT, l1_timer_deact}, 647 {ST_L1_F8, EV_TIMER_DEACT, l1_timer_deact},
648}; 648};
649 649
650#define L1S_FN_COUNT (sizeof(L1SFnList)/sizeof(struct FsmNode))
651
652#ifdef HISAX_UINTERFACE 650#ifdef HISAX_UINTERFACE
653static void 651static void
654l1_deact_req_u(struct FsmInst *fi, int event, void *arg) 652l1_deact_req_u(struct FsmInst *fi, int event, void *arg)
@@ -706,8 +704,6 @@ static struct FsmNode L1UFnList[] __initdata =
706 {ST_L1_RESET, EV_TIMER_DEACT, l1_timer_deact}, 704 {ST_L1_RESET, EV_TIMER_DEACT, l1_timer_deact},
707}; 705};
708 706
709#define L1U_FN_COUNT (sizeof(L1UFnList)/sizeof(struct FsmNode))
710
711#endif 707#endif
712 708
713static void 709static void
@@ -754,8 +750,6 @@ static struct FsmNode L1BFnList[] __initdata =
754 {ST_L1_WAIT_DEACT, EV_TIMER_DEACT, l1b_timer_deact}, 750 {ST_L1_WAIT_DEACT, EV_TIMER_DEACT, l1b_timer_deact},
755}; 751};
756 752
757#define L1B_FN_COUNT (sizeof(L1BFnList)/sizeof(struct FsmNode))
758
759int __init 753int __init
760Isdnl1New(void) 754Isdnl1New(void)
761{ 755{
@@ -765,7 +759,7 @@ Isdnl1New(void)
765 l1fsm_s.event_count = L1_EVENT_COUNT; 759 l1fsm_s.event_count = L1_EVENT_COUNT;
766 l1fsm_s.strEvent = strL1Event; 760 l1fsm_s.strEvent = strL1Event;
767 l1fsm_s.strState = strL1SState; 761 l1fsm_s.strState = strL1SState;
768 retval = FsmNew(&l1fsm_s, L1SFnList, L1S_FN_COUNT); 762 retval = FsmNew(&l1fsm_s, L1SFnList, ARRAY_SIZE(L1SFnList));
769 if (retval) 763 if (retval)
770 return retval; 764 return retval;
771 765
@@ -773,7 +767,7 @@ Isdnl1New(void)
773 l1fsm_b.event_count = L1_EVENT_COUNT; 767 l1fsm_b.event_count = L1_EVENT_COUNT;
774 l1fsm_b.strEvent = strL1Event; 768 l1fsm_b.strEvent = strL1Event;
775 l1fsm_b.strState = strL1BState; 769 l1fsm_b.strState = strL1BState;
776 retval = FsmNew(&l1fsm_b, L1BFnList, L1B_FN_COUNT); 770 retval = FsmNew(&l1fsm_b, L1BFnList, ARRAY_SIZE(L1BFnList));
777 if (retval) { 771 if (retval) {
778 FsmFree(&l1fsm_s); 772 FsmFree(&l1fsm_s);
779 return retval; 773 return retval;
@@ -783,7 +777,7 @@ Isdnl1New(void)
783 l1fsm_u.event_count = L1_EVENT_COUNT; 777 l1fsm_u.event_count = L1_EVENT_COUNT;
784 l1fsm_u.strEvent = strL1Event; 778 l1fsm_u.strEvent = strL1Event;
785 l1fsm_u.strState = strL1UState; 779 l1fsm_u.strState = strL1UState;
786 retval = FsmNew(&l1fsm_u, L1UFnList, L1U_FN_COUNT); 780 retval = FsmNew(&l1fsm_u, L1UFnList, ARRAY_SIZE(L1UFnList));
787 if (retval) { 781 if (retval) {
788 FsmFree(&l1fsm_s); 782 FsmFree(&l1fsm_s);
789 FsmFree(&l1fsm_b); 783 FsmFree(&l1fsm_b);
diff --git a/drivers/isdn/hisax/isdnl2.c b/drivers/isdn/hisax/isdnl2.c
index 3446f249d675..7b9496a63b5f 100644
--- a/drivers/isdn/hisax/isdnl2.c
+++ b/drivers/isdn/hisax/isdnl2.c
@@ -1623,8 +1623,6 @@ static struct FsmNode L2FnList[] __initdata =
1623 {ST_L2_8, EV_L1_DEACTIVATE, l2_persistent_da}, 1623 {ST_L2_8, EV_L1_DEACTIVATE, l2_persistent_da},
1624}; 1624};
1625 1625
1626#define L2_FN_COUNT (sizeof(L2FnList)/sizeof(struct FsmNode))
1627
1628static void 1626static void
1629isdnl2_l1l2(struct PStack *st, int pr, void *arg) 1627isdnl2_l1l2(struct PStack *st, int pr, void *arg)
1630{ 1628{
@@ -1836,7 +1834,7 @@ Isdnl2New(void)
1836 l2fsm.event_count = L2_EVENT_COUNT; 1834 l2fsm.event_count = L2_EVENT_COUNT;
1837 l2fsm.strEvent = strL2Event; 1835 l2fsm.strEvent = strL2Event;
1838 l2fsm.strState = strL2State; 1836 l2fsm.strState = strL2State;
1839 return FsmNew(&l2fsm, L2FnList, L2_FN_COUNT); 1837 return FsmNew(&l2fsm, L2FnList, ARRAY_SIZE(L2FnList));
1840} 1838}
1841 1839
1842void 1840void
diff --git a/drivers/isdn/hisax/isdnl3.c b/drivers/isdn/hisax/isdnl3.c
index 935f23356fae..06766022d3ae 100644
--- a/drivers/isdn/hisax/isdnl3.c
+++ b/drivers/isdn/hisax/isdnl3.c
@@ -543,8 +543,6 @@ static struct FsmNode L3FnList[] __initdata =
543}; 543};
544/* *INDENT-ON* */ 544/* *INDENT-ON* */
545 545
546#define L3_FN_COUNT (sizeof(L3FnList)/sizeof(struct FsmNode))
547
548void 546void
549l3_msg(struct PStack *st, int pr, void *arg) 547l3_msg(struct PStack *st, int pr, void *arg)
550{ 548{
@@ -587,7 +585,7 @@ Isdnl3New(void)
587 l3fsm.event_count = L3_EVENT_COUNT; 585 l3fsm.event_count = L3_EVENT_COUNT;
588 l3fsm.strEvent = strL3Event; 586 l3fsm.strEvent = strL3Event;
589 l3fsm.strState = strL3State; 587 l3fsm.strState = strL3State;
590 return FsmNew(&l3fsm, L3FnList, L3_FN_COUNT); 588 return FsmNew(&l3fsm, L3FnList, ARRAY_SIZE(L3FnList));
591} 589}
592 590
593void 591void
diff --git a/drivers/isdn/hisax/l3_1tr6.c b/drivers/isdn/hisax/l3_1tr6.c
index c5c36eeff261..b0554f80bfb3 100644
--- a/drivers/isdn/hisax/l3_1tr6.c
+++ b/drivers/isdn/hisax/l3_1tr6.c
@@ -698,9 +698,6 @@ static struct stateentry downstl[] =
698 CC_T308_2, l3_1tr6_t308_2}, 698 CC_T308_2, l3_1tr6_t308_2},
699}; 699};
700 700
701#define DOWNSTL_LEN \
702 (sizeof(downstl) / sizeof(struct stateentry))
703
704static struct stateentry datastln1[] = 701static struct stateentry datastln1[] =
705{ 702{
706 {SBIT(0), 703 {SBIT(0),
@@ -735,9 +732,6 @@ static struct stateentry datastln1[] =
735 MT_N1_REL_ACK, l3_1tr6_rel_ack} 732 MT_N1_REL_ACK, l3_1tr6_rel_ack}
736}; 733};
737 734
738#define DATASTLN1_LEN \
739 (sizeof(datastln1) / sizeof(struct stateentry))
740
741static struct stateentry manstatelist[] = 735static struct stateentry manstatelist[] =
742{ 736{
743 {SBIT(2), 737 {SBIT(2),
@@ -746,8 +740,6 @@ static struct stateentry manstatelist[] =
746 DL_RELEASE | INDICATION, l3_1tr6_dl_release}, 740 DL_RELEASE | INDICATION, l3_1tr6_dl_release},
747}; 741};
748 742
749#define MANSLLEN \
750 (sizeof(manstatelist) / sizeof(struct stateentry))
751/* *INDENT-ON* */ 743/* *INDENT-ON* */
752 744
753static void 745static void
@@ -840,11 +832,11 @@ up1tr6(struct PStack *st, int pr, void *arg)
840 mt = MT_N1_INVALID; 832 mt = MT_N1_INVALID;
841 } 833 }
842 } 834 }
843 for (i = 0; i < DATASTLN1_LEN; i++) 835 for (i = 0; i < ARRAY_SIZE(datastln1); i++)
844 if ((mt == datastln1[i].primitive) && 836 if ((mt == datastln1[i].primitive) &&
845 ((1 << proc->state) & datastln1[i].state)) 837 ((1 << proc->state) & datastln1[i].state))
846 break; 838 break;
847 if (i == DATASTLN1_LEN) { 839 if (i == ARRAY_SIZE(datastln1)) {
848 dev_kfree_skb(skb); 840 dev_kfree_skb(skb);
849 if (st->l3.debug & L3_DEB_STATE) { 841 if (st->l3.debug & L3_DEB_STATE) {
850 sprintf(tmp, "up1tr6%sstate %d mt %x unhandled", 842 sprintf(tmp, "up1tr6%sstate %d mt %x unhandled",
@@ -892,11 +884,11 @@ down1tr6(struct PStack *st, int pr, void *arg)
892 proc = arg; 884 proc = arg;
893 } 885 }
894 886
895 for (i = 0; i < DOWNSTL_LEN; i++) 887 for (i = 0; i < ARRAY_SIZE(downstl); i++)
896 if ((pr == downstl[i].primitive) && 888 if ((pr == downstl[i].primitive) &&
897 ((1 << proc->state) & downstl[i].state)) 889 ((1 << proc->state) & downstl[i].state))
898 break; 890 break;
899 if (i == DOWNSTL_LEN) { 891 if (i == ARRAY_SIZE(downstl)) {
900 if (st->l3.debug & L3_DEB_STATE) { 892 if (st->l3.debug & L3_DEB_STATE) {
901 sprintf(tmp, "down1tr6 state %d prim %d unhandled", 893 sprintf(tmp, "down1tr6 state %d prim %d unhandled",
902 proc->state, pr); 894 proc->state, pr);
@@ -922,11 +914,11 @@ man1tr6(struct PStack *st, int pr, void *arg)
922 printk(KERN_ERR "HiSax man1tr6 without proc pr=%04x\n", pr); 914 printk(KERN_ERR "HiSax man1tr6 without proc pr=%04x\n", pr);
923 return; 915 return;
924 } 916 }
925 for (i = 0; i < MANSLLEN; i++) 917 for (i = 0; i < ARRAY_SIZE(manstatelist); i++)
926 if ((pr == manstatelist[i].primitive) && 918 if ((pr == manstatelist[i].primitive) &&
927 ((1 << proc->state) & manstatelist[i].state)) 919 ((1 << proc->state) & manstatelist[i].state))
928 break; 920 break;
929 if (i == MANSLLEN) { 921 if (i == ARRAY_SIZE(manstatelist)) {
930 if (st->l3.debug & L3_DEB_STATE) { 922 if (st->l3.debug & L3_DEB_STATE) {
931 l3_debug(st, "cr %d man1tr6 state %d prim %d unhandled", 923 l3_debug(st, "cr %d man1tr6 state %d prim %d unhandled",
932 proc->callref & 0x7f, proc->state, pr); 924 proc->callref & 0x7f, proc->state, pr);
diff --git a/drivers/isdn/hisax/l3dss1.c b/drivers/isdn/hisax/l3dss1.c
index 99feae8b9210..a12fa4d34903 100644
--- a/drivers/isdn/hisax/l3dss1.c
+++ b/drivers/isdn/hisax/l3dss1.c
@@ -2820,9 +2820,6 @@ static struct stateentry downstatelist[] =
2820 CC_T309, l3dss1_dl_release}, 2820 CC_T309, l3dss1_dl_release},
2821}; 2821};
2822 2822
2823#define DOWNSLLEN \
2824 (sizeof(downstatelist) / sizeof(struct stateentry))
2825
2826static struct stateentry datastatelist[] = 2823static struct stateentry datastatelist[] =
2827{ 2824{
2828 {ALL_STATES, 2825 {ALL_STATES,
@@ -2875,9 +2872,6 @@ static struct stateentry datastatelist[] =
2875 MT_RESUME_REJECT, l3dss1_resume_rej}, 2872 MT_RESUME_REJECT, l3dss1_resume_rej},
2876}; 2873};
2877 2874
2878#define DATASLLEN \
2879 (sizeof(datastatelist) / sizeof(struct stateentry))
2880
2881static struct stateentry globalmes_list[] = 2875static struct stateentry globalmes_list[] =
2882{ 2876{
2883 {ALL_STATES, 2877 {ALL_STATES,
@@ -2888,8 +2882,6 @@ static struct stateentry globalmes_list[] =
2888 MT_RESTART_ACKNOWLEDGE, l3dss1_restart_ack}, 2882 MT_RESTART_ACKNOWLEDGE, l3dss1_restart_ack},
2889*/ 2883*/
2890}; 2884};
2891#define GLOBALM_LEN \
2892 (sizeof(globalmes_list) / sizeof(struct stateentry))
2893 2885
2894static struct stateentry manstatelist[] = 2886static struct stateentry manstatelist[] =
2895{ 2887{
@@ -2903,8 +2895,6 @@ static struct stateentry manstatelist[] =
2903 DL_RELEASE | INDICATION, l3dss1_dl_release}, 2895 DL_RELEASE | INDICATION, l3dss1_dl_release},
2904}; 2896};
2905 2897
2906#define MANSLLEN \
2907 (sizeof(manstatelist) / sizeof(struct stateentry))
2908/* *INDENT-ON* */ 2898/* *INDENT-ON* */
2909 2899
2910 2900
@@ -2918,11 +2908,11 @@ global_handler(struct PStack *st, int mt, struct sk_buff *skb)
2918 struct l3_process *proc = st->l3.global; 2908 struct l3_process *proc = st->l3.global;
2919 2909
2920 proc->callref = skb->data[2]; /* cr flag */ 2910 proc->callref = skb->data[2]; /* cr flag */
2921 for (i = 0; i < GLOBALM_LEN; i++) 2911 for (i = 0; i < ARRAY_SIZE(globalmes_list); i++)
2922 if ((mt == globalmes_list[i].primitive) && 2912 if ((mt == globalmes_list[i].primitive) &&
2923 ((1 << proc->state) & globalmes_list[i].state)) 2913 ((1 << proc->state) & globalmes_list[i].state))
2924 break; 2914 break;
2925 if (i == GLOBALM_LEN) { 2915 if (i == ARRAY_SIZE(globalmes_list)) {
2926 if (st->l3.debug & L3_DEB_STATE) { 2916 if (st->l3.debug & L3_DEB_STATE) {
2927 l3_debug(st, "dss1 global state %d mt %x unhandled", 2917 l3_debug(st, "dss1 global state %d mt %x unhandled",
2928 proc->state, mt); 2918 proc->state, mt);
@@ -3097,11 +3087,11 @@ dss1up(struct PStack *st, int pr, void *arg)
3097 } 3087 }
3098 if ((p = findie(skb->data, skb->len, IE_DISPLAY, 0)) != NULL) 3088 if ((p = findie(skb->data, skb->len, IE_DISPLAY, 0)) != NULL)
3099 l3dss1_deliver_display(proc, pr, p); /* Display IE included */ 3089 l3dss1_deliver_display(proc, pr, p); /* Display IE included */
3100 for (i = 0; i < DATASLLEN; i++) 3090 for (i = 0; i < ARRAY_SIZE(datastatelist); i++)
3101 if ((mt == datastatelist[i].primitive) && 3091 if ((mt == datastatelist[i].primitive) &&
3102 ((1 << proc->state) & datastatelist[i].state)) 3092 ((1 << proc->state) & datastatelist[i].state))
3103 break; 3093 break;
3104 if (i == DATASLLEN) { 3094 if (i == ARRAY_SIZE(datastatelist)) {
3105 if (st->l3.debug & L3_DEB_STATE) { 3095 if (st->l3.debug & L3_DEB_STATE) {
3106 l3_debug(st, "dss1up%sstate %d mt %#x unhandled", 3096 l3_debug(st, "dss1up%sstate %d mt %#x unhandled",
3107 (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ", 3097 (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ",
@@ -3156,11 +3146,11 @@ dss1down(struct PStack *st, int pr, void *arg)
3156 return; 3146 return;
3157 } 3147 }
3158 3148
3159 for (i = 0; i < DOWNSLLEN; i++) 3149 for (i = 0; i < ARRAY_SIZE(downstatelist); i++)
3160 if ((pr == downstatelist[i].primitive) && 3150 if ((pr == downstatelist[i].primitive) &&
3161 ((1 << proc->state) & downstatelist[i].state)) 3151 ((1 << proc->state) & downstatelist[i].state))
3162 break; 3152 break;
3163 if (i == DOWNSLLEN) { 3153 if (i == ARRAY_SIZE(downstatelist)) {
3164 if (st->l3.debug & L3_DEB_STATE) { 3154 if (st->l3.debug & L3_DEB_STATE) {
3165 l3_debug(st, "dss1down state %d prim %#x unhandled", 3155 l3_debug(st, "dss1down state %d prim %#x unhandled",
3166 proc->state, pr); 3156 proc->state, pr);
@@ -3184,11 +3174,11 @@ dss1man(struct PStack *st, int pr, void *arg)
3184 printk(KERN_ERR "HiSax dss1man without proc pr=%04x\n", pr); 3174 printk(KERN_ERR "HiSax dss1man without proc pr=%04x\n", pr);
3185 return; 3175 return;
3186 } 3176 }
3187 for (i = 0; i < MANSLLEN; i++) 3177 for (i = 0; i < ARRAY_SIZE(manstatelist); i++)
3188 if ((pr == manstatelist[i].primitive) && 3178 if ((pr == manstatelist[i].primitive) &&
3189 ((1 << proc->state) & manstatelist[i].state)) 3179 ((1 << proc->state) & manstatelist[i].state))
3190 break; 3180 break;
3191 if (i == MANSLLEN) { 3181 if (i == ARRAY_SIZE(manstatelist)) {
3192 if (st->l3.debug & L3_DEB_STATE) { 3182 if (st->l3.debug & L3_DEB_STATE) {
3193 l3_debug(st, "cr %d dss1man state %d prim %#x unhandled", 3183 l3_debug(st, "cr %d dss1man state %d prim %#x unhandled",
3194 proc->callref & 0x7f, proc->state, pr); 3184 proc->callref & 0x7f, proc->state, pr);
diff --git a/drivers/isdn/hisax/l3ni1.c b/drivers/isdn/hisax/l3ni1.c
index f7041d5ba64e..4622d43c7e10 100644
--- a/drivers/isdn/hisax/l3ni1.c
+++ b/drivers/isdn/hisax/l3ni1.c
@@ -2755,9 +2755,6 @@ static struct stateentry downstatelist[] =
2755 CC_TSPID, l3ni1_spid_tout }, 2755 CC_TSPID, l3ni1_spid_tout },
2756}; 2756};
2757 2757
2758#define DOWNSLLEN \
2759 (sizeof(downstatelist) / sizeof(struct stateentry))
2760
2761static struct stateentry datastatelist[] = 2758static struct stateentry datastatelist[] =
2762{ 2759{
2763 {ALL_STATES, 2760 {ALL_STATES,
@@ -2810,9 +2807,6 @@ static struct stateentry datastatelist[] =
2810 MT_RESUME_REJECT, l3ni1_resume_rej}, 2807 MT_RESUME_REJECT, l3ni1_resume_rej},
2811}; 2808};
2812 2809
2813#define DATASLLEN \
2814 (sizeof(datastatelist) / sizeof(struct stateentry))
2815
2816static struct stateentry globalmes_list[] = 2810static struct stateentry globalmes_list[] =
2817{ 2811{
2818 {ALL_STATES, 2812 {ALL_STATES,
@@ -2825,8 +2819,6 @@ static struct stateentry globalmes_list[] =
2825 { SBIT( 0 ), MT_DL_ESTABLISHED, l3ni1_spid_send }, 2819 { SBIT( 0 ), MT_DL_ESTABLISHED, l3ni1_spid_send },
2826 { SBIT( 20 ) | SBIT( 21 ) | SBIT( 22 ), MT_INFORMATION, l3ni1_spid_epid }, 2820 { SBIT( 20 ) | SBIT( 21 ) | SBIT( 22 ), MT_INFORMATION, l3ni1_spid_epid },
2827}; 2821};
2828#define GLOBALM_LEN \
2829 (sizeof(globalmes_list) / sizeof(struct stateentry))
2830 2822
2831static struct stateentry manstatelist[] = 2823static struct stateentry manstatelist[] =
2832{ 2824{
@@ -2840,8 +2832,6 @@ static struct stateentry manstatelist[] =
2840 DL_RELEASE | INDICATION, l3ni1_dl_release}, 2832 DL_RELEASE | INDICATION, l3ni1_dl_release},
2841}; 2833};
2842 2834
2843#define MANSLLEN \
2844 (sizeof(manstatelist) / sizeof(struct stateentry))
2845/* *INDENT-ON* */ 2835/* *INDENT-ON* */
2846 2836
2847 2837
@@ -2858,11 +2848,11 @@ global_handler(struct PStack *st, int mt, struct sk_buff *skb)
2858 proc->callref = skb->data[2]; /* cr flag */ 2848 proc->callref = skb->data[2]; /* cr flag */
2859 else 2849 else
2860 proc->callref = 0; 2850 proc->callref = 0;
2861 for (i = 0; i < GLOBALM_LEN; i++) 2851 for (i = 0; i < ARRAY_SIZE(globalmes_list); i++)
2862 if ((mt == globalmes_list[i].primitive) && 2852 if ((mt == globalmes_list[i].primitive) &&
2863 ((1 << proc->state) & globalmes_list[i].state)) 2853 ((1 << proc->state) & globalmes_list[i].state))
2864 break; 2854 break;
2865 if (i == GLOBALM_LEN) { 2855 if (i == ARRAY_SIZE(globalmes_list)) {
2866 if (st->l3.debug & L3_DEB_STATE) { 2856 if (st->l3.debug & L3_DEB_STATE) {
2867 l3_debug(st, "ni1 global state %d mt %x unhandled", 2857 l3_debug(st, "ni1 global state %d mt %x unhandled",
2868 proc->state, mt); 2858 proc->state, mt);
@@ -3049,11 +3039,11 @@ ni1up(struct PStack *st, int pr, void *arg)
3049 } 3039 }
3050 if ((p = findie(skb->data, skb->len, IE_DISPLAY, 0)) != NULL) 3040 if ((p = findie(skb->data, skb->len, IE_DISPLAY, 0)) != NULL)
3051 l3ni1_deliver_display(proc, pr, p); /* Display IE included */ 3041 l3ni1_deliver_display(proc, pr, p); /* Display IE included */
3052 for (i = 0; i < DATASLLEN; i++) 3042 for (i = 0; i < ARRAY_SIZE(datastatelist); i++)
3053 if ((mt == datastatelist[i].primitive) && 3043 if ((mt == datastatelist[i].primitive) &&
3054 ((1 << proc->state) & datastatelist[i].state)) 3044 ((1 << proc->state) & datastatelist[i].state))
3055 break; 3045 break;
3056 if (i == DATASLLEN) { 3046 if (i == ARRAY_SIZE(datastatelist)) {
3057 if (st->l3.debug & L3_DEB_STATE) { 3047 if (st->l3.debug & L3_DEB_STATE) {
3058 l3_debug(st, "ni1up%sstate %d mt %#x unhandled", 3048 l3_debug(st, "ni1up%sstate %d mt %#x unhandled",
3059 (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ", 3049 (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ",
@@ -3108,11 +3098,11 @@ ni1down(struct PStack *st, int pr, void *arg)
3108 return; 3098 return;
3109 } 3099 }
3110 3100
3111 for (i = 0; i < DOWNSLLEN; i++) 3101 for (i = 0; i < ARRAY_SIZE(downstatelist); i++)
3112 if ((pr == downstatelist[i].primitive) && 3102 if ((pr == downstatelist[i].primitive) &&
3113 ((1 << proc->state) & downstatelist[i].state)) 3103 ((1 << proc->state) & downstatelist[i].state))
3114 break; 3104 break;
3115 if (i == DOWNSLLEN) { 3105 if (i == ARRAY_SIZE(downstatelist)) {
3116 if (st->l3.debug & L3_DEB_STATE) { 3106 if (st->l3.debug & L3_DEB_STATE) {
3117 l3_debug(st, "ni1down state %d prim %#x unhandled", 3107 l3_debug(st, "ni1down state %d prim %#x unhandled",
3118 proc->state, pr); 3108 proc->state, pr);
@@ -3136,11 +3126,11 @@ ni1man(struct PStack *st, int pr, void *arg)
3136 printk(KERN_ERR "HiSax ni1man without proc pr=%04x\n", pr); 3126 printk(KERN_ERR "HiSax ni1man without proc pr=%04x\n", pr);
3137 return; 3127 return;
3138 } 3128 }
3139 for (i = 0; i < MANSLLEN; i++) 3129 for (i = 0; i < ARRAY_SIZE(manstatelist); i++)
3140 if ((pr == manstatelist[i].primitive) && 3130 if ((pr == manstatelist[i].primitive) &&
3141 ((1 << proc->state) & manstatelist[i].state)) 3131 ((1 << proc->state) & manstatelist[i].state))
3142 break; 3132 break;
3143 if (i == MANSLLEN) { 3133 if (i == ARRAY_SIZE(manstatelist)) {
3144 if (st->l3.debug & L3_DEB_STATE) { 3134 if (st->l3.debug & L3_DEB_STATE) {
3145 l3_debug(st, "cr %d ni1man state %d prim %#x unhandled", 3135 l3_debug(st, "cr %d ni1man state %d prim %#x unhandled",
3146 proc->callref & 0x7f, proc->state, pr); 3136 proc->callref & 0x7f, proc->state, pr);
diff --git a/drivers/isdn/hisax/q931.c b/drivers/isdn/hisax/q931.c
index aacbf0d14b64..8b853d58e820 100644
--- a/drivers/isdn/hisax/q931.c
+++ b/drivers/isdn/hisax/q931.c
@@ -140,7 +140,7 @@ struct MessageType {
140 } 140 }
141}; 141};
142 142
143#define MTSIZE sizeof(mtlist)/sizeof(struct MessageType) 143#define MTSIZE ARRAY_SIZE(mtlist)
144 144
145static 145static
146struct MessageType mt_n0[] = 146struct MessageType mt_n0[] =
@@ -157,7 +157,7 @@ struct MessageType mt_n0[] =
157 {MT_N0_CLO_ACK, "CLOse ACKnowledge"} 157 {MT_N0_CLO_ACK, "CLOse ACKnowledge"}
158}; 158};
159 159
160#define MT_N0_LEN (sizeof(mt_n0) / sizeof(struct MessageType)) 160#define MT_N0_LEN ARRAY_SIZE(mt_n0)
161 161
162static 162static
163struct MessageType mt_n1[] = 163struct MessageType mt_n1[] =
@@ -194,7 +194,7 @@ struct MessageType mt_n1[] =
194 {MT_N1_STAT, "STATus"} 194 {MT_N1_STAT, "STATus"}
195}; 195};
196 196
197#define MT_N1_LEN (sizeof(mt_n1) / sizeof(struct MessageType)) 197#define MT_N1_LEN ARRAY_SIZE(mt_n1)
198 198
199 199
200static int 200static int
@@ -438,7 +438,7 @@ struct CauseValue {
438 }, 438 },
439}; 439};
440 440
441#define CVSIZE sizeof(cvlist)/sizeof(struct CauseValue) 441#define CVSIZE ARRAY_SIZE(cvlist)
442 442
443static 443static
444int 444int
@@ -516,7 +516,7 @@ struct MessageType cause_1tr6[] =
516 {CAUSE_UserInfoDiscarded, "User Info Discarded"} 516 {CAUSE_UserInfoDiscarded, "User Info Discarded"}
517}; 517};
518 518
519static int cause_1tr6_len = (sizeof(cause_1tr6) / sizeof(struct MessageType)); 519static int cause_1tr6_len = ARRAY_SIZE(cause_1tr6);
520 520
521static int 521static int
522prcause_1tr6(char *dest, u_char * p) 522prcause_1tr6(char *dest, u_char * p)
@@ -865,7 +865,7 @@ struct DTag { /* Display tags */
865 { 0x96, "Redirection name" }, 865 { 0x96, "Redirection name" },
866 { 0x9e, "Text" }, 866 { 0x9e, "Text" },
867}; 867};
868#define DTAGSIZE sizeof(dtaglist)/sizeof(struct DTag) 868#define DTAGSIZE ARRAY_SIZE(dtaglist)
869 869
870static int 870static int
871disptext_ni1(char *dest, u_char * p) 871disptext_ni1(char *dest, u_char * p)
@@ -1074,7 +1074,7 @@ struct InformationElement {
1074}; 1074};
1075 1075
1076 1076
1077#define IESIZE sizeof(ielist)/sizeof(struct InformationElement) 1077#define IESIZE ARRAY_SIZE(ielist)
1078 1078
1079static 1079static
1080struct InformationElement ielist_ni1[] = { 1080struct InformationElement ielist_ni1[] = {
@@ -1102,7 +1102,7 @@ struct InformationElement ielist_ni1[] = {
1102}; 1102};
1103 1103
1104 1104
1105#define IESIZE_NI1 sizeof(ielist_ni1)/sizeof(struct InformationElement) 1105#define IESIZE_NI1 ARRAY_SIZE(ielist_ni1)
1106 1106
1107static 1107static
1108struct InformationElement ielist_ni1_cs5[] = { 1108struct InformationElement ielist_ni1_cs5[] = {
@@ -1110,14 +1110,14 @@ struct InformationElement ielist_ni1_cs5[] = {
1110 { 0x2a, "Display text", disptext_ni1 }, 1110 { 0x2a, "Display text", disptext_ni1 },
1111}; 1111};
1112 1112
1113#define IESIZE_NI1_CS5 sizeof(ielist_ni1_cs5)/sizeof(struct InformationElement) 1113#define IESIZE_NI1_CS5 ARRAY_SIZE(ielist_ni1_cs5)
1114 1114
1115static 1115static
1116struct InformationElement ielist_ni1_cs6[] = { 1116struct InformationElement ielist_ni1_cs6[] = {
1117 { 0x7b, "Call appearance", general_ni1 }, 1117 { 0x7b, "Call appearance", general_ni1 },
1118}; 1118};
1119 1119
1120#define IESIZE_NI1_CS6 sizeof(ielist_ni1_cs6)/sizeof(struct InformationElement) 1120#define IESIZE_NI1_CS6 ARRAY_SIZE(ielist_ni1_cs6)
1121 1121
1122static struct InformationElement we_0[] = 1122static struct InformationElement we_0[] =
1123{ 1123{
@@ -1133,7 +1133,7 @@ static struct InformationElement we_0[] =
1133 {WE0_userInfo, "User Info", general} 1133 {WE0_userInfo, "User Info", general}
1134}; 1134};
1135 1135
1136#define WE_0_LEN (sizeof(we_0) / sizeof(struct InformationElement)) 1136#define WE_0_LEN ARRAY_SIZE(we_0)
1137 1137
1138static struct InformationElement we_6[] = 1138static struct InformationElement we_6[] =
1139{ 1139{
@@ -1145,7 +1145,7 @@ static struct InformationElement we_6[] =
1145 {WE6_statusCalled, "Status Called", general}, 1145 {WE6_statusCalled, "Status Called", general},
1146 {WE6_addTransAttr, "Additional Transmission Attributes", general} 1146 {WE6_addTransAttr, "Additional Transmission Attributes", general}
1147}; 1147};
1148#define WE_6_LEN (sizeof(we_6) / sizeof(struct InformationElement)) 1148#define WE_6_LEN ARRAY_SIZE(we_6)
1149 1149
1150int 1150int
1151QuickHex(char *txt, u_char * p, int cnt) 1151QuickHex(char *txt, u_char * p, int cnt)
diff --git a/drivers/isdn/hisax/tei.c b/drivers/isdn/hisax/tei.c
index ceb0df92fd3e..6e65424f1f04 100644
--- a/drivers/isdn/hisax/tei.c
+++ b/drivers/isdn/hisax/tei.c
@@ -447,8 +447,6 @@ static struct FsmNode TeiFnList[] __initdata =
447 {ST_TEI_IDVERIFY, EV_CHKREQ, tei_id_chk_req}, 447 {ST_TEI_IDVERIFY, EV_CHKREQ, tei_id_chk_req},
448}; 448};
449 449
450#define TEI_FN_COUNT (sizeof(TeiFnList)/sizeof(struct FsmNode))
451
452int __init 450int __init
453TeiNew(void) 451TeiNew(void)
454{ 452{
@@ -456,7 +454,7 @@ TeiNew(void)
456 teifsm.event_count = TEI_EVENT_COUNT; 454 teifsm.event_count = TEI_EVENT_COUNT;
457 teifsm.strEvent = strTeiEvent; 455 teifsm.strEvent = strTeiEvent;
458 teifsm.strState = strTeiState; 456 teifsm.strState = strTeiState;
459 return FsmNew(&teifsm, TeiFnList, TEI_FN_COUNT); 457 return FsmNew(&teifsm, TeiFnList, ARRAY_SIZE(TeiFnList));
460} 458}
461 459
462void 460void
diff --git a/drivers/isdn/mISDN/layer2.c b/drivers/isdn/mISDN/layer2.c
index 9c2589e986d6..e17f0044e0b6 100644
--- a/drivers/isdn/mISDN/layer2.c
+++ b/drivers/isdn/mISDN/layer2.c
@@ -1832,8 +1832,6 @@ static struct FsmNode L2FnList[] =
1832 {ST_L2_8, EV_L1_DEACTIVATE, l2_persistant_da}, 1832 {ST_L2_8, EV_L1_DEACTIVATE, l2_persistant_da},
1833}; 1833};
1834 1834
1835#define L2_FN_COUNT (sizeof(L2FnList)/sizeof(struct FsmNode))
1836
1837static int 1835static int
1838ph_data_indication(struct layer2 *l2, struct mISDNhead *hh, struct sk_buff *skb) 1836ph_data_indication(struct layer2 *l2, struct mISDNhead *hh, struct sk_buff *skb)
1839{ 1837{