diff options
author | Ian Munsie <imunsie@au.ibm.com> | 2010-03-11 07:07:25 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-03-15 18:47:02 -0400 |
commit | 255f5c327ec3a1d77fe54ef5773ef5eaf7c35a3e (patch) | |
tree | d6aa998fc560df1c44e353818ec04db3daf3e779 /drivers/isdn/hardware | |
parent | 8b4017d8c191822f1c93744e7876c9020e6209aa (diff) |
i4l: change magic numbers in Eicon DIVA ISDN driver to symbolic names
Replace references to the '20' magic number found throughout the Eicon
ISDN driver for the length of the station_id field in the T30_INFO struct
with the T30_MAX_STATION_ID_LENGTH symbolic constant.
Signed-off-by: Ian Munsie <imunsie@au.ibm.com>
Cc: Armin Schindler <mac@melware.de>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: Stoyan Gaydarov <sgayda2@uiuc.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/hardware')
-rw-r--r-- | drivers/isdn/hardware/eicon/message.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c index 4bd469b0c631..341ef17c22ac 100644 --- a/drivers/isdn/hardware/eicon/message.c +++ b/drivers/isdn/hardware/eicon/message.c | |||
@@ -2754,7 +2754,7 @@ static byte connect_b3_req(dword Id, word Number, DIVA_CAPI_ADAPTER *a, | |||
2754 | for (i = 0; i < w; i++) | 2754 | for (i = 0; i < w; i++) |
2755 | ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id[i] = fax_parms[4].info[1+i]; | 2755 | ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id[i] = fax_parms[4].info[1+i]; |
2756 | ((T30_INFO *)(plci->fax_connect_info_buffer))->head_line_len = 0; | 2756 | ((T30_INFO *)(plci->fax_connect_info_buffer))->head_line_len = 0; |
2757 | len = offsetof(T30_INFO, station_id) + 20; | 2757 | len = offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH; |
2758 | w = fax_parms[5].length; | 2758 | w = fax_parms[5].length; |
2759 | if (w > 20) | 2759 | if (w > 20) |
2760 | w = 20; | 2760 | w = 20; |
@@ -2892,7 +2892,7 @@ static byte connect_b3_res(dword Id, word Number, DIVA_CAPI_ADAPTER *a, | |||
2892 | && (plci->nsf_control_bits & T30_NSF_CONTROL_BIT_ENABLE_NSF) | 2892 | && (plci->nsf_control_bits & T30_NSF_CONTROL_BIT_ENABLE_NSF) |
2893 | && (plci->nsf_control_bits & T30_NSF_CONTROL_BIT_NEGOTIATE_RESP)) | 2893 | && (plci->nsf_control_bits & T30_NSF_CONTROL_BIT_NEGOTIATE_RESP)) |
2894 | { | 2894 | { |
2895 | len = offsetof(T30_INFO, station_id) + 20; | 2895 | len = offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH; |
2896 | if (plci->fax_connect_info_length < len) | 2896 | if (plci->fax_connect_info_length < len) |
2897 | { | 2897 | { |
2898 | ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id_len = 0; | 2898 | ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id_len = 0; |
@@ -3802,7 +3802,7 @@ static byte manufacturer_res(dword Id, word Number, DIVA_CAPI_ADAPTER *a, | |||
3802 | break; | 3802 | break; |
3803 | } | 3803 | } |
3804 | ncpi = &m_parms[1]; | 3804 | ncpi = &m_parms[1]; |
3805 | len = offsetof(T30_INFO, station_id) + 20; | 3805 | len = offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH; |
3806 | if (plci->fax_connect_info_length < len) | 3806 | if (plci->fax_connect_info_length < len) |
3807 | { | 3807 | { |
3808 | ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id_len = 0; | 3808 | ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id_len = 0; |
@@ -6830,7 +6830,7 @@ static void nl_ind(PLCI *plci) | |||
6830 | if(((T30_INFO *)plci->NL.RBuffer->P)->station_id_len) | 6830 | if(((T30_INFO *)plci->NL.RBuffer->P)->station_id_len) |
6831 | { | 6831 | { |
6832 | plci->ncpi_buffer[len] = 20; | 6832 | plci->ncpi_buffer[len] = 20; |
6833 | for (i = 0; i < 20; i++) | 6833 | for (i = 0; i < T30_MAX_STATION_ID_LENGTH; i++) |
6834 | plci->ncpi_buffer[++len] = ((T30_INFO *)plci->NL.RBuffer->P)->station_id[i]; | 6834 | plci->ncpi_buffer[++len] = ((T30_INFO *)plci->NL.RBuffer->P)->station_id[i]; |
6835 | } | 6835 | } |
6836 | if (((plci->NL.Ind & 0x0f) == N_DISC) || ((plci->NL.Ind & 0x0f) == N_DISC_ACK)) | 6836 | if (((plci->NL.Ind & 0x0f) == N_DISC) || ((plci->NL.Ind & 0x0f) == N_DISC_ACK)) |
@@ -6844,7 +6844,7 @@ static void nl_ind(PLCI *plci) | |||
6844 | if ((plci->requested_options_conn | plci->requested_options | a->requested_options_table[plci->appl->Id-1]) | 6844 | if ((plci->requested_options_conn | plci->requested_options | a->requested_options_table[plci->appl->Id-1]) |
6845 | & ((1L << PRIVATE_FAX_SUB_SEP_PWD) | (1L << PRIVATE_FAX_NONSTANDARD))) | 6845 | & ((1L << PRIVATE_FAX_SUB_SEP_PWD) | (1L << PRIVATE_FAX_NONSTANDARD))) |
6846 | { | 6846 | { |
6847 | i = offsetof(T30_INFO, station_id) + 20 + ((T30_INFO *)plci->NL.RBuffer->P)->head_line_len; | 6847 | i = offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH + ((T30_INFO *)plci->NL.RBuffer->P)->head_line_len; |
6848 | while (i < plci->NL.RBuffer->length) | 6848 | while (i < plci->NL.RBuffer->length) |
6849 | plci->ncpi_buffer[++len] = plci->NL.RBuffer->P[i++]; | 6849 | plci->ncpi_buffer[++len] = plci->NL.RBuffer->P[i++]; |
6850 | } | 6850 | } |
@@ -8400,7 +8400,7 @@ static word add_b23(PLCI *plci, API_PARSE *bp) | |||
8400 | } | 8400 | } |
8401 | } | 8401 | } |
8402 | /* copy station id to NLC */ | 8402 | /* copy station id to NLC */ |
8403 | for(i=0; i<20; i++) | 8403 | for(i=0; i < T30_MAX_STATION_ID_LENGTH; i++) |
8404 | { | 8404 | { |
8405 | if(i<b3_config_parms[2].length) | 8405 | if(i<b3_config_parms[2].length) |
8406 | { | 8406 | { |
@@ -8411,29 +8411,29 @@ static word add_b23(PLCI *plci, API_PARSE *bp) | |||
8411 | ((T30_INFO *)&nlc[1])->station_id[i] = ' '; | 8411 | ((T30_INFO *)&nlc[1])->station_id[i] = ' '; |
8412 | } | 8412 | } |
8413 | } | 8413 | } |
8414 | ((T30_INFO *)&nlc[1])->station_id_len = 20; | 8414 | ((T30_INFO *)&nlc[1])->station_id_len = T30_MAX_STATION_ID_LENGTH; |
8415 | /* copy head line to NLC */ | 8415 | /* copy head line to NLC */ |
8416 | if(b3_config_parms[3].length) | 8416 | if(b3_config_parms[3].length) |
8417 | { | 8417 | { |
8418 | 8418 | ||
8419 | pos = (byte)(fax_head_line_time (&(((T30_INFO *)&nlc[1])->station_id[20]))); | 8419 | pos = (byte)(fax_head_line_time (&(((T30_INFO *)&nlc[1])->station_id[T30_MAX_STATION_ID_LENGTH]))); |
8420 | if (pos != 0) | 8420 | if (pos != 0) |
8421 | { | 8421 | { |
8422 | if (CAPI_MAX_DATE_TIME_LENGTH + 2 + b3_config_parms[3].length > CAPI_MAX_HEAD_LINE_SPACE) | 8422 | if (CAPI_MAX_DATE_TIME_LENGTH + 2 + b3_config_parms[3].length > CAPI_MAX_HEAD_LINE_SPACE) |
8423 | pos = 0; | 8423 | pos = 0; |
8424 | else | 8424 | else |
8425 | { | 8425 | { |
8426 | nlc[1 + offsetof(T30_INFO, station_id) + 20 + pos++] = ' '; | 8426 | nlc[1 + offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH + pos++] = ' '; |
8427 | nlc[1 + offsetof(T30_INFO, station_id) + 20 + pos++] = ' '; | 8427 | nlc[1 + offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH + pos++] = ' '; |
8428 | len = (byte)b3_config_parms[2].length; | 8428 | len = (byte)b3_config_parms[2].length; |
8429 | if (len > 20) | 8429 | if (len > 20) |
8430 | len = 20; | 8430 | len = 20; |
8431 | if (CAPI_MAX_DATE_TIME_LENGTH + 2 + len + 2 + b3_config_parms[3].length <= CAPI_MAX_HEAD_LINE_SPACE) | 8431 | if (CAPI_MAX_DATE_TIME_LENGTH + 2 + len + 2 + b3_config_parms[3].length <= CAPI_MAX_HEAD_LINE_SPACE) |
8432 | { | 8432 | { |
8433 | for (i = 0; i < len; i++) | 8433 | for (i = 0; i < len; i++) |
8434 | nlc[1 + offsetof(T30_INFO, station_id) + 20 + pos++] = ((byte *)b3_config_parms[2].info)[1+i]; | 8434 | nlc[1 + offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH + pos++] = ((byte *)b3_config_parms[2].info)[1+i]; |
8435 | nlc[1 + offsetof(T30_INFO, station_id) + 20 + pos++] = ' '; | 8435 | nlc[1 + offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH + pos++] = ' '; |
8436 | nlc[1 + offsetof(T30_INFO, station_id) + 20 + pos++] = ' '; | 8436 | nlc[1 + offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH + pos++] = ' '; |
8437 | } | 8437 | } |
8438 | } | 8438 | } |
8439 | } | 8439 | } |
@@ -8444,7 +8444,7 @@ static word add_b23(PLCI *plci, API_PARSE *bp) | |||
8444 | ((T30_INFO *)&nlc[1])->head_line_len = (byte)(pos + len); | 8444 | ((T30_INFO *)&nlc[1])->head_line_len = (byte)(pos + len); |
8445 | nlc[0] += (byte)(pos + len); | 8445 | nlc[0] += (byte)(pos + len); |
8446 | for (i = 0; i < len; i++) | 8446 | for (i = 0; i < len; i++) |
8447 | nlc[1 + offsetof(T30_INFO, station_id) + 20 + pos++] = ((byte *)b3_config_parms[3].info)[1+i]; | 8447 | nlc[1 + offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH + pos++] = ((byte *)b3_config_parms[3].info)[1+i]; |
8448 | } else | 8448 | } else |
8449 | ((T30_INFO *)&nlc[1])->head_line_len = 0; | 8449 | ((T30_INFO *)&nlc[1])->head_line_len = 0; |
8450 | 8450 | ||
@@ -8472,7 +8472,7 @@ static word add_b23(PLCI *plci, API_PARSE *bp) | |||
8472 | fax_control_bits |= T30_CONTROL_BIT_ACCEPT_SEL_POLLING; | 8472 | fax_control_bits |= T30_CONTROL_BIT_ACCEPT_SEL_POLLING; |
8473 | } | 8473 | } |
8474 | len = nlc[0]; | 8474 | len = nlc[0]; |
8475 | pos = offsetof(T30_INFO, station_id) + 20; | 8475 | pos = offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH; |
8476 | if (pos < plci->fax_connect_info_length) | 8476 | if (pos < plci->fax_connect_info_length) |
8477 | { | 8477 | { |
8478 | for (i = 1 + plci->fax_connect_info_buffer[pos]; i != 0; i--) | 8478 | for (i = 1 + plci->fax_connect_info_buffer[pos]; i != 0; i--) |
@@ -8524,7 +8524,7 @@ static word add_b23(PLCI *plci, API_PARSE *bp) | |||
8524 | } | 8524 | } |
8525 | 8525 | ||
8526 | PUT_WORD(&(((T30_INFO *)&nlc[1])->control_bits_low), fax_control_bits); | 8526 | PUT_WORD(&(((T30_INFO *)&nlc[1])->control_bits_low), fax_control_bits); |
8527 | len = offsetof(T30_INFO, station_id) + 20; | 8527 | len = offsetof(T30_INFO, station_id) + T30_MAX_STATION_ID_LENGTH; |
8528 | for (i = 0; i < len; i++) | 8528 | for (i = 0; i < len; i++) |
8529 | plci->fax_connect_info_buffer[i] = nlc[1+i]; | 8529 | plci->fax_connect_info_buffer[i] = nlc[1+i]; |
8530 | ((T30_INFO *) plci->fax_connect_info_buffer)->head_line_len = 0; | 8530 | ((T30_INFO *) plci->fax_connect_info_buffer)->head_line_len = 0; |