aboutsummaryrefslogtreecommitdiff
path: root/drivers/isdn/hardware/eicon/capifunc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/hardware/eicon/capifunc.c')
-rw-r--r--drivers/isdn/hardware/eicon/capifunc.c222
1 files changed, 111 insertions, 111 deletions
diff --git a/drivers/isdn/hardware/eicon/capifunc.c b/drivers/isdn/hardware/eicon/capifunc.c
index 4d425c644d4..a576f32e663 100644
--- a/drivers/isdn/hardware/eicon/capifunc.c
+++ b/drivers/isdn/hardware/eicon/capifunc.c
@@ -2,10 +2,10 @@
*
* ISDN interface module for Eicon active cards DIVA.
* CAPI Interface common functions
- *
- * Copyright 2000-2003 by Armin Schindler (mac@melware.de)
+ *
+ * Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
- *
+ *
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@@ -43,7 +43,7 @@ static diva_os_spin_lock_t api_lock;
static LIST_HEAD(cards);
static dword notify_handle;
-static void DIRequest(ENTITY * e);
+static void DIRequest(ENTITY *e);
static DESCRIPTOR MAdapter;
static DESCRIPTOR DAdapter;
static byte ControllerMap[MAX_DESCRIPTORS + 1];
@@ -160,7 +160,7 @@ static int find_free_id(void)
break;
num++;
}
- return(num + 1);
+ return (num + 1);
}
/*
@@ -176,23 +176,23 @@ static diva_card *find_card_by_ctrl(word controller)
if (ControllerMap[card->Id] == controller) {
if (card->remove_in_progress)
card = NULL;
- return(card);
+ return (card);
}
}
return (diva_card *) 0;
}
/*
- * Buffer RX/TX
+ * Buffer RX/TX
*/
-void *TransmitBufferSet(APPL * appl, dword ref)
+void *TransmitBufferSet(APPL *appl, dword ref)
{
appl->xbuffer_used[ref] = true;
DBG_PRV1(("%d:xbuf_used(%d)", appl->Id, ref + 1))
- return (void *)(long)ref;
+ return (void *)(long)ref;
}
-void *TransmitBufferGet(APPL * appl, void *p)
+void *TransmitBufferGet(APPL *appl, void *p)
{
if (appl->xbuffer_internal[(dword)(long)p])
return appl->xbuffer_internal[(dword)(long)p];
@@ -200,13 +200,13 @@ void *TransmitBufferGet(APPL * appl, void *p)
return appl->xbuffer_ptr[(dword)(long)p];
}
-void TransmitBufferFree(APPL * appl, void *p)
+void TransmitBufferFree(APPL *appl, void *p)
{
appl->xbuffer_used[(dword)(long)p] = false;
DBG_PRV1(("%d:xbuf_free(%d)", appl->Id, ((dword)(long)p) + 1))
-}
+ }
-void *ReceiveBufferGet(APPL * appl, int Num)
+void *ReceiveBufferGet(APPL *appl, int Num)
{
return &appl->ReceiveBuffer[Num * appl->MaxDataLength];
}
@@ -217,12 +217,12 @@ void *ReceiveBufferGet(APPL * appl, int Num)
void api_remove_complete(void)
{
DBG_PRV1(("api_remove_complete"))
-}
+ }
/*
* main function called by message.c
*/
-void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...)
+void sendf(APPL *appl, word command, dword Id, word Number, byte *format, ...)
{
word i, j;
word length = 12, dlength = 0;
@@ -240,14 +240,14 @@ void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...)
DBG_PRV1(("sendf(a=%d,cmd=%x,format=%s)",
appl->Id, command, (byte *) format))
- PUT_WORD(&msg.header.appl_id, appl->Id);
+ PUT_WORD(&msg.header.appl_id, appl->Id);
PUT_WORD(&msg.header.command, command);
if ((byte) (command >> 8) == 0x82)
Number = appl->Number++;
PUT_WORD(&msg.header.number, Number);
PUT_DWORD(&msg.header.controller, Id);
- write = (byte *) & msg;
+ write = (byte *)&msg;
write += 12;
va_start(ap, format);
@@ -287,16 +287,16 @@ void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...)
if (command == _DATA_B3_I)
dlength = GET_WORD(
- ((byte *) & msg.info.data_b3_ind.Data_Length));
+ ((byte *)&msg.info.data_b3_ind.Data_Length));
if (!(dmb = diva_os_alloc_message_buffer(length + dlength,
- (void **) &write))) {
+ (void **) &write))) {
DBG_ERR(("sendf: alloc_message_buffer failed, incoming msg dropped."))
- return;
+ return;
}
/* copy msg header to sk_buff */
- memcpy(write, (byte *) & msg, length);
+ memcpy(write, (byte *)&msg, length);
/* if DATA_B3_IND, copy data too */
if (command == _DATA_B3_I) {
@@ -318,10 +318,10 @@ void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...)
if (myDriverDebugHandle.dbgMask & DL_BLK) {
xlog("\x00\x02", &msg, 0x81, length);
for (i = 0; i < dlength; i += 256) {
- DBG_BLK((((char *)(long)GET_DWORD(&msg.info.data_b3_ind.Data)) + i,
- ((dlength - i) < 256) ? (dlength - i) : 256))
- if (!(myDriverDebugHandle.dbgMask & DL_PRV0))
- break; /* not more if not explicitly requested */
+ DBG_BLK((((char *)(long)GET_DWORD(&msg.info.data_b3_ind.Data)) + i,
+ ((dlength - i) < 256) ? (dlength - i) : 256))
+ if (!(myDriverDebugHandle.dbgMask & DL_PRV0))
+ break; /* not more if not explicitly requested */
}
}
break;
@@ -333,7 +333,7 @@ void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...)
if (!(card = find_card_by_ctrl(write[8] & 0x7f))) {
DBG_ERR(("sendf - controller %d not found, incoming msg dropped",
write[8] & 0x7f))
- diva_os_free_message_buffer(dmb);
+ diva_os_free_message_buffer(dmb);
return;
}
/* send capi msg to capi layer */
@@ -388,7 +388,7 @@ static void clean_adapter(int id, struct list_head *free_mem_q)
* remove a card, but ensures consistent state of LI tables
* in the time adapter is removed
*/
-static void divacapi_remove_card(DESCRIPTOR * d)
+static void divacapi_remove_card(DESCRIPTOR *d)
{
diva_card *card = NULL;
diva_os_spin_lock_magic_t old_irql;
@@ -427,14 +427,14 @@ static void divacapi_remove_card(DESCRIPTOR * d)
clean_adapter(card->Id - 1, &free_mem_q);
DBG_TRC(("DelAdapterMap (%d) -> (%d)",
- ControllerMap[card->Id], card->Id))
- ControllerMap[card->Id] = 0;
+ ControllerMap[card->Id], card->Id))
+ ControllerMap[card->Id] = 0;
DBG_TRC(("adapter remove, max_adapter=%d",
- max_adapter));
+ max_adapter));
diva_os_leave_spin_lock(&api_lock, &old_irql, "remove card");
-
+
/* After releasing the lock, we can free the memory */
- diva_os_free (0, card);
+ diva_os_free(0, card);
}
/* free queued memory areas */
@@ -469,13 +469,13 @@ rescan:
/*
* sync_callback
*/
-static void sync_callback(ENTITY * e)
+static void sync_callback(ENTITY *e)
{
diva_os_spin_lock_magic_t old_irql;
DBG_TRC(("cb:Id=%x,Rc=%x,Ind=%x", e->Id, e->Rc, e->Ind))
- diva_os_enter_spin_lock(&api_lock, &old_irql, "sync_callback");
+ diva_os_enter_spin_lock(&api_lock, &old_irql, "sync_callback");
callback(e);
diva_os_leave_spin_lock(&api_lock, &old_irql, "sync_callback");
}
@@ -483,7 +483,7 @@ static void sync_callback(ENTITY * e)
/*
* add a new card
*/
-static int diva_add_card(DESCRIPTOR * d)
+static int diva_add_card(DESCRIPTOR *d)
{
int k = 0, i = 0;
diva_os_spin_lock_magic_t old_irql;
@@ -492,19 +492,19 @@ static int diva_add_card(DESCRIPTOR * d)
DIVA_CAPI_ADAPTER *a = NULL;
IDI_SYNC_REQ sync_req;
char serial[16];
- void* mem_to_free;
+ void *mem_to_free;
LI_CONFIG *new_li_config_table;
int j;
if (!(card = (diva_card *) diva_os_malloc(0, sizeof(diva_card)))) {
DBG_ERR(("diva_add_card: failed to allocate card struct."))
- return (0);
+ return (0);
}
memset((char *) card, 0x00, sizeof(diva_card));
memcpy(&card->d, d, sizeof(DESCRIPTOR));
sync_req.GetName.Req = 0;
sync_req.GetName.Rc = IDI_SYNC_REQ_GET_NAME;
- card->d.request((ENTITY *) & sync_req);
+ card->d.request((ENTITY *)&sync_req);
strlcpy(card->name, sync_req.GetName.name, sizeof(card->name));
ctrl = &card->capi_ctrl;
strcpy(ctrl->name, card->name);
@@ -517,14 +517,14 @@ static int diva_add_card(DESCRIPTOR * d)
if (attach_capi_ctr(ctrl)) {
DBG_ERR(("diva_add_card: failed to attach controller."))
- diva_os_free(0, card);
+ diva_os_free(0, card);
return (0);
}
-
+
diva_os_enter_spin_lock(&api_lock, &old_irql, "find id");
card->Id = find_free_id();
diva_os_leave_spin_lock(&api_lock, &old_irql, "find id");
-
+
strlcpy(ctrl->manu, M_COMPANY, sizeof(ctrl->manu));
ctrl->version.majorversion = 2;
ctrl->version.minorversion = 0;
@@ -533,7 +533,7 @@ static int diva_add_card(DESCRIPTOR * d)
sync_req.GetSerial.Req = 0;
sync_req.GetSerial.Rc = IDI_SYNC_REQ_GET_SERIAL;
sync_req.GetSerial.serial = 0;
- card->d.request((ENTITY *) & sync_req);
+ card->d.request((ENTITY *)&sync_req);
if ((i = ((sync_req.GetSerial.serial & 0xff000000) >> 24))) {
sprintf(serial, "%ld-%d",
sync_req.GetSerial.serial & 0x00ffffff, i + 1);
@@ -550,15 +550,15 @@ static int diva_add_card(DESCRIPTOR * d)
DBG_TRC(("AddAdapterMap (%d) -> (%d)", ctrl->cnr, card->Id))
- sync_req.xdi_capi_prms.Req = 0;
+ sync_req.xdi_capi_prms.Req = 0;
sync_req.xdi_capi_prms.Rc = IDI_SYNC_REQ_XDI_GET_CAPI_PARAMS;
sync_req.xdi_capi_prms.info.structure_length =
- sizeof(diva_xdi_get_capi_parameters_t);
- card->d.request((ENTITY *) & sync_req);
+ sizeof(diva_xdi_get_capi_parameters_t);
+ card->d.request((ENTITY *)&sync_req);
a->flag_dynamic_l1_down =
- sync_req.xdi_capi_prms.info.flag_dynamic_l1_down;
+ sync_req.xdi_capi_prms.info.flag_dynamic_l1_down;
a->group_optimization_enabled =
- sync_req.xdi_capi_prms.info.group_optimization_enabled;
+ sync_req.xdi_capi_prms.info.group_optimization_enabled;
a->request = DIRequest; /* card->d.request; */
a->max_plci = card->d.channels + 30;
a->max_listen = (card->d.channels > 2) ? 8 : 2;
@@ -566,7 +566,7 @@ static int diva_add_card(DESCRIPTOR * d)
(a->plci =
(PLCI *) diva_os_malloc(0, sizeof(PLCI) * a->max_plci))) {
DBG_ERR(("diva_add_card: failed alloc plci struct."))
- memset(a, 0, sizeof(DIVA_CAPI_ADAPTER));
+ memset(a, 0, sizeof(DIVA_CAPI_ADAPTER));
return (0);
}
memset(a->plci, 0, sizeof(PLCI) * a->max_plci);
@@ -625,13 +625,13 @@ static int diva_add_card(DESCRIPTOR * d)
(LI_CONFIG *) diva_os_malloc(0, ((k * sizeof(LI_CONFIG) + 3) & ~3) + (2 * k) * ((k + 3) & ~3));
if (new_li_config_table == NULL) {
DBG_ERR(("diva_add_card: failed alloc li_config table."))
- memset(a, 0, sizeof(DIVA_CAPI_ADAPTER));
+ memset(a, 0, sizeof(DIVA_CAPI_ADAPTER));
return (0);
}
/* Prevent access to line interconnect table in process update */
diva_os_enter_spin_lock(&api_lock, &old_irql, "add card");
-
+
j = 0;
for (i = 0; i < k; i++) {
if ((i >= a->li_base) && (i < a->li_base + a->li_channels))
@@ -659,11 +659,11 @@ static int diva_add_card(DESCRIPTOR * d)
memset(&new_li_config_table[i].coef_table[a->li_base], 0, a->li_channels);
if (a->li_base + a->li_channels < k) {
memcpy(&new_li_config_table[i].flag_table[a->li_base +
- a->li_channels],
+ a->li_channels],
&li_config_table[j].flag_table[a->li_base],
k - (a->li_base + a->li_channels));
memcpy(&new_li_config_table[i].coef_table[a->li_base +
- a->li_channels],
+ a->li_channels],
&li_config_table[j].coef_table[a->li_base],
k - (a->li_base + a->li_channels));
}
@@ -689,7 +689,7 @@ static int diva_add_card(DESCRIPTOR * d)
diva_os_leave_spin_lock(&api_lock, &old_irql, "add card");
if (mem_to_free) {
- diva_os_free (0, mem_to_free);
+ diva_os_free(0, mem_to_free);
}
i = 0;
@@ -722,7 +722,7 @@ static int diva_add_card(DESCRIPTOR * d)
* register appl
*/
static void diva_register_appl(struct capi_ctr *ctrl, __u16 appl,
- capi_register_params * rp)
+ capi_register_params *rp)
{
APPL *this;
word bnum, xnum;
@@ -737,38 +737,38 @@ static void diva_register_appl(struct capi_ctr *ctrl, __u16 appl,
if (diva_os_in_irq()) {
DBG_ERR(("CAPI_REGISTER - in irq context !"))
- return;
+ return;
}
DBG_TRC(("application register Id=%d", appl))
- if (appl > MAX_APPL) {
- DBG_ERR(("CAPI_REGISTER - appl.Id exceeds MAX_APPL"))
- return;
- }
+ if (appl > MAX_APPL) {
+ DBG_ERR(("CAPI_REGISTER - appl.Id exceeds MAX_APPL"))
+ return;
+ }
if (nconn <= 0)
nconn = ctrl->profile.nbchannel * -nconn;
- if (nconn == 0)
+ if (nconn == 0)
nconn = ctrl->profile.nbchannel;
DBG_LOG(("CAPI_REGISTER - Id = %d", appl))
- DBG_LOG((" MaxLogicalConnections = %d(%d)", nconn, rp->level3cnt))
- DBG_LOG((" MaxBDataBuffers = %d", rp->datablkcnt))
- DBG_LOG((" MaxBDataLength = %d", rp->datablklen))
-
- if (nconn < 1 ||
- nconn > 255 ||
- rp->datablklen < 80 ||
- rp->datablklen > 2150 || rp->datablkcnt > 255) {
- DBG_ERR(("CAPI_REGISTER - invalid parameters"))
- return;
- }
+ DBG_LOG((" MaxLogicalConnections = %d(%d)", nconn, rp->level3cnt))
+ DBG_LOG((" MaxBDataBuffers = %d", rp->datablkcnt))
+ DBG_LOG((" MaxBDataLength = %d", rp->datablklen))
+
+ if (nconn < 1 ||
+ nconn > 255 ||
+ rp->datablklen < 80 ||
+ rp->datablklen > 2150 || rp->datablkcnt > 255) {
+ DBG_ERR(("CAPI_REGISTER - invalid parameters"))
+ return;
+ }
if (application[appl - 1].Id == appl) {
DBG_LOG(("CAPI_REGISTER - appl already registered"))
- return; /* appl already registered */
+ return; /* appl already registered */
}
/* alloc memory */
@@ -785,10 +785,10 @@ static void diva_register_appl(struct capi_ctr *ctrl, __u16 appl,
mem_len += xnum * rp->datablklen; /* xbuffer_ptr[xnum] */
DBG_LOG((" Allocated Memory = %d", mem_len))
- if (!(p = diva_os_malloc(0, mem_len))) {
- DBG_ERR(("CAPI_REGISTER - memory allocation failed"))
- return;
- }
+ if (!(p = diva_os_malloc(0, mem_len))) {
+ DBG_ERR(("CAPI_REGISTER - memory allocation failed"))
+ return;
+ }
memset(p, 0, mem_len);
DataNCCI = (void *)p;
@@ -853,10 +853,10 @@ static void diva_release_appl(struct capi_ctr *ctrl, __u16 appl)
DBG_TRC(("application %d(%d) cleanup", this->Id, appl))
- if (diva_os_in_irq()) {
- DBG_ERR(("CAPI_RELEASE - in irq context !"))
- return;
- }
+ if (diva_os_in_irq()) {
+ DBG_ERR(("CAPI_RELEASE - in irq context !"))
+ return;
+ }
diva_os_enter_spin_lock(&api_lock, &old_irql, "release_appl");
if (this->Id) {
@@ -876,7 +876,7 @@ static void diva_release_appl(struct capi_ctr *ctrl, __u16 appl)
* send message
*/
static u16 diva_send_message(struct capi_ctr *ctrl,
- diva_os_message_buffer_s * dmb)
+ diva_os_message_buffer_s *dmb)
{
int i = 0;
word ret = 0;
@@ -891,14 +891,14 @@ static u16 diva_send_message(struct capi_ctr *ctrl,
if (diva_os_in_irq()) {
DBG_ERR(("CAPI_SEND_MSG - in irq context !"))
- return CAPI_REGOSRESOURCEERR;
+ return CAPI_REGOSRESOURCEERR;
}
DBG_PRV1(("Write - appl = %d, cmd = 0x%x", this->Id, command))
- if (card->remove_in_progress) {
- DBG_ERR(("CAPI_SEND_MSG - remove in progress!"))
- return CAPI_REGOSRESOURCEERR;
- }
+ if (card->remove_in_progress) {
+ DBG_ERR(("CAPI_SEND_MSG - remove in progress!"))
+ return CAPI_REGOSRESOURCEERR;
+ }
diva_os_enter_spin_lock(&api_lock, &old_irql, "send message");
@@ -909,7 +909,7 @@ static u16 diva_send_message(struct capi_ctr *ctrl,
/* patch controller number */
msg->header.controller = ControllerMap[card->Id]
- | (msg->header.controller & 0x80); /* preserve external controller bit */
+ | (msg->header.controller & 0x80); /* preserve external controller bit */
switch (command) {
default:
@@ -937,15 +937,15 @@ static u16 diva_send_message(struct capi_ctr *ctrl,
|| GET_WORD(&msg->info.data_b3_req.Data_Length) >
(length - clength)) {
DBG_ERR(("Write - invalid message size"))
- retval = CAPI_ILLCMDORSUBCMDORMSGTOSMALL;
+ retval = CAPI_ILLCMDORSUBCMDORMSGTOSMALL;
goto write_end;
}
for (i = 0; i < (MAX_DATA_B3 * this->MaxNCCI)
- && this->xbuffer_used[i]; i++);
+ && this->xbuffer_used[i]; i++);
if (i == (MAX_DATA_B3 * this->MaxNCCI)) {
DBG_ERR(("Write - too many data pending"))
- retval = CAPI_SENDQUEUEFULL;
+ retval = CAPI_SENDQUEUEFULL;
goto write_end;
}
msg->info.data_b3_req.Data = i;
@@ -959,13 +959,13 @@ static u16 diva_send_message(struct capi_ctr *ctrl,
&& (myDriverDebugHandle.dbgMask & DL_XLOG)) {
int j;
for (j = 0; j <
- GET_WORD(&msg->info.data_b3_req.Data_Length);
+ GET_WORD(&msg->info.data_b3_req.Data_Length);
j += 256) {
DBG_BLK((((char *) this->xbuffer_ptr[i]) + j,
- ((GET_WORD(&msg->info.data_b3_req.Data_Length) - j) <
+ ((GET_WORD(&msg->info.data_b3_req.Data_Length) - j) <
256) ? (GET_WORD(&msg->info.data_b3_req.Data_Length) - j) : 256))
- if (!(myDriverDebugHandle.dbgMask & DL_PRV0))
- break; /* not more if not explicitly requested */
+ if (!(myDriverDebugHandle.dbgMask & DL_PRV0))
+ break; /* not more if not explicitly requested */
}
}
#endif
@@ -984,19 +984,19 @@ static u16 diva_send_message(struct capi_ctr *ctrl,
break;
case _BAD_MSG:
DBG_ERR(("Write - bad message"))
- retval = CAPI_ILLCMDORSUBCMDORMSGTOSMALL;
+ retval = CAPI_ILLCMDORSUBCMDORMSGTOSMALL;
break;
case _QUEUE_FULL:
DBG_ERR(("Write - queue full"))
- retval = CAPI_SENDQUEUEFULL;
+ retval = CAPI_SENDQUEUEFULL;
break;
default:
DBG_ERR(("Write - api_put returned unknown error"))
- retval = CAPI_UNKNOWNNOTPAR;
+ retval = CAPI_UNKNOWNNOTPAR;
break;
}
- write_end:
+write_end:
diva_os_leave_spin_lock(&api_lock, &old_irql, "send message");
if (retval == CAPI_NOERROR)
diva_os_free_message_buffer(dmb);
@@ -1007,7 +1007,7 @@ static u16 diva_send_message(struct capi_ctr *ctrl,
/*
* cards request function
*/
-static void DIRequest(ENTITY * e)
+static void DIRequest(ENTITY *e)
{
DIVA_CAPI_ADAPTER *a = &(adapter[(byte) e->user[0]]);
diva_card *os_card = (diva_card *) a->os_card;
@@ -1022,7 +1022,7 @@ static void DIRequest(ENTITY * e)
/*
* callback function from didd
*/
-static void didd_callback(void *context, DESCRIPTOR * adapter, int removal)
+static void didd_callback(void *context, DESCRIPTOR *adapter, int removal)
{
if (adapter->type == IDI_DADAPTER) {
DBG_ERR(("Notification about IDI_DADAPTER change ! Oops."));
@@ -1071,17 +1071,17 @@ static int divacapi_connect_didd(void)
memcpy(&DAdapter, &DIDD_Table[x], sizeof(DAdapter));
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc =
- IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
+ IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = (void *)didd_callback;
req.didd_notify.info.context = NULL;
- DAdapter.request((ENTITY *) & req);
+ DAdapter.request((ENTITY *)&req);
if (req.didd_notify.e.Rc != 0xff) {
stop_dbg();
return (0);
}
notify_handle = req.didd_notify.info.handle;
}
- else if ((DIDD_Table[x].type > 0) && (DIDD_Table[x].type < 16)) { /* IDI Adapter found */
+ else if ((DIDD_Table[x].type > 0) && (DIDD_Table[x].type < 16)) { /* IDI Adapter found */
diva_add_card(&DIDD_Table[x]);
}
}
@@ -1105,12 +1105,12 @@ static void divacapi_disconnect_didd(void)
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc = IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER_NOTIFY;
req.didd_notify.info.handle = notify_handle;
- DAdapter.request((ENTITY *) & req);
+ DAdapter.request((ENTITY *)&req);
}
/*
* we do not provide date/time here,
- * the application should do this.
+ * the application should do this.
*/
int fax_head_line_time(char *buffer)
{
@@ -1124,19 +1124,19 @@ static int DIVA_INIT_FUNCTION init_main_structs(void)
{
if (!(mapped_msg = (CAPI_MSG *) diva_os_malloc(0, MAX_MSG_SIZE))) {
DBG_ERR(("init: failed alloc mapped_msg."))
- return 0;
+ return 0;
}
if (!(adapter = diva_os_malloc(0, sizeof(DIVA_CAPI_ADAPTER) * MAX_DESCRIPTORS))) {
DBG_ERR(("init: failed alloc adapter struct."))
- diva_os_free(0, mapped_msg);
+ diva_os_free(0, mapped_msg);
return 0;
}
memset(adapter, 0, sizeof(DIVA_CAPI_ADAPTER) * MAX_DESCRIPTORS);
if (!(application = diva_os_malloc(0, sizeof(APPL) * MAX_APPL))) {
DBG_ERR(("init: failed alloc application struct."))
- diva_os_free(0, mapped_msg);
+ diva_os_free(0, mapped_msg);
diva_os_free(0, adapter);
return 0;
}
@@ -1176,7 +1176,7 @@ static void do_api_remove_start(void)
if (ret)
DBG_ERR(("could not remove signaling ID's"))
-}
+ }
/*
* init
@@ -1190,13 +1190,13 @@ int DIVA_INIT_FUNCTION init_capifunc(void)
if (!init_main_structs()) {
DBG_ERR(("init: failed to init main structs."))
- diva_os_destroy_spin_lock(&api_lock, "capifunc");
+ diva_os_destroy_spin_lock(&api_lock, "capifunc");
return (0);
}
if (!divacapi_connect_didd()) {
DBG_ERR(("init: failed to connect to DIDD."))
- do_api_remove_start();
+ do_api_remove_start();
divacapi_remove_cards();
remove_main_structs();
diva_os_destroy_spin_lock(&api_lock, "capifunc");