aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hysdn/hycapi.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-02-19 22:52:38 -0500
committerJoe Perches <joe@perches.com>2012-02-21 12:04:01 -0500
commit475be4d85a274d0961593db41cf85689db1d583c (patch)
treeb2b8931eb747794730522c3cf1898e46948527b9 /drivers/isdn/hysdn/hycapi.c
parent0b0a635f79f91f3755b6518627ea06dd0dbfd523 (diff)
isdn: whitespace coding style cleanup
isdn source code uses a not-current coding style. Update the coding style used on a per-line basis so that git diff -w shows only elided blank lines at EOF. Done with emacs and some scripts and some typing. Built x86 allyesconfig. No detected change in objdump -d or size. Signed-off-by: Joe Perches <joe@perches.com>
Diffstat (limited to 'drivers/isdn/hysdn/hycapi.c')
-rw-r--r--drivers/isdn/hysdn/hycapi.c374
1 files changed, 187 insertions, 187 deletions
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c
index 6299b06ae009..931f916c9c23 100644
--- a/drivers/isdn/hysdn/hycapi.c
+++ b/drivers/isdn/hysdn/hycapi.c
@@ -31,9 +31,9 @@
31#include "hysdn_defs.h" 31#include "hysdn_defs.h"
32#include <linux/kernelcapi.h> 32#include <linux/kernelcapi.h>
33 33
34static char hycapi_revision[]="$Revision: 1.8.6.4 $"; 34static char hycapi_revision[] = "$Revision: 1.8.6.4 $";
35 35
36unsigned int hycapi_enable = 0xffffffff; 36unsigned int hycapi_enable = 0xffffffff;
37module_param(hycapi_enable, uint, 0); 37module_param(hycapi_enable, uint, 0);
38 38
39typedef struct _hycapi_appl { 39typedef struct _hycapi_appl {
@@ -48,18 +48,18 @@ static u16 hycapi_send_message(struct capi_ctr *ctrl, struct sk_buff *skb);
48 48
49static inline int _hycapi_appCheck(int app_id, int ctrl_no) 49static inline int _hycapi_appCheck(int app_id, int ctrl_no)
50{ 50{
51 if((ctrl_no <= 0) || (ctrl_no > CAPI_MAXCONTR) || (app_id <= 0) || 51 if ((ctrl_no <= 0) || (ctrl_no > CAPI_MAXCONTR) || (app_id <= 0) ||
52 (app_id > CAPI_MAXAPPL)) 52 (app_id > CAPI_MAXAPPL))
53 { 53 {
54 printk(KERN_ERR "HYCAPI: Invalid request app_id %d for controller %d", app_id, ctrl_no); 54 printk(KERN_ERR "HYCAPI: Invalid request app_id %d for controller %d", app_id, ctrl_no);
55 return -1; 55 return -1;
56 } 56 }
57 return ((hycapi_applications[app_id-1].ctrl_mask & (1 << (ctrl_no-1))) != 0); 57 return ((hycapi_applications[app_id - 1].ctrl_mask & (1 << (ctrl_no-1))) != 0);
58} 58}
59 59
60/****************************** 60/******************************
61Kernel-Capi callback reset_ctr 61Kernel-Capi callback reset_ctr
62******************************/ 62******************************/
63 63
64static void 64static void
65hycapi_reset_ctr(struct capi_ctr *ctrl) 65hycapi_reset_ctr(struct capi_ctr *ctrl)
@@ -75,7 +75,7 @@ hycapi_reset_ctr(struct capi_ctr *ctrl)
75 75
76/****************************** 76/******************************
77Kernel-Capi callback remove_ctr 77Kernel-Capi callback remove_ctr
78******************************/ 78******************************/
79 79
80static void 80static void
81hycapi_remove_ctr(struct capi_ctr *ctrl) 81hycapi_remove_ctr(struct capi_ctr *ctrl)
@@ -85,25 +85,25 @@ hycapi_remove_ctr(struct capi_ctr *ctrl)
85 hysdn_card *card = NULL; 85 hysdn_card *card = NULL;
86#ifdef HYCAPI_PRINTFNAMES 86#ifdef HYCAPI_PRINTFNAMES
87 printk(KERN_NOTICE "HYCAPI hycapi_remove_ctr\n"); 87 printk(KERN_NOTICE "HYCAPI hycapi_remove_ctr\n");
88#endif 88#endif
89 cinfo = (hycapictrl_info *)(ctrl->driverdata); 89 cinfo = (hycapictrl_info *)(ctrl->driverdata);
90 if(!cinfo) { 90 if (!cinfo) {
91 printk(KERN_ERR "No hycapictrl_info set!"); 91 printk(KERN_ERR "No hycapictrl_info set!");
92 return; 92 return;
93 } 93 }
94 card = cinfo->card; 94 card = cinfo->card;
95 capi_ctr_suspend_output(ctrl); 95 capi_ctr_suspend_output(ctrl);
96 for(i=0; i<CAPI_MAXAPPL;i++) { 96 for (i = 0; i < CAPI_MAXAPPL; i++) {
97 if(hycapi_applications[i].listen_req[ctrl->cnr-1]) { 97 if (hycapi_applications[i].listen_req[ctrl->cnr - 1]) {
98 kfree_skb(hycapi_applications[i].listen_req[ctrl->cnr-1]); 98 kfree_skb(hycapi_applications[i].listen_req[ctrl->cnr - 1]);
99 hycapi_applications[i].listen_req[ctrl->cnr-1] = NULL; 99 hycapi_applications[i].listen_req[ctrl->cnr - 1] = NULL;
100 } 100 }
101 } 101 }
102 detach_capi_ctr(ctrl); 102 detach_capi_ctr(ctrl);
103 ctrl->driverdata = NULL; 103 ctrl->driverdata = NULL;
104 kfree(card->hyctrlinfo); 104 kfree(card->hyctrlinfo);
105 105
106 106
107 card->hyctrlinfo = NULL; 107 card->hyctrlinfo = NULL;
108} 108}
109 109
@@ -121,7 +121,7 @@ hycapi_sendmsg_internal(struct capi_ctr *ctrl, struct sk_buff *skb)
121 121
122 spin_lock_irq(&cinfo->lock); 122 spin_lock_irq(&cinfo->lock);
123#ifdef HYCAPI_PRINTFNAMES 123#ifdef HYCAPI_PRINTFNAMES
124 printk(KERN_NOTICE "hycapi_send_message\n"); 124 printk(KERN_NOTICE "hycapi_send_message\n");
125#endif 125#endif
126 cinfo->skbs[cinfo->in_idx++] = skb; /* add to buffer list */ 126 cinfo->skbs[cinfo->in_idx++] = skb; /* add to buffer list */
127 if (cinfo->in_idx >= HYSDN_MAX_CAPI_SKB) 127 if (cinfo->in_idx >= HYSDN_MAX_CAPI_SKB)
@@ -130,7 +130,7 @@ hycapi_sendmsg_internal(struct capi_ctr *ctrl, struct sk_buff *skb)
130 if (cinfo->sk_count >= HYSDN_MAX_CAPI_SKB) { 130 if (cinfo->sk_count >= HYSDN_MAX_CAPI_SKB) {
131 /* inform upper layers we're full */ 131 /* inform upper layers we're full */
132 printk(KERN_ERR "HYSDN Card%d: CAPI-buffer overrun!\n", 132 printk(KERN_ERR "HYSDN Card%d: CAPI-buffer overrun!\n",
133 card->myid); 133 card->myid);
134 capi_ctr_suspend_output(ctrl); 134 capi_ctr_suspend_output(ctrl);
135 } 135 }
136 cinfo->tx_skb = skb; 136 cinfo->tx_skb = skb;
@@ -147,7 +147,7 @@ re-register any applications in the private list.
147 147
148************************************************************/ 148************************************************************/
149 149
150static void 150static void
151hycapi_register_internal(struct capi_ctr *ctrl, __u16 appl, 151hycapi_register_internal(struct capi_ctr *ctrl, __u16 appl,
152 capi_register_params *rp) 152 capi_register_params *rp)
153{ 153{
@@ -161,9 +161,9 @@ hycapi_register_internal(struct capi_ctr *ctrl, __u16 appl,
161 __u16 MessageBufferSize = 0; 161 __u16 MessageBufferSize = 0;
162 int slen = strlen(ExtFeatureDefaults); 162 int slen = strlen(ExtFeatureDefaults);
163#ifdef HYCAPI_PRINTFNAMES 163#ifdef HYCAPI_PRINTFNAMES
164 printk(KERN_NOTICE "hycapi_register_appl\n"); 164 printk(KERN_NOTICE "hycapi_register_appl\n");
165#endif 165#endif
166 MessageBufferSize = rp->level3cnt * rp->datablkcnt * rp->datablklen; 166 MessageBufferSize = rp->level3cnt * rp->datablkcnt * rp->datablklen;
167 167
168 len = CAPI_MSG_BASELEN + 8 + slen + 1; 168 len = CAPI_MSG_BASELEN + 8 + slen + 1;
169 if (!(skb = alloc_skb(len, GFP_ATOMIC))) { 169 if (!(skb = alloc_skb(len, GFP_ATOMIC))) {
@@ -171,18 +171,18 @@ hycapi_register_internal(struct capi_ctr *ctrl, __u16 appl,
171 card->myid); 171 card->myid);
172 return; 172 return;
173 } 173 }
174 memcpy(skb_put(skb,sizeof(__u16)), &len, sizeof(__u16)); 174 memcpy(skb_put(skb, sizeof(__u16)), &len, sizeof(__u16));
175 memcpy(skb_put(skb,sizeof(__u16)), &appl, sizeof(__u16)); 175 memcpy(skb_put(skb, sizeof(__u16)), &appl, sizeof(__u16));
176 memcpy(skb_put(skb,sizeof(__u8)), &_command, sizeof(_command)); 176 memcpy(skb_put(skb, sizeof(__u8)), &_command, sizeof(_command));
177 memcpy(skb_put(skb,sizeof(__u8)), &_subcommand, sizeof(_subcommand)); 177 memcpy(skb_put(skb, sizeof(__u8)), &_subcommand, sizeof(_subcommand));
178 memcpy(skb_put(skb,sizeof(__u16)), &MessageNumber, sizeof(__u16)); 178 memcpy(skb_put(skb, sizeof(__u16)), &MessageNumber, sizeof(__u16));
179 memcpy(skb_put(skb,sizeof(__u16)), &MessageBufferSize, sizeof(__u16)); 179 memcpy(skb_put(skb, sizeof(__u16)), &MessageBufferSize, sizeof(__u16));
180 memcpy(skb_put(skb,sizeof(__u16)), &(rp->level3cnt), sizeof(__u16)); 180 memcpy(skb_put(skb, sizeof(__u16)), &(rp->level3cnt), sizeof(__u16));
181 memcpy(skb_put(skb,sizeof(__u16)), &(rp->datablkcnt), sizeof(__u16)); 181 memcpy(skb_put(skb, sizeof(__u16)), &(rp->datablkcnt), sizeof(__u16));
182 memcpy(skb_put(skb,sizeof(__u16)), &(rp->datablklen), sizeof(__u16)); 182 memcpy(skb_put(skb, sizeof(__u16)), &(rp->datablklen), sizeof(__u16));
183 memcpy(skb_put(skb,slen), ExtFeatureDefaults, slen); 183 memcpy(skb_put(skb, slen), ExtFeatureDefaults, slen);
184 hycapi_applications[appl-1].ctrl_mask |= (1 << (ctrl->cnr-1)); 184 hycapi_applications[appl - 1].ctrl_mask |= (1 << (ctrl->cnr - 1));
185 hycapi_send_message(ctrl, skb); 185 hycapi_send_message(ctrl, skb);
186} 186}
187 187
188/************************************************************ 188/************************************************************
@@ -200,12 +200,12 @@ static void hycapi_restart_internal(struct capi_ctr *ctrl)
200#ifdef HYCAPI_PRINTFNAMES 200#ifdef HYCAPI_PRINTFNAMES
201 printk(KERN_WARNING "HYSDN: hycapi_restart_internal"); 201 printk(KERN_WARNING "HYSDN: hycapi_restart_internal");
202#endif 202#endif
203 for(i=0; i<CAPI_MAXAPPL; i++) { 203 for (i = 0; i < CAPI_MAXAPPL; i++) {
204 if(_hycapi_appCheck(i+1, ctrl->cnr) == 1) { 204 if (_hycapi_appCheck(i + 1, ctrl->cnr) == 1) {
205 hycapi_register_internal(ctrl, i+1, 205 hycapi_register_internal(ctrl, i + 1,
206 &hycapi_applications[i].rp); 206 &hycapi_applications[i].rp);
207 if(hycapi_applications[i].listen_req[ctrl->cnr-1]) { 207 if (hycapi_applications[i].listen_req[ctrl->cnr - 1]) {
208 skb = skb_copy(hycapi_applications[i].listen_req[ctrl->cnr-1], GFP_ATOMIC); 208 skb = skb_copy(hycapi_applications[i].listen_req[ctrl->cnr - 1], GFP_ATOMIC);
209 hycapi_sendmsg_internal(ctrl, skb); 209 hycapi_sendmsg_internal(ctrl, skb);
210 } 210 }
211 } 211 }
@@ -220,35 +220,35 @@ The application is recorded in the internal list.
220*************************************************************/ 220*************************************************************/
221 221
222static void 222static void
223hycapi_register_appl(struct capi_ctr *ctrl, __u16 appl, 223hycapi_register_appl(struct capi_ctr *ctrl, __u16 appl,
224 capi_register_params *rp) 224 capi_register_params *rp)
225{ 225{
226 int MaxLogicalConnections = 0, MaxBDataBlocks = 0, MaxBDataLen = 0; 226 int MaxLogicalConnections = 0, MaxBDataBlocks = 0, MaxBDataLen = 0;
227 hycapictrl_info *cinfo = (hycapictrl_info *)(ctrl->driverdata); 227 hycapictrl_info *cinfo = (hycapictrl_info *)(ctrl->driverdata);
228 hysdn_card *card = cinfo->card; 228 hysdn_card *card = cinfo->card;
229 int chk = _hycapi_appCheck(appl, ctrl->cnr); 229 int chk = _hycapi_appCheck(appl, ctrl->cnr);
230 if(chk < 0) { 230 if (chk < 0) {
231 return; 231 return;
232 } 232 }
233 if(chk == 1) { 233 if (chk == 1) {
234 printk(KERN_INFO "HYSDN: apl %d already registered\n", appl); 234 printk(KERN_INFO "HYSDN: apl %d already registered\n", appl);
235 return; 235 return;
236 } 236 }
237 MaxBDataBlocks = rp->datablkcnt > CAPI_MAXDATAWINDOW ? CAPI_MAXDATAWINDOW : rp->datablkcnt; 237 MaxBDataBlocks = rp->datablkcnt > CAPI_MAXDATAWINDOW ? CAPI_MAXDATAWINDOW : rp->datablkcnt;
238 rp->datablkcnt = MaxBDataBlocks; 238 rp->datablkcnt = MaxBDataBlocks;
239 MaxBDataLen = rp->datablklen < 1024 ? 1024 : rp->datablklen ; 239 MaxBDataLen = rp->datablklen < 1024 ? 1024 : rp->datablklen;
240 rp->datablklen = MaxBDataLen; 240 rp->datablklen = MaxBDataLen;
241 241
242 MaxLogicalConnections = rp->level3cnt; 242 MaxLogicalConnections = rp->level3cnt;
243 if (MaxLogicalConnections < 0) { 243 if (MaxLogicalConnections < 0) {
244 MaxLogicalConnections = card->bchans * -MaxLogicalConnections; 244 MaxLogicalConnections = card->bchans * -MaxLogicalConnections;
245 } 245 }
246 if (MaxLogicalConnections == 0) { 246 if (MaxLogicalConnections == 0) {
247 MaxLogicalConnections = card->bchans; 247 MaxLogicalConnections = card->bchans;
248 } 248 }
249 249
250 rp->level3cnt = MaxLogicalConnections; 250 rp->level3cnt = MaxLogicalConnections;
251 memcpy(&hycapi_applications[appl-1].rp, 251 memcpy(&hycapi_applications[appl - 1].rp,
252 rp, sizeof(capi_register_params)); 252 rp, sizeof(capi_register_params));
253} 253}
254 254
@@ -279,19 +279,19 @@ static void hycapi_release_internal(struct capi_ctr *ctrl, __u16 appl)
279 card->myid); 279 card->myid);
280 return; 280 return;
281 } 281 }
282 memcpy(skb_put(skb,sizeof(__u16)), &len, sizeof(__u16)); 282 memcpy(skb_put(skb, sizeof(__u16)), &len, sizeof(__u16));
283 memcpy(skb_put(skb,sizeof(__u16)), &appl, sizeof(__u16)); 283 memcpy(skb_put(skb, sizeof(__u16)), &appl, sizeof(__u16));
284 memcpy(skb_put(skb,sizeof(__u8)), &_command, sizeof(_command)); 284 memcpy(skb_put(skb, sizeof(__u8)), &_command, sizeof(_command));
285 memcpy(skb_put(skb,sizeof(__u8)), &_subcommand, sizeof(_subcommand)); 285 memcpy(skb_put(skb, sizeof(__u8)), &_subcommand, sizeof(_subcommand));
286 memcpy(skb_put(skb,sizeof(__u16)), &MessageNumber, sizeof(__u16)); 286 memcpy(skb_put(skb, sizeof(__u16)), &MessageNumber, sizeof(__u16));
287 hycapi_send_message(ctrl, skb); 287 hycapi_send_message(ctrl, skb);
288 hycapi_applications[appl-1].ctrl_mask &= ~(1 << (ctrl->cnr-1)); 288 hycapi_applications[appl - 1].ctrl_mask &= ~(1 << (ctrl->cnr - 1));
289} 289}
290 290
291/****************************************************************** 291/******************************************************************
292hycapi_release_appl 292hycapi_release_appl
293 293
294Release the application from the internal list an remove it's 294Release the application from the internal list an remove it's
295registration at controller-level 295registration at controller-level
296******************************************************************/ 296******************************************************************/
297 297
@@ -301,15 +301,15 @@ hycapi_release_appl(struct capi_ctr *ctrl, __u16 appl)
301 int chk; 301 int chk;
302 302
303 chk = _hycapi_appCheck(appl, ctrl->cnr); 303 chk = _hycapi_appCheck(appl, ctrl->cnr);
304 if(chk<0) { 304 if (chk < 0) {
305 printk(KERN_ERR "HYCAPI: Releasing invalid appl %d on controller %d\n", appl, ctrl->cnr); 305 printk(KERN_ERR "HYCAPI: Releasing invalid appl %d on controller %d\n", appl, ctrl->cnr);
306 return; 306 return;
307 } 307 }
308 if(hycapi_applications[appl-1].listen_req[ctrl->cnr-1]) { 308 if (hycapi_applications[appl - 1].listen_req[ctrl->cnr - 1]) {
309 kfree_skb(hycapi_applications[appl-1].listen_req[ctrl->cnr-1]); 309 kfree_skb(hycapi_applications[appl - 1].listen_req[ctrl->cnr - 1]);
310 hycapi_applications[appl-1].listen_req[ctrl->cnr-1] = NULL; 310 hycapi_applications[appl - 1].listen_req[ctrl->cnr - 1] = NULL;
311 } 311 }
312 if(chk == 1) 312 if (chk == 1)
313 { 313 {
314 hycapi_release_internal(ctrl, appl); 314 hycapi_release_internal(ctrl, appl);
315 } 315 }
@@ -327,7 +327,7 @@ int hycapi_capi_release(hysdn_card *card)
327#ifdef HYCAPI_PRINTFNAMES 327#ifdef HYCAPI_PRINTFNAMES
328 printk(KERN_NOTICE "hycapi_capi_release\n"); 328 printk(KERN_NOTICE "hycapi_capi_release\n");
329#endif 329#endif
330 if(cinfo) { 330 if (cinfo) {
331 ctrl = &cinfo->capi_ctrl; 331 ctrl = &cinfo->capi_ctrl;
332 hycapi_remove_ctr(ctrl); 332 hycapi_remove_ctr(ctrl);
333 } 333 }
@@ -347,7 +347,7 @@ int hycapi_capi_stop(hysdn_card *card)
347#ifdef HYCAPI_PRINTFNAMES 347#ifdef HYCAPI_PRINTFNAMES
348 printk(KERN_NOTICE "hycapi_capi_stop\n"); 348 printk(KERN_NOTICE "hycapi_capi_stop\n");
349#endif 349#endif
350 if(cinfo) { 350 if (cinfo) {
351 ctrl = &cinfo->capi_ctrl; 351 ctrl = &cinfo->capi_ctrl;
352/* ctrl->suspend_output(ctrl); */ 352/* ctrl->suspend_output(ctrl); */
353 capi_ctr_down(ctrl); 353 capi_ctr_down(ctrl);
@@ -377,59 +377,59 @@ static u16 hycapi_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
377 u16 retval = CAPI_NOERROR; 377 u16 retval = CAPI_NOERROR;
378 378
379 appl_id = CAPIMSG_APPID(skb->data); 379 appl_id = CAPIMSG_APPID(skb->data);
380 switch(_hycapi_appCheck(appl_id, ctrl->cnr)) 380 switch (_hycapi_appCheck(appl_id, ctrl->cnr))
381 { 381 {
382 case 0: 382 case 0:
383/* printk(KERN_INFO "Need to register\n"); */ 383/* printk(KERN_INFO "Need to register\n"); */
384 hycapi_register_internal(ctrl, 384 hycapi_register_internal(ctrl,
385 appl_id, 385 appl_id,
386 &(hycapi_applications[appl_id-1].rp)); 386 &(hycapi_applications[appl_id - 1].rp));
387 break; 387 break;
388 case 1: 388 case 1:
389 break; 389 break;
390 default: 390 default:
391 printk(KERN_ERR "HYCAPI: Controller mixup!\n"); 391 printk(KERN_ERR "HYCAPI: Controller mixup!\n");
392 retval = CAPI_ILLAPPNR; 392 retval = CAPI_ILLAPPNR;
393 goto out; 393 goto out;
394 } 394 }
395 switch(CAPIMSG_CMD(skb->data)) { 395 switch (CAPIMSG_CMD(skb->data)) {
396 case CAPI_DISCONNECT_B3_RESP: 396 case CAPI_DISCONNECT_B3_RESP:
397 capilib_free_ncci(&cinfo->ncci_head, appl_id, 397 capilib_free_ncci(&cinfo->ncci_head, appl_id,
398 CAPIMSG_NCCI(skb->data)); 398 CAPIMSG_NCCI(skb->data));
399 break; 399 break;
400 case CAPI_DATA_B3_REQ: 400 case CAPI_DATA_B3_REQ:
401 _len = CAPIMSG_LEN(skb->data); 401 _len = CAPIMSG_LEN(skb->data);
402 if (_len > 22) { 402 if (_len > 22) {
403 _len2 = _len - 22; 403 _len2 = _len - 22;
404 skb_copy_from_linear_data(skb, msghead, 22); 404 skb_copy_from_linear_data(skb, msghead, 22);
405 skb_copy_to_linear_data_offset(skb, _len2, 405 skb_copy_to_linear_data_offset(skb, _len2,
406 msghead, 22); 406 msghead, 22);
407 skb_pull(skb, _len2); 407 skb_pull(skb, _len2);
408 CAPIMSG_SETLEN(skb->data, 22); 408 CAPIMSG_SETLEN(skb->data, 22);
409 retval = capilib_data_b3_req(&cinfo->ncci_head, 409 retval = capilib_data_b3_req(&cinfo->ncci_head,
410 CAPIMSG_APPID(skb->data), 410 CAPIMSG_APPID(skb->data),
411 CAPIMSG_NCCI(skb->data), 411 CAPIMSG_NCCI(skb->data),
412 CAPIMSG_MSGID(skb->data)); 412 CAPIMSG_MSGID(skb->data));
413 } 413 }
414 break; 414 break;
415 case CAPI_LISTEN_REQ: 415 case CAPI_LISTEN_REQ:
416 if(hycapi_applications[appl_id-1].listen_req[ctrl->cnr-1]) 416 if (hycapi_applications[appl_id - 1].listen_req[ctrl->cnr - 1])
417 { 417 {
418 kfree_skb(hycapi_applications[appl_id-1].listen_req[ctrl->cnr-1]); 418 kfree_skb(hycapi_applications[appl_id - 1].listen_req[ctrl->cnr - 1]);
419 hycapi_applications[appl_id-1].listen_req[ctrl->cnr-1] = NULL; 419 hycapi_applications[appl_id - 1].listen_req[ctrl->cnr - 1] = NULL;
420 } 420 }
421 if (!(hycapi_applications[appl_id-1].listen_req[ctrl->cnr-1] = skb_copy(skb, GFP_ATOMIC))) 421 if (!(hycapi_applications[appl_id -1].listen_req[ctrl->cnr - 1] = skb_copy(skb, GFP_ATOMIC)))
422 { 422 {
423 printk(KERN_ERR "HYSDN: memory squeeze in private_listen\n"); 423 printk(KERN_ERR "HYSDN: memory squeeze in private_listen\n");
424 } 424 }
425 break; 425 break;
426 default: 426 default:
427 break; 427 break;
428 } 428 }
429 out: 429out:
430 if (retval == CAPI_NOERROR) 430 if (retval == CAPI_NOERROR)
431 hycapi_sendmsg_internal(ctrl, skb); 431 hycapi_sendmsg_internal(ctrl, skb);
432 else 432 else
433 dev_kfree_skb_any(skb); 433 dev_kfree_skb_any(skb);
434 434
435 return retval; 435 return retval;
@@ -445,14 +445,14 @@ static int hycapi_proc_show(struct seq_file *m, void *v)
445 seq_printf(m, "%-16s %s\n", "name", cinfo->cardname); 445 seq_printf(m, "%-16s %s\n", "name", cinfo->cardname);
446 seq_printf(m, "%-16s 0x%x\n", "io", card->iobase); 446 seq_printf(m, "%-16s 0x%x\n", "io", card->iobase);
447 seq_printf(m, "%-16s %d\n", "irq", card->irq); 447 seq_printf(m, "%-16s %d\n", "irq", card->irq);
448 448
449 switch (card->brdtype) { 449 switch (card->brdtype) {
450 case BD_PCCARD: s = "HYSDN Hycard"; break; 450 case BD_PCCARD: s = "HYSDN Hycard"; break;
451 case BD_ERGO: s = "HYSDN Ergo2"; break; 451 case BD_ERGO: s = "HYSDN Ergo2"; break;
452 case BD_METRO: s = "HYSDN Metro4"; break; 452 case BD_METRO: s = "HYSDN Metro4"; break;
453 case BD_CHAMP2: s = "HYSDN Champ2"; break; 453 case BD_CHAMP2: s = "HYSDN Champ2"; break;
454 case BD_PLEXUS: s = "HYSDN Plexus30"; break; 454 case BD_PLEXUS: s = "HYSDN Plexus30"; break;
455 default: s = "???"; break; 455 default: s = "???"; break;
456 } 456 }
457 seq_printf(m, "%-16s %s\n", "type", s); 457 seq_printf(m, "%-16s %s\n", "type", s);
458 if ((s = cinfo->version[VER_DRIVER]) != NULL) 458 if ((s = cinfo->version[VER_DRIVER]) != NULL)
@@ -461,9 +461,9 @@ static int hycapi_proc_show(struct seq_file *m, void *v)
461 seq_printf(m, "%-16s %s\n", "ver_cardtype", s); 461 seq_printf(m, "%-16s %s\n", "ver_cardtype", s);
462 if ((s = cinfo->version[VER_SERIAL]) != NULL) 462 if ((s = cinfo->version[VER_SERIAL]) != NULL)
463 seq_printf(m, "%-16s %s\n", "ver_serial", s); 463 seq_printf(m, "%-16s %s\n", "ver_serial", s);
464 464
465 seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname); 465 seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname);
466 466
467 return 0; 467 return 0;
468} 468}
469 469
@@ -491,7 +491,7 @@ on capi-interface registration.
491static int hycapi_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) 491static int hycapi_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
492{ 492{
493#ifdef HYCAPI_PRINTFNAMES 493#ifdef HYCAPI_PRINTFNAMES
494 printk(KERN_NOTICE "hycapi_load_firmware\n"); 494 printk(KERN_NOTICE "hycapi_load_firmware\n");
495#endif 495#endif
496 return 0; 496 return 0;
497} 497}
@@ -501,7 +501,7 @@ static char *hycapi_procinfo(struct capi_ctr *ctrl)
501{ 501{
502 hycapictrl_info *cinfo = (hycapictrl_info *)(ctrl->driverdata); 502 hycapictrl_info *cinfo = (hycapictrl_info *)(ctrl->driverdata);
503#ifdef HYCAPI_PRINTFNAMES 503#ifdef HYCAPI_PRINTFNAMES
504 printk(KERN_NOTICE "hycapi_proc_info\n"); 504 printk(KERN_NOTICE "hycapi_proc_info\n");
505#endif 505#endif
506 if (!cinfo) 506 if (!cinfo)
507 return ""; 507 return "";
@@ -525,7 +525,7 @@ New nccis are created if necessary.
525*******************************************************************/ 525*******************************************************************/
526 526
527void 527void
528hycapi_rx_capipkt(hysdn_card * card, unsigned char *buf, unsigned short len) 528hycapi_rx_capipkt(hysdn_card *card, unsigned char *buf, unsigned short len)
529{ 529{
530 struct sk_buff *skb; 530 struct sk_buff *skb;
531 hycapictrl_info *cinfo = card->hyctrlinfo; 531 hycapictrl_info *cinfo = card->hyctrlinfo;
@@ -533,24 +533,24 @@ hycapi_rx_capipkt(hysdn_card * card, unsigned char *buf, unsigned short len)
533 __u16 ApplId; 533 __u16 ApplId;
534 __u16 MsgLen, info; 534 __u16 MsgLen, info;
535 __u16 len2, CapiCmd; 535 __u16 len2, CapiCmd;
536 __u32 CP64[2] = {0,0}; 536 __u32 CP64[2] = {0, 0};
537#ifdef HYCAPI_PRINTFNAMES 537#ifdef HYCAPI_PRINTFNAMES
538 printk(KERN_NOTICE "hycapi_rx_capipkt\n"); 538 printk(KERN_NOTICE "hycapi_rx_capipkt\n");
539#endif 539#endif
540 if(!cinfo) { 540 if (!cinfo) {
541 return; 541 return;
542 } 542 }
543 ctrl = &cinfo->capi_ctrl; 543 ctrl = &cinfo->capi_ctrl;
544 if(len < CAPI_MSG_BASELEN) { 544 if (len < CAPI_MSG_BASELEN) {
545 printk(KERN_ERR "HYSDN Card%d: invalid CAPI-message, length %d!\n", 545 printk(KERN_ERR "HYSDN Card%d: invalid CAPI-message, length %d!\n",
546 card->myid, len); 546 card->myid, len);
547 return; 547 return;
548 } 548 }
549 MsgLen = CAPIMSG_LEN(buf); 549 MsgLen = CAPIMSG_LEN(buf);
550 ApplId = CAPIMSG_APPID(buf); 550 ApplId = CAPIMSG_APPID(buf);
551 CapiCmd = CAPIMSG_CMD(buf); 551 CapiCmd = CAPIMSG_CMD(buf);
552 552
553 if((CapiCmd == CAPI_DATA_B3_IND) && (MsgLen < 30)) { 553 if ((CapiCmd == CAPI_DATA_B3_IND) && (MsgLen < 30)) {
554 len2 = len + (30 - MsgLen); 554 len2 = len + (30 - MsgLen);
555 if (!(skb = alloc_skb(len2, GFP_ATOMIC))) { 555 if (!(skb = alloc_skb(len2, GFP_ATOMIC))) {
556 printk(KERN_ERR "HYSDN Card%d: incoming packet dropped\n", 556 printk(KERN_ERR "HYSDN Card%d: incoming packet dropped\n",
@@ -558,7 +558,7 @@ hycapi_rx_capipkt(hysdn_card * card, unsigned char *buf, unsigned short len)
558 return; 558 return;
559 } 559 }
560 memcpy(skb_put(skb, MsgLen), buf, MsgLen); 560 memcpy(skb_put(skb, MsgLen), buf, MsgLen);
561 memcpy(skb_put(skb, 2*sizeof(__u32)), CP64, 2* sizeof(__u32)); 561 memcpy(skb_put(skb, 2 * sizeof(__u32)), CP64, 2 * sizeof(__u32));
562 memcpy(skb_put(skb, len - MsgLen), buf + MsgLen, 562 memcpy(skb_put(skb, len - MsgLen), buf + MsgLen,
563 len - MsgLen); 563 len - MsgLen);
564 CAPIMSG_SETLEN(skb->data, 30); 564 CAPIMSG_SETLEN(skb->data, 30);
@@ -570,54 +570,54 @@ hycapi_rx_capipkt(hysdn_card * card, unsigned char *buf, unsigned short len)
570 } 570 }
571 memcpy(skb_put(skb, len), buf, len); 571 memcpy(skb_put(skb, len), buf, len);
572 } 572 }
573 switch(CAPIMSG_CMD(skb->data)) 573 switch (CAPIMSG_CMD(skb->data))
574 { 574 {
575 case CAPI_CONNECT_B3_CONF: 575 case CAPI_CONNECT_B3_CONF:
576/* Check info-field for error-indication: */ 576/* Check info-field for error-indication: */
577 info = CAPIMSG_U16(skb->data, 12); 577 info = CAPIMSG_U16(skb->data, 12);
578 switch(info) 578 switch (info)
579 { 579 {
580 case 0: 580 case 0:
581 capilib_new_ncci(&cinfo->ncci_head, ApplId, CAPIMSG_NCCI(skb->data), 581 capilib_new_ncci(&cinfo->ncci_head, ApplId, CAPIMSG_NCCI(skb->data),
582 hycapi_applications[ApplId-1].rp.datablkcnt); 582 hycapi_applications[ApplId - 1].rp.datablkcnt);
583 583
584 break; 584 break;
585 case 0x0001: 585 case 0x0001:
586 printk(KERN_ERR "HYSDN Card%d: NCPI not supported by current " 586 printk(KERN_ERR "HYSDN Card%d: NCPI not supported by current "
587 "protocol. NCPI ignored.\n", card->myid); 587 "protocol. NCPI ignored.\n", card->myid);
588 break;
589 case 0x2001:
590 printk(KERN_ERR "HYSDN Card%d: Message not supported in"
591 " current state\n", card->myid);
592 break;
593 case 0x2002:
594 printk(KERN_ERR "HYSDN Card%d: invalid PLCI\n", card->myid);
595 break;
596 case 0x2004:
597 printk(KERN_ERR "HYSDN Card%d: out of NCCI\n", card->myid);
598 break;
599 case 0x3008:
600 printk(KERN_ERR "HYSDN Card%d: NCPI not supported\n",
601 card->myid);
602 break;
603 default:
604 printk(KERN_ERR "HYSDN Card%d: Info in CONNECT_B3_CONF: %d\n",
605 card->myid, info);
606 break;
607 }
608 break; 588 break;
609 case CAPI_CONNECT_B3_IND: 589 case 0x2001:
610 capilib_new_ncci(&cinfo->ncci_head, ApplId, 590 printk(KERN_ERR "HYSDN Card%d: Message not supported in"
611 CAPIMSG_NCCI(skb->data), 591 " current state\n", card->myid);
612 hycapi_applications[ApplId-1].rp.datablkcnt);
613 break; 592 break;
614 case CAPI_DATA_B3_CONF: 593 case 0x2002:
615 capilib_data_b3_conf(&cinfo->ncci_head, ApplId, 594 printk(KERN_ERR "HYSDN Card%d: invalid PLCI\n", card->myid);
616 CAPIMSG_NCCI(skb->data), 595 break;
617 CAPIMSG_MSGID(skb->data)); 596 case 0x2004:
597 printk(KERN_ERR "HYSDN Card%d: out of NCCI\n", card->myid);
598 break;
599 case 0x3008:
600 printk(KERN_ERR "HYSDN Card%d: NCPI not supported\n",
601 card->myid);
618 break; 602 break;
619 default: 603 default:
604 printk(KERN_ERR "HYSDN Card%d: Info in CONNECT_B3_CONF: %d\n",
605 card->myid, info);
620 break; 606 break;
607 }
608 break;
609 case CAPI_CONNECT_B3_IND:
610 capilib_new_ncci(&cinfo->ncci_head, ApplId,
611 CAPIMSG_NCCI(skb->data),
612 hycapi_applications[ApplId - 1].rp.datablkcnt);
613 break;
614 case CAPI_DATA_B3_CONF:
615 capilib_data_b3_conf(&cinfo->ncci_head, ApplId,
616 CAPIMSG_NCCI(skb->data),
617 CAPIMSG_MSGID(skb->data));
618 break;
619 default:
620 break;
621 } 621 }
622 capi_ctr_handle_message(ctrl, ApplId, skb); 622 capi_ctr_handle_message(ctrl, ApplId, skb);
623} 623}
@@ -630,13 +630,13 @@ internal queue.
630 630
631*******************************************************************/ 631*******************************************************************/
632 632
633void hycapi_tx_capiack(hysdn_card * card) 633void hycapi_tx_capiack(hysdn_card *card)
634{ 634{
635 hycapictrl_info *cinfo = card->hyctrlinfo; 635 hycapictrl_info *cinfo = card->hyctrlinfo;
636#ifdef HYCAPI_PRINTFNAMES 636#ifdef HYCAPI_PRINTFNAMES
637 printk(KERN_NOTICE "hycapi_tx_capiack\n"); 637 printk(KERN_NOTICE "hycapi_tx_capiack\n");
638#endif 638#endif
639 if(!cinfo) { 639 if (!cinfo) {
640 return; 640 return;
641 } 641 }
642 spin_lock_irq(&cinfo->lock); 642 spin_lock_irq(&cinfo->lock);
@@ -661,7 +661,7 @@ struct sk_buff *
661hycapi_tx_capiget(hysdn_card *card) 661hycapi_tx_capiget(hysdn_card *card)
662{ 662{
663 hycapictrl_info *cinfo = card->hyctrlinfo; 663 hycapictrl_info *cinfo = card->hyctrlinfo;
664 if(!cinfo) { 664 if (!cinfo) {
665 return (struct sk_buff *)NULL; 665 return (struct sk_buff *)NULL;
666 } 666 }
667 if (!cinfo->sk_count) 667 if (!cinfo->sk_count)
@@ -681,10 +681,10 @@ attach the capi-driver to the kernel-capi.
681int hycapi_init(void) 681int hycapi_init(void)
682{ 682{
683 int i; 683 int i;
684 for(i=0;i<CAPI_MAXAPPL;i++) { 684 for (i = 0; i < CAPI_MAXAPPL; i++) {
685 memset(&(hycapi_applications[i]), 0, sizeof(hycapi_appl)); 685 memset(&(hycapi_applications[i]), 0, sizeof(hycapi_appl));
686 } 686 }
687 return(0); 687 return (0);
688} 688}
689 689
690/************************************************************** 690/**************************************************************
@@ -694,7 +694,7 @@ detach the capi-driver to the kernel-capi. Actually this should
694free some more ressources. Do that later. 694free some more ressources. Do that later.
695**************************************************************/ 695**************************************************************/
696 696
697void 697void
698hycapi_cleanup(void) 698hycapi_cleanup(void)
699{ 699{
700} 700}
@@ -710,9 +710,9 @@ static void hycapi_fill_profile(hysdn_card *card)
710 hycapictrl_info *cinfo = NULL; 710 hycapictrl_info *cinfo = NULL;
711 struct capi_ctr *ctrl = NULL; 711 struct capi_ctr *ctrl = NULL;
712 cinfo = card->hyctrlinfo; 712 cinfo = card->hyctrlinfo;
713 if(!cinfo) return; 713 if (!cinfo) return;
714 ctrl = &cinfo->capi_ctrl; 714 ctrl = &cinfo->capi_ctrl;
715 strcpy(ctrl->manu, "Hypercope"); 715 strcpy(ctrl->manu, "Hypercope");
716 ctrl->version.majorversion = 2; 716 ctrl->version.majorversion = 2;
717 ctrl->version.minorversion = 0; 717 ctrl->version.minorversion = 0;
718 ctrl->version.majormanuversion = 3; 718 ctrl->version.majormanuversion = 3;
@@ -732,18 +732,18 @@ static void hycapi_fill_profile(hysdn_card *card)
732 (card->faxchans ? B3_PROT_T30 : 0) | 732 (card->faxchans ? B3_PROT_T30 : 0) |
733 (card->faxchans ? B3_PROT_T30EXT : 0) | 733 (card->faxchans ? B3_PROT_T30EXT : 0) |
734 B3_PROT_ISO8208; 734 B3_PROT_ISO8208;
735} 735}
736 736
737int 737int
738hycapi_capi_create(hysdn_card *card) 738hycapi_capi_create(hysdn_card *card)
739{ 739{
740 hycapictrl_info *cinfo = NULL; 740 hycapictrl_info *cinfo = NULL;
741 struct capi_ctr *ctrl = NULL; 741 struct capi_ctr *ctrl = NULL;
742 int retval; 742 int retval;
743#ifdef HYCAPI_PRINTFNAMES 743#ifdef HYCAPI_PRINTFNAMES
744 printk(KERN_NOTICE "hycapi_capi_create\n"); 744 printk(KERN_NOTICE "hycapi_capi_create\n");
745#endif 745#endif
746 if((hycapi_enable & (1 << card->myid)) == 0) { 746 if ((hycapi_enable & (1 << card->myid)) == 0) {
747 return 1; 747 return 1;
748 } 748 }
749 if (!card->hyctrlinfo) { 749 if (!card->hyctrlinfo) {
@@ -758,12 +758,12 @@ hycapi_capi_create(hysdn_card *card)
758 INIT_LIST_HEAD(&cinfo->ncci_head); 758 INIT_LIST_HEAD(&cinfo->ncci_head);
759 759
760 switch (card->brdtype) { 760 switch (card->brdtype) {
761 case BD_PCCARD: strcpy(cinfo->cardname,"HYSDN Hycard"); break; 761 case BD_PCCARD: strcpy(cinfo->cardname, "HYSDN Hycard"); break;
762 case BD_ERGO: strcpy(cinfo->cardname,"HYSDN Ergo2"); break; 762 case BD_ERGO: strcpy(cinfo->cardname, "HYSDN Ergo2"); break;
763 case BD_METRO: strcpy(cinfo->cardname,"HYSDN Metro4"); break; 763 case BD_METRO: strcpy(cinfo->cardname, "HYSDN Metro4"); break;
764 case BD_CHAMP2: strcpy(cinfo->cardname,"HYSDN Champ2"); break; 764 case BD_CHAMP2: strcpy(cinfo->cardname, "HYSDN Champ2"); break;
765 case BD_PLEXUS: strcpy(cinfo->cardname,"HYSDN Plexus30"); break; 765 case BD_PLEXUS: strcpy(cinfo->cardname, "HYSDN Plexus30"); break;
766 default: strcpy(cinfo->cardname,"HYSDN ???"); break; 766 default: strcpy(cinfo->cardname, "HYSDN ???"); break;
767 } 767 }
768 768
769 ctrl = &cinfo->capi_ctrl; 769 ctrl = &cinfo->capi_ctrl;
@@ -792,7 +792,7 @@ hycapi_capi_create(hysdn_card *card)
792 ctrl = &card->hyctrlinfo->capi_ctrl; 792 ctrl = &card->hyctrlinfo->capi_ctrl;
793 hycapi_fill_profile(card); 793 hycapi_fill_profile(card);
794 capi_ctr_ready(ctrl); 794 capi_ctr_ready(ctrl);
795 hycapi_restart_internal(ctrl); 795 hycapi_restart_internal(ctrl);
796/* ctrl->resume_output(ctrl); */ 796/* ctrl->resume_output(ctrl); */
797 } 797 }
798 return 0; 798 return 0;