patch-2.4.0-test9 linux/drivers/isdn/eicon/common.c
Next file: linux/drivers/isdn/eicon/eicon_mod.c
Previous file: linux/drivers/isdn/eicon/Divas_mod.c
Back to the patch index
Back to the overall index
- Lines: 128
- Date:
Wed Sep 27 13:45:40 2000
- Orig file:
v2.4.0-test8/linux/drivers/isdn/eicon/common.c
- Orig date:
Sun Aug 13 10:05:32 2000
diff -u --recursive --new-file v2.4.0-test8/linux/drivers/isdn/eicon/common.c linux/drivers/isdn/eicon/common.c
@@ -81,29 +81,33 @@
dia_config_t *DivasConfig(card_t *, dia_config_t *);
static
-DESCRIPTOR DIDD_Table[16];
-static
-int DIDD_Length = 0;
+DESCRIPTOR DIDD_Table[32];
-void EtdM_DIDD_Read( DESCRIPTOR *table, int *tablelength )
+void DIVA_DIDD_Read( DESCRIPTOR *table, int tablelength )
{
- int table_size = sizeof(DIDD_Table);
+ bzero(table, tablelength);
+
+ if (tablelength > sizeof(DIDD_Table))
+ tablelength = sizeof(DIDD_Table);
- bcopy((caddr_t)DIDD_Table, (caddr_t)table, table_size);
+ if(tablelength % sizeof(DESCRIPTOR)) {
+ tablelength /= sizeof(DESCRIPTOR);
+ tablelength *= sizeof(DESCRIPTOR);
+ }
- *tablelength = DIDD_Length;
+ if (tablelength > 0)
+ bcopy((caddr_t)DIDD_Table, (caddr_t)table, tablelength);
return;
}
static
-void EtdM_DIDD_Write(DESCRIPTOR *table, int tablelength)
+void DIVA_DIDD_Write(DESCRIPTOR *table, int tablelength)
{
- int table_size = sizeof(DIDD_Table);
-
- bcopy((caddr_t)table, (caddr_t)DIDD_Table, table_size);
+ if (tablelength > sizeof(DIDD_Table))
+ tablelength = sizeof(DIDD_Table);
- DIDD_Length = tablelength;
+ bcopy((caddr_t)table, (caddr_t)DIDD_Table, tablelength);
return;
}
@@ -111,19 +115,16 @@
static
void init_idi_tab(void)
{
- int length = 0;
+ DESCRIPTOR d[32];
- DESCRIPTOR d[16];
+ bzero(d, sizeof(d));
- EtdM_DIDD_Read(d, &length);
-
- d[length].type = IDI_DIMAINT; /* identify the DIMAINT entry */
- d[length].channels = 0; /* zero channels associated with dimaint*/
- d[length].features = 0; /* no features associated with dimaint */
- d[length].request = (IDI_CALL) DivasPrintf;
- length++;
+ d[0].type = IDI_DIMAINT; /* identify the DIMAINT entry */
+ d[0].channels = 0; /* zero channels associated with dimaint*/
+ d[0].features = 0; /* no features associated with dimaint */
+ d[0].request = (IDI_CALL) DivasPrintf;
- EtdM_DIDD_Write(d, length);
+ DIVA_DIDD_Write(d, sizeof(d));
return;
}
@@ -663,7 +664,7 @@
static int idi_register(card_t *card, byte channels)
{
- DESCRIPTOR d[16];
+ DESCRIPTOR d[32];
int length, num_entities;
DPRINTF(("divas: registering card with IDI"));
@@ -680,9 +681,12 @@
bzero(card->e_tbl, sizeof(E_INFO) * num_entities);
card->e_max = num_entities;
- EtdM_DIDD_Read(d, &length);
+ DIVA_DIDD_Read(d, sizeof(d));
+
+ for(length=0; length < DIM(d); length++)
+ if (d[length].type == 0) break;
- if (length == DIM(d))
+ if (length >= DIM(d))
{
KDPRINTF((KERN_WARNING "Divas: IDI register failed - table full"));
return -1;
@@ -692,18 +696,18 @@
{
case DIA_CARD_TYPE_DIVA_SERVER:
d[length].type = IDI_ADAPTER_PR;
- d[length].serial = card->serial_no;
+ /* d[length].serial = card->serial_no; */
break;
case DIA_CARD_TYPE_DIVA_SERVER_B:
d[length].type = IDI_ADAPTER_MAESTRA;
- d[length].serial = card->serial_no;
+ /* d[length].serial = card->serial_no; */
break;
// 4BRI is treated as 4 BRI adapters
case DIA_CARD_TYPE_DIVA_SERVER_Q:
d[length].type = IDI_ADAPTER_MAESTRA;
- d[length].serial = card->cfg.serial;
+ /* d[length].serial = card->cfg.serial; */
}
d[length].features = 0;
@@ -727,7 +731,7 @@
length++;
- EtdM_DIDD_Write(d, length);
+ DIVA_DIDD_Write(d, sizeof(d));
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)