aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hardware/eicon
diff options
context:
space:
mode:
authorAhmed S. Darwish <darwish.07@gmail.com>2007-02-12 03:53:27 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:35 -0500
commitf85aaeba458fda1de199a73566c641516e9a935d (patch)
tree4c46105fdb6cd1987c7452ac1fd06f2af6353380 /drivers/isdn/hardware/eicon
parent053b47ff249b9e0a634dae807f81465205e7c228 (diff)
[PATCH] isdn-eicon: Use ARRAY_SIZE macro when appropriate
Use ARRAY_SIZE macro already defined in kernel.h Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com> Cc: Karsten Keil <kkeil@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/isdn/hardware/eicon')
-rw-r--r--drivers/isdn/hardware/eicon/debug.c30
-rw-r--r--drivers/isdn/hardware/eicon/message.c23
-rw-r--r--drivers/isdn/hardware/eicon/platform.h4
3 files changed, 26 insertions, 31 deletions
diff --git a/drivers/isdn/hardware/eicon/debug.c b/drivers/isdn/hardware/eicon/debug.c
index d835e74ecf18..0db9cc661e28 100644
--- a/drivers/isdn/hardware/eicon/debug.c
+++ b/drivers/isdn/hardware/eicon/debug.c
@@ -287,7 +287,7 @@ void* diva_maint_finit (void) {
287 } 287 }
288 external_dbg_queue = 0; 288 external_dbg_queue = 0;
289 289
290 for (i = 1; i < (sizeof(clients)/sizeof(clients[0])); i++) { 290 for (i = 1; i < ARRAY_SIZE(clients); i++) {
291 if (clients[i].pmem) { 291 if (clients[i].pmem) {
292 diva_os_free (0, clients[i].pmem); 292 diva_os_free (0, clients[i].pmem);
293 } 293 }
@@ -391,7 +391,7 @@ static void DI_register (void *arg) {
391 391
392 diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "register"); 392 diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "register");
393 393
394 for (id = 1; id < (sizeof(clients)/sizeof(clients[0])); id++) { 394 for (id = 1; id < ARRAY_SIZE(clients); id++) {
395 if (clients[id].hDbg == hDbg) { 395 if (clients[id].hDbg == hDbg) {
396 /* 396 /*
397 driver already registered 397 driver already registered
@@ -494,7 +494,7 @@ static void DI_deregister (pDbgHandle hDbg) {
494 diva_os_enter_spin_lock (&dbg_adapter_lock, &old_irql1, "read"); 494 diva_os_enter_spin_lock (&dbg_adapter_lock, &old_irql1, "read");
495 diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "read"); 495 diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "read");
496 496
497 for (i = 1; i < (sizeof(clients)/sizeof(clients[0])); i++) { 497 for (i = 1; i < ARRAY_SIZE(clients); i++) {
498 if (clients[i].hDbg == hDbg) { 498 if (clients[i].hDbg == hDbg) {
499 diva_dbg_entry_head_t* pmsg; 499 diva_dbg_entry_head_t* pmsg;
500 char tmp[256]; 500 char tmp[256];
@@ -736,7 +736,7 @@ int diva_get_driver_info (dword id, byte* data, int data_length) {
736 int to_copy; 736 int to_copy;
737 737
738 if (!data || !id || (data_length < 17) || 738 if (!data || !id || (data_length < 17) ||
739 (id >= (sizeof(clients)/sizeof(clients[0])))) { 739 (id >= ARRAY_SIZE(clients))) {
740 return (-1); 740 return (-1);
741 } 741 }
742 742
@@ -786,7 +786,7 @@ int diva_get_driver_dbg_mask (dword id, byte* data) {
786 diva_os_spin_lock_magic_t old_irql; 786 diva_os_spin_lock_magic_t old_irql;
787 int ret = -1; 787 int ret = -1;
788 788
789 if (!data || !id || (id >= (sizeof(clients)/sizeof(clients[0])))) { 789 if (!data || !id || (id >= ARRAY_SIZE(clients))) {
790 return (-1); 790 return (-1);
791 } 791 }
792 diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "driver info"); 792 diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "driver info");
@@ -809,7 +809,7 @@ int diva_set_driver_dbg_mask (dword id, dword mask) {
809 int ret = -1; 809 int ret = -1;
810 810
811 811
812 if (!id || (id >= (sizeof(clients)/sizeof(clients[0])))) { 812 if (!id || (id >= ARRAY_SIZE(clients))) {
813 return (-1); 813 return (-1);
814 } 814 }
815 815
@@ -887,7 +887,7 @@ void diva_mnt_add_xdi_adapter (const DESCRIPTOR* d) {
887 diva_os_enter_spin_lock (&dbg_adapter_lock, &old_irql1, "register"); 887 diva_os_enter_spin_lock (&dbg_adapter_lock, &old_irql1, "register");
888 diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "register"); 888 diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "register");
889 889
890 for (id = 1; id < (sizeof(clients)/sizeof(clients[0])); id++) { 890 for (id = 1; id < ARRAY_SIZE(clients); id++) {
891 if (clients[id].hDbg && (clients[id].request == d->request)) { 891 if (clients[id].hDbg && (clients[id].request == d->request)) {
892 diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "register"); 892 diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "register");
893 diva_os_leave_spin_lock (&dbg_adapter_lock, &old_irql1, "register"); 893 diva_os_leave_spin_lock (&dbg_adapter_lock, &old_irql1, "register");
@@ -1037,7 +1037,7 @@ void diva_mnt_remove_xdi_adapter (const DESCRIPTOR* d) {
1037 diva_os_enter_spin_lock (&dbg_adapter_lock, &old_irql1, "read"); 1037 diva_os_enter_spin_lock (&dbg_adapter_lock, &old_irql1, "read");
1038 diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "read"); 1038 diva_os_enter_spin_lock (&dbg_q_lock, &old_irql, "read");
1039 1039
1040 for (i = 1; i < (sizeof(clients)/sizeof(clients[0])); i++) { 1040 for (i = 1; i < ARRAY_SIZE(clients); i++) {
1041 if (clients[i].hDbg && (clients[i].request == d->request)) { 1041 if (clients[i].hDbg && (clients[i].request == d->request)) {
1042 diva_dbg_entry_head_t* pmsg; 1042 diva_dbg_entry_head_t* pmsg;
1043 char tmp[256]; 1043 char tmp[256];
@@ -1115,7 +1115,7 @@ void diva_mnt_remove_xdi_adapter (const DESCRIPTOR* d) {
1115void* SuperTraceOpenAdapter (int AdapterNumber) { 1115void* SuperTraceOpenAdapter (int AdapterNumber) {
1116 int i; 1116 int i;
1117 1117
1118 for (i = 1; i < (sizeof(clients)/sizeof(clients[0])); i++) { 1118 for (i = 1; i < ARRAY_SIZE(clients); i++) {
1119 if (clients[i].hDbg && clients[i].request && (clients[i].logical == AdapterNumber)) { 1119 if (clients[i].hDbg && clients[i].request && (clients[i].logical == AdapterNumber)) {
1120 return (&clients[i]); 1120 return (&clients[i]);
1121 } 1121 }
@@ -1508,7 +1508,7 @@ static void diva_maint_state_change_notify (void* user_context,
1508 int ch = TraceFilterChannel; 1508 int ch = TraceFilterChannel;
1509 int id = TraceFilterIdent; 1509 int id = TraceFilterIdent;
1510 1510
1511 if ((id >= 0) && (ch >= 0) && (id < sizeof(clients)/sizeof(clients[0])) && 1511 if ((id >= 0) && (ch >= 0) && (id < ARRAY_SIZE(clients)) &&
1512 (clients[id].Dbg.id == (byte)id) && (clients[id].pIdiLib == hLib)) { 1512 (clients[id].Dbg.id == (byte)id) && (clients[id].pIdiLib == hLib)) {
1513 if (ch != (int)modem->ChannelNumber) { 1513 if (ch != (int)modem->ChannelNumber) {
1514 break; 1514 break;
@@ -1555,7 +1555,7 @@ static void diva_maint_state_change_notify (void* user_context,
1555 int ch = TraceFilterChannel; 1555 int ch = TraceFilterChannel;
1556 int id = TraceFilterIdent; 1556 int id = TraceFilterIdent;
1557 1557
1558 if ((id >= 0) && (ch >= 0) && (id < sizeof(clients)/sizeof(clients[0])) && 1558 if ((id >= 0) && (ch >= 0) && (id < ARRAY_SIZE(clients)) &&
1559 (clients[id].Dbg.id == (byte)id) && (clients[id].pIdiLib == hLib)) { 1559 (clients[id].Dbg.id == (byte)id) && (clients[id].pIdiLib == hLib)) {
1560 if (ch != (int)fax->ChannelNumber) { 1560 if (ch != (int)fax->ChannelNumber) {
1561 break; 1561 break;
@@ -1803,7 +1803,7 @@ static void diva_maint_trace_notify (void* user_context,
1803 /* 1803 /*
1804 Selective trace 1804 Selective trace
1805 */ 1805 */
1806 if ((id >= 0) && (ch >= 0) && (id < sizeof(clients)/sizeof(clients[0])) && 1806 if ((id >= 0) && (ch >= 0) && (id < ARRAY_SIZE(clients)) &&
1807 (clients[id].Dbg.id == (byte)id) && (clients[id].pIdiLib == hLib)) { 1807 (clients[id].Dbg.id == (byte)id) && (clients[id].pIdiLib == hLib)) {
1808 const char* p = NULL; 1808 const char* p = NULL;
1809 int ch_value = -1; 1809 int ch_value = -1;
@@ -1925,7 +1925,7 @@ int diva_mnt_shutdown_xdi_adapters (void) {
1925 byte * pmem; 1925 byte * pmem;
1926 1926
1927 1927
1928 for (i = 1; i < (sizeof(clients)/sizeof(clients[0])); i++) { 1928 for (i = 1; i < ARRAY_SIZE(clients); i++) {
1929 pmem = NULL; 1929 pmem = NULL;
1930 1930
1931 diva_os_enter_spin_lock (&dbg_adapter_lock, &old_irql1, "unload"); 1931 diva_os_enter_spin_lock (&dbg_adapter_lock, &old_irql1, "unload");
@@ -2006,7 +2006,7 @@ int diva_set_trace_filter (int filter_length, const char* filter) {
2006 2006
2007 on = (TraceFilter[0] == 0); 2007 on = (TraceFilter[0] == 0);
2008 2008
2009 for (i = 1; i < (sizeof(clients)/sizeof(clients[0])); i++) { 2009 for (i = 1; i < ARRAY_SIZE(clients); i++) {
2010 if (clients[i].hDbg && clients[i].pIdiLib && clients[i].request) { 2010 if (clients[i].hDbg && clients[i].pIdiLib && clients[i].request) {
2011 client_b_on = on && ((clients[i].hDbg->dbgMask & DIVA_MGT_DBG_IFC_BCHANNEL) != 0); 2011 client_b_on = on && ((clients[i].hDbg->dbgMask & DIVA_MGT_DBG_IFC_BCHANNEL) != 0);
2012 client_atap_on = on && ((clients[i].hDbg->dbgMask & DIVA_MGT_DBG_IFC_AUDIO) != 0); 2012 client_atap_on = on && ((clients[i].hDbg->dbgMask & DIVA_MGT_DBG_IFC_AUDIO) != 0);
@@ -2017,7 +2017,7 @@ int diva_set_trace_filter (int filter_length, const char* filter) {
2017 } 2017 }
2018 } 2018 }
2019 2019
2020 for (i = 1; i < (sizeof(clients)/sizeof(clients[0])); i++) { 2020 for (i = 1; i < ARRAY_SIZE(clients); i++) {
2021 if (clients[i].hDbg && clients[i].pIdiLib && clients[i].request && clients[i].request_pending) { 2021 if (clients[i].hDbg && clients[i].pIdiLib && clients[i].request && clients[i].request_pending) {
2022 diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "write_filter"); 2022 diva_os_leave_spin_lock (&dbg_q_lock, &old_irql, "write_filter");
2023 clients[i].request_pending = 0; 2023 clients[i].request_pending = 0;
diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
index ab1c112dfb7c..784232a144c8 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -6812,7 +6812,7 @@ void nl_ind(PLCI * plci)
6812 } 6812 }
6813 if (((plci->NL.Ind & 0x0f) == N_DISC) || ((plci->NL.Ind & 0x0f) == N_DISC_ACK)) 6813 if (((plci->NL.Ind & 0x0f) == N_DISC) || ((plci->NL.Ind & 0x0f) == N_DISC_ACK))
6814 { 6814 {
6815 if (((T30_INFO *)plci->NL.RBuffer->P)->code < sizeof(fax_info) / sizeof(fax_info[0])) 6815 if (((T30_INFO *)plci->NL.RBuffer->P)->code < ARRAY_SIZE(fax_info))
6816 info = fax_info[((T30_INFO *)plci->NL.RBuffer->P)->code]; 6816 info = fax_info[((T30_INFO *)plci->NL.RBuffer->P)->code];
6817 else 6817 else
6818 info = _FAX_PROTOCOL_ERROR; 6818 info = _FAX_PROTOCOL_ERROR;
@@ -9564,7 +9564,7 @@ static struct
9564 9564
9565}; 9565};
9566 9566
9567#define DTMF_DIGIT_MAP_ENTRIES (sizeof(dtmf_digit_map) / sizeof(dtmf_digit_map[0])) 9567#define DTMF_DIGIT_MAP_ENTRIES ARRAY_SIZE(dtmf_digit_map)
9568 9568
9569 9569
9570static void dtmf_enable_receiver (PLCI *plci, byte enable_mask) 9570static void dtmf_enable_receiver (PLCI *plci, byte enable_mask)
@@ -10069,8 +10069,7 @@ static byte dtmf_request (dword Id, word Number, DIVA_CAPI_ADAPTER *a, PLCI
10069 PUT_WORD (&result[1], DTMF_INCORRECT_DIGIT); 10069 PUT_WORD (&result[1], DTMF_INCORRECT_DIGIT);
10070 break; 10070 break;
10071 } 10071 }
10072 if (plci->dtmf_send_requests >= 10072 if (plci->dtmf_send_requests >= ARRAY_SIZE(plci->dtmf_msg_number_queue))
10073 sizeof(plci->dtmf_msg_number_queue) / sizeof(plci->dtmf_msg_number_queue[0]))
10074 { 10073 {
10075 dbug (1, dprintf ("[%06lx] %s,%d: DTMF request overrun", 10074 dbug (1, dprintf ("[%06lx] %s,%d: DTMF request overrun",
10076 UnMapId (Id), (char *)(FILE_), __LINE__)); 10075 UnMapId (Id), (char *)(FILE_), __LINE__));
@@ -11018,9 +11017,9 @@ static byte xconnect_write_coefs_process (dword Id, PLCI *plci, byte Rc)
11018 li_config_table[i].coef_table[j] ^= xconnect_write_prog[n].mask << 4; 11017 li_config_table[i].coef_table[j] ^= xconnect_write_prog[n].mask << 4;
11019 } 11018 }
11020 n++; 11019 n++;
11021 } while ((n < sizeof(xconnect_write_prog) / sizeof(xconnect_write_prog[0])) 11020 } while ((n < ARRAY_SIZE(xconnect_write_prog))
11022 && ((p - plci->internal_req_buffer) + 16 < INTERNAL_REQ_BUFFER_SIZE)); 11021 && ((p - plci->internal_req_buffer) + 16 < INTERNAL_REQ_BUFFER_SIZE));
11023 if (n == sizeof(xconnect_write_prog) / sizeof(xconnect_write_prog[0])) 11022 if (n == ARRAY_SIZE(xconnect_write_prog))
11024 { 11023 {
11025 do 11024 do
11026 { 11025 {
@@ -11090,7 +11089,7 @@ static byte xconnect_write_coefs_process (dword Id, PLCI *plci, byte Rc)
11090 ch_map[j+1] = (byte)(j+1); 11089 ch_map[j+1] = (byte)(j+1);
11091 } 11090 }
11092 } 11091 }
11093 for (n = 0; n < sizeof(mixer_write_prog_bri) / sizeof(mixer_write_prog_bri[0]); n++) 11092 for (n = 0; n < ARRAY_SIZE(mixer_write_prog_bri); n++)
11094 { 11093 {
11095 i = a->li_base + ch_map[mixer_write_prog_bri[n].to_ch]; 11094 i = a->li_base + ch_map[mixer_write_prog_bri[n].to_ch];
11096 j = a->li_base + ch_map[mixer_write_prog_bri[n].from_ch]; 11095 j = a->li_base + ch_map[mixer_write_prog_bri[n].from_ch];
@@ -11140,7 +11139,7 @@ static byte xconnect_write_coefs_process (dword Id, PLCI *plci, byte Rc)
11140 w |= MIXER_FEATURE_ENABLE_RX_DATA; 11139 w |= MIXER_FEATURE_ENABLE_RX_DATA;
11141 *(p++) = (byte) w; 11140 *(p++) = (byte) w;
11142 *(p++) = (byte)(w >> 8); 11141 *(p++) = (byte)(w >> 8);
11143 for (n = 0; n < sizeof(mixer_write_prog_pri) / sizeof(mixer_write_prog_pri[0]); n++) 11142 for (n = 0; n < ARRAY_SIZE(mixer_write_prog_pri); n++)
11144 { 11143 {
11145 *(p++) = (byte)((plci->li_bchannel_id - 1) | mixer_write_prog_pri[n].line_flags); 11144 *(p++) = (byte)((plci->li_bchannel_id - 1) | mixer_write_prog_pri[n].line_flags);
11146 for (j = a->li_base; j < a->li_base + MIXER_CHANNELS_PRI; j++) 11145 for (j = a->li_base; j < a->li_base + MIXER_CHANNELS_PRI; j++)
@@ -11196,7 +11195,7 @@ static byte xconnect_write_coefs_process (dword Id, PLCI *plci, byte Rc)
11196 ch_map[j+1] = (byte)(j+1); 11195 ch_map[j+1] = (byte)(j+1);
11197 } 11196 }
11198 } 11197 }
11199 for (n = 0; n < sizeof(mixer_write_prog_bri) / sizeof(mixer_write_prog_bri[0]); n++) 11198 for (n = 0; n < ARRAY_SIZE(mixer_write_prog_bri); n++)
11200 { 11199 {
11201 i = a->li_base + ch_map[mixer_write_prog_bri[n].to_ch]; 11200 i = a->li_base + ch_map[mixer_write_prog_bri[n].to_ch];
11202 j = a->li_base + ch_map[mixer_write_prog_bri[n].from_ch]; 11201 j = a->li_base + ch_map[mixer_write_prog_bri[n].from_ch];
@@ -13178,7 +13177,7 @@ static void adv_voice_write_coefs (PLCI *plci, word write_command)
13178 ch_map[j] = (byte)(j + (plci->li_bchannel_id - 1)); 13177 ch_map[j] = (byte)(j + (plci->li_bchannel_id - 1));
13179 ch_map[j+1] = (byte)(j + (2 - plci->li_bchannel_id)); 13178 ch_map[j+1] = (byte)(j + (2 - plci->li_bchannel_id));
13180 } 13179 }
13181 for (n = 0; n < sizeof(mixer_write_prog_bri) / sizeof(mixer_write_prog_bri[0]); n++) 13180 for (n = 0; n < ARRAY_SIZE(mixer_write_prog_bri); n++)
13182 { 13181 {
13183 i = a->li_base + ch_map[mixer_write_prog_bri[n].to_ch]; 13182 i = a->li_base + ch_map[mixer_write_prog_bri[n].to_ch];
13184 j = a->li_base + ch_map[mixer_write_prog_bri[n].from_ch]; 13183 j = a->li_base + ch_map[mixer_write_prog_bri[n].from_ch];
@@ -14603,7 +14602,7 @@ static void channel_request_xon (PLCI * plci, byte ch) {
14603 14602
14604static void channel_xmit_extended_xon (PLCI * plci) { 14603static void channel_xmit_extended_xon (PLCI * plci) {
14605 DIVA_CAPI_ADAPTER * a; 14604 DIVA_CAPI_ADAPTER * a;
14606 int max_ch = sizeof(a->ch_flow_control)/sizeof(a->ch_flow_control[0]); 14605 int max_ch = ARRAY_SIZE(a->ch_flow_control);
14607 int i, one_requested = 0; 14606 int i, one_requested = 0;
14608 14607
14609 if ((!plci) || (!plci->Id) || ((a = plci->adapter) == 0)) { 14608 if ((!plci) || (!plci->Id) || ((a = plci->adapter) == 0)) {
@@ -14628,7 +14627,7 @@ static void channel_xmit_extended_xon (PLCI * plci) {
14628 Try to xmit next X_ON 14627 Try to xmit next X_ON
14629 */ 14628 */
14630static int find_channel_with_pending_x_on (DIVA_CAPI_ADAPTER * a, PLCI * plci) { 14629static int find_channel_with_pending_x_on (DIVA_CAPI_ADAPTER * a, PLCI * plci) {
14631 int max_ch = sizeof(a->ch_flow_control)/sizeof(a->ch_flow_control[0]); 14630 int max_ch = ARRAY_SIZE(a->ch_flow_control);
14632 int i; 14631 int i;
14633 14632
14634 if (!(plci->adapter->manufacturer_features & MANUFACTURER_FEATURE_XONOFF_FLOW_CONTROL)) { 14633 if (!(plci->adapter->manufacturer_features & MANUFACTURER_FEATURE_XONOFF_FLOW_CONTROL)) {
diff --git a/drivers/isdn/hardware/eicon/platform.h b/drivers/isdn/hardware/eicon/platform.h
index 16714cb0ef7d..ff09f07f440a 100644
--- a/drivers/isdn/hardware/eicon/platform.h
+++ b/drivers/isdn/hardware/eicon/platform.h
@@ -123,10 +123,6 @@
123#define DIVA_OS_MEM_DETACH_CONFIG(a, x) do { } while(0) 123#define DIVA_OS_MEM_DETACH_CONFIG(a, x) do { } while(0)
124#define DIVA_OS_MEM_DETACH_CONTROL(a, x) do { } while(0) 124#define DIVA_OS_MEM_DETACH_CONTROL(a, x) do { } while(0)
125 125
126#if !defined(DIM)
127#define DIM(array) (sizeof (array)/sizeof ((array)[0]))
128#endif
129
130#define DIVA_INVALID_FILE_HANDLE ((dword)(-1)) 126#define DIVA_INVALID_FILE_HANDLE ((dword)(-1))
131 127
132#define DIVAS_CONTAINING_RECORD(address, type, field) \ 128#define DIVAS_CONTAINING_RECORD(address, type, field) \