aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hysdn
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
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')
-rw-r--r--drivers/isdn/hysdn/boardergo.c28
-rw-r--r--drivers/isdn/hysdn/boardergo.h30
-rw-r--r--drivers/isdn/hysdn/hycapi.c374
-rw-r--r--drivers/isdn/hysdn/hysdn_boot.c302
-rw-r--r--drivers/isdn/hysdn/hysdn_defs.h30
-rw-r--r--drivers/isdn/hysdn/hysdn_init.c4
-rw-r--r--drivers/isdn/hysdn/hysdn_net.c20
-rw-r--r--drivers/isdn/hysdn/hysdn_pof.h26
-rw-r--r--drivers/isdn/hysdn/hysdn_procconf.c10
-rw-r--r--drivers/isdn/hysdn/hysdn_proclog.c26
-rw-r--r--drivers/isdn/hysdn/hysdn_sched.c54
-rw-r--r--drivers/isdn/hysdn/ince1pc.h72
12 files changed, 488 insertions, 488 deletions
diff --git a/drivers/isdn/hysdn/boardergo.c b/drivers/isdn/hysdn/boardergo.c
index 3eb096f0ae1b..2aa2a0e08247 100644
--- a/drivers/isdn/hysdn/boardergo.c
+++ b/drivers/isdn/hysdn/boardergo.c
@@ -25,7 +25,7 @@
25#include "hysdn_defs.h" 25#include "hysdn_defs.h"
26#include "boardergo.h" 26#include "boardergo.h"
27 27
28#define byteout(addr,val) outb(val,addr) 28#define byteout(addr, val) outb(val, addr)
29#define bytein(addr) inb(addr) 29#define bytein(addr) inb(addr)
30 30
31/***************************************************/ 31/***************************************************/
@@ -73,7 +73,7 @@ ergo_interrupt(int intno, void *dev_id)
73static void 73static void
74ergo_irq_bh(struct work_struct *ugli_api) 74ergo_irq_bh(struct work_struct *ugli_api)
75{ 75{
76 hysdn_card * card = container_of(ugli_api, hysdn_card, irq_queue); 76 hysdn_card *card = container_of(ugli_api, hysdn_card, irq_queue);
77 tErgDpram *dpr; 77 tErgDpram *dpr;
78 int again; 78 int again;
79 unsigned long flags; 79 unsigned long flags;
@@ -125,7 +125,7 @@ ergo_irq_bh(struct work_struct *ugli_api)
125/* stop the card (hardware reset) and disable interrupts */ 125/* stop the card (hardware reset) and disable interrupts */
126/*********************************************************/ 126/*********************************************************/
127static void 127static void
128ergo_stopcard(hysdn_card * card) 128ergo_stopcard(hysdn_card *card)
129{ 129{
130 unsigned long flags; 130 unsigned long flags;
131 unsigned char val; 131 unsigned char val;
@@ -150,7 +150,7 @@ ergo_stopcard(hysdn_card * card)
150/* enable or disable the cards error log. The event is queued if possible */ 150/* enable or disable the cards error log. The event is queued if possible */
151/**************************************************************************/ 151/**************************************************************************/
152static void 152static void
153ergo_set_errlog_state(hysdn_card * card, int on) 153ergo_set_errlog_state(hysdn_card *card, int on)
154{ 154{
155 unsigned long flags; 155 unsigned long flags;
156 156
@@ -180,7 +180,7 @@ ergo_set_errlog_state(hysdn_card * card, int on)
180static const char TestText[36] = "This Message is filler, why read it"; 180static const char TestText[36] = "This Message is filler, why read it";
181 181
182static int 182static int
183ergo_testram(hysdn_card * card) 183ergo_testram(hysdn_card *card)
184{ 184{
185 tErgDpram *dpr = card->dpram; 185 tErgDpram *dpr = card->dpram;
186 186
@@ -212,12 +212,12 @@ ergo_testram(hysdn_card * card)
212/*****************************************************************************/ 212/*****************************************************************************/
213static int 213static int
214ergo_writebootimg(struct HYSDN_CARD *card, unsigned char *buf, 214ergo_writebootimg(struct HYSDN_CARD *card, unsigned char *buf,
215 unsigned long offs) 215 unsigned long offs)
216{ 216{
217 unsigned char *dst; 217 unsigned char *dst;
218 tErgDpram *dpram; 218 tErgDpram *dpram;
219 int cnt = (BOOT_IMG_SIZE >> 2); /* number of words to move and swap (byte order!) */ 219 int cnt = (BOOT_IMG_SIZE >> 2); /* number of words to move and swap (byte order!) */
220 220
221 if (card->debug_flags & LOG_POF_CARD) 221 if (card->debug_flags & LOG_POF_CARD)
222 hysdn_addlog(card, "ERGO: write bootldr offs=0x%lx ", offs); 222 hysdn_addlog(card, "ERGO: write bootldr offs=0x%lx ", offs);
223 223
@@ -355,7 +355,7 @@ ergo_waitpofready(struct HYSDN_CARD *card)
355 /* enable the cards interrupt */ 355 /* enable the cards interrupt */
356 byteout(card->iobase + PCI9050_INTR_REG, 356 byteout(card->iobase + PCI9050_INTR_REG,
357 bytein(card->iobase + PCI9050_INTR_REG) | 357 bytein(card->iobase + PCI9050_INTR_REG) |
358 (PCI9050_INTR_REG_ENPCI | PCI9050_INTR_REG_EN1)); 358 (PCI9050_INTR_REG_ENPCI | PCI9050_INTR_REG_EN1));
359 card->irq_enabled = 1; /* we are ready to receive interrupts */ 359 card->irq_enabled = 1; /* we are ready to receive interrupts */
360 360
361 dpr->ToPcFlag = 0; /* reset data indicator */ 361 dpr->ToPcFlag = 0; /* reset data indicator */
@@ -363,15 +363,15 @@ ergo_waitpofready(struct HYSDN_CARD *card)
363 dpr->ToPcInt = 1; /* interrupt to E1 for all cards */ 363 dpr->ToPcInt = 1; /* interrupt to E1 for all cards */
364 364
365 spin_unlock_irqrestore(&card->hysdn_lock, flags); 365 spin_unlock_irqrestore(&card->hysdn_lock, flags);
366 if ((hynet_enable & (1 << card->myid)) 366 if ((hynet_enable & (1 << card->myid))
367 && (i = hysdn_net_create(card))) 367 && (i = hysdn_net_create(card)))
368 { 368 {
369 ergo_stopcard(card); 369 ergo_stopcard(card);
370 card->state = CARD_STATE_BOOTERR; 370 card->state = CARD_STATE_BOOTERR;
371 return (i); 371 return (i);
372 } 372 }
373#ifdef CONFIG_HYSDN_CAPI 373#ifdef CONFIG_HYSDN_CAPI
374 if((i = hycapi_capi_create(card))) { 374 if ((i = hycapi_capi_create(card))) {
375 printk(KERN_WARNING "HYSDN: failed to create capi-interface.\n"); 375 printk(KERN_WARNING "HYSDN: failed to create capi-interface.\n");
376 } 376 }
377#endif /* CONFIG_HYSDN_CAPI */ 377#endif /* CONFIG_HYSDN_CAPI */
@@ -393,7 +393,7 @@ ergo_waitpofready(struct HYSDN_CARD *card)
393/* Use only during module release. */ 393/* Use only during module release. */
394/************************************************************************************/ 394/************************************************************************************/
395static void 395static void
396ergo_releasehardware(hysdn_card * card) 396ergo_releasehardware(hysdn_card *card)
397{ 397{
398 ergo_stopcard(card); /* first stop the card if not already done */ 398 ergo_stopcard(card); /* first stop the card if not already done */
399 free_irq(card->irq, card); /* release interrupt */ 399 free_irq(card->irq, card); /* release interrupt */
@@ -410,9 +410,9 @@ ergo_releasehardware(hysdn_card * card)
410/* Use only during module init. */ 410/* Use only during module init. */
411/*********************************************************************************/ 411/*********************************************************************************/
412int 412int
413ergo_inithardware(hysdn_card * card) 413ergo_inithardware(hysdn_card *card)
414{ 414{
415 if (!request_region(card->iobase + PCI9050_INTR_REG, 1, "HYSDN")) 415 if (!request_region(card->iobase + PCI9050_INTR_REG, 1, "HYSDN"))
416 return (-1); 416 return (-1);
417 if (!request_region(card->iobase + PCI9050_USER_IO, 1, "HYSDN")) { 417 if (!request_region(card->iobase + PCI9050_USER_IO, 1, "HYSDN")) {
418 release_region(card->iobase + PCI9050_INTR_REG, 1); 418 release_region(card->iobase + PCI9050_INTR_REG, 1);
diff --git a/drivers/isdn/hysdn/boardergo.h b/drivers/isdn/hysdn/boardergo.h
index c59422aa8c3f..e99bd81c4034 100644
--- a/drivers/isdn/hysdn/boardergo.h
+++ b/drivers/isdn/hysdn/boardergo.h
@@ -23,8 +23,8 @@
23 23
24/* following DPRAM layout copied from OS2-driver boarderg.h */ 24/* following DPRAM layout copied from OS2-driver boarderg.h */
25typedef struct ErgDpram_tag { 25typedef struct ErgDpram_tag {
26/*0000 */ unsigned char ToHyBuf[ERG_TO_HY_BUF_SIZE]; 26 /*0000 */ unsigned char ToHyBuf[ERG_TO_HY_BUF_SIZE];
27/*0E00 */ unsigned char ToPcBuf[ERG_TO_PC_BUF_SIZE]; 27 /*0E00 */ unsigned char ToPcBuf[ERG_TO_PC_BUF_SIZE];
28 28
29 /*1C00 */ unsigned char bSoftUart[SIZE_RSV_SOFT_UART]; 29 /*1C00 */ unsigned char bSoftUart[SIZE_RSV_SOFT_UART];
30 /* size 0x1B0 */ 30 /* size 0x1B0 */
@@ -37,22 +37,22 @@ typedef struct ErgDpram_tag {
37 /*1DB9 unsigned long ucText[ERRLOG_TEXT_SIZE]; *//* ASCIIZ of len ucTextSize-1 */ 37 /*1DB9 unsigned long ucText[ERRLOG_TEXT_SIZE]; *//* ASCIIZ of len ucTextSize-1 */
38 /*1DF0 */ 38 /*1DF0 */
39 39
40/*1DF0 */ unsigned short volatile ToHyChannel; 40 /*1DF0 */ unsigned short volatile ToHyChannel;
41/*1DF2 */ unsigned short volatile ToHySize; 41 /*1DF2 */ unsigned short volatile ToHySize;
42 /*1DF4 */ unsigned char volatile ToHyFlag; 42 /*1DF4 */ unsigned char volatile ToHyFlag;
43 /* !=0: msg for Hy waiting */ 43 /* !=0: msg for Hy waiting */
44 /*1DF5 */ unsigned char volatile ToPcFlag; 44 /*1DF5 */ unsigned char volatile ToPcFlag;
45 /* !=0: msg for PC waiting */ 45 /* !=0: msg for PC waiting */
46/*1DF6 */ unsigned short volatile ToPcChannel; 46 /*1DF6 */ unsigned short volatile ToPcChannel;
47/*1DF8 */ unsigned short volatile ToPcSize; 47 /*1DF8 */ unsigned short volatile ToPcSize;
48 /*1DFA */ unsigned char bRes1DBA[0x1E00 - 0x1DFA]; 48 /*1DFA */ unsigned char bRes1DBA[0x1E00 - 0x1DFA];
49 /* 6 bytes */ 49 /* 6 bytes */
50 50
51/*1E00 */ unsigned char bRestOfEntryTbl[0x1F00 - 0x1E00]; 51 /*1E00 */ unsigned char bRestOfEntryTbl[0x1F00 - 0x1E00];
52/*1F00 */ unsigned long TrapTable[62]; 52 /*1F00 */ unsigned long TrapTable[62];
53 /*1FF8 */ unsigned char bRes1FF8[0x1FFB - 0x1FF8]; 53 /*1FF8 */ unsigned char bRes1FF8[0x1FFB - 0x1FF8];
54 /* low part of reset vetor */ 54 /* low part of reset vetor */
55/*1FFB */ unsigned char ToPcIntMetro; 55 /*1FFB */ unsigned char ToPcIntMetro;
56 /* notes: 56 /* notes:
57 * - metro has 32-bit boot ram - accessing 57 * - metro has 32-bit boot ram - accessing
58 * ToPcInt and ToHyInt would be the same; 58 * ToPcInt and ToHyInt would be the same;
@@ -65,13 +65,13 @@ typedef struct ErgDpram_tag {
65 * so E1 side should NOT change this byte 65 * so E1 side should NOT change this byte
66 * when writing! 66 * when writing!
67 */ 67 */
68/*1FFC */ unsigned char volatile ToHyNoDpramErrLog; 68 /*1FFC */ unsigned char volatile ToHyNoDpramErrLog;
69 /* note: ToHyNoDpramErrLog is used to inform 69 /* note: ToHyNoDpramErrLog is used to inform
70 * boot loader, not to use DPRAM based 70 * boot loader, not to use DPRAM based
71 * ErrLog; when DOS driver is rewritten 71 * ErrLog; when DOS driver is rewritten
72 * this becomes obsolete 72 * this becomes obsolete
73 */ 73 */
74/*1FFD */ unsigned char bRes1FFD; 74 /*1FFD */ unsigned char bRes1FFD;
75 /*1FFE */ unsigned char ToPcInt; 75 /*1FFE */ unsigned char ToPcInt;
76 /* E1_intclear; on CHAMP2: E1_intset */ 76 /* E1_intclear; on CHAMP2: E1_intset */
77 /*1FFF */ unsigned char ToHyInt; 77 /*1FFF */ unsigned char ToHyInt;
@@ -85,16 +85,16 @@ typedef struct ErgDpram_tag {
85#define PCI9050_INTR_REG 0x4C /* Interrupt register */ 85#define PCI9050_INTR_REG 0x4C /* Interrupt register */
86#define PCI9050_USER_IO 0x51 /* User I/O register */ 86#define PCI9050_USER_IO 0x51 /* User I/O register */
87 87
88 /* bitmask for PCI9050_INTR_REG: */ 88/* bitmask for PCI9050_INTR_REG: */
89#define PCI9050_INTR_REG_EN1 0x01 /* 1= enable (def.), 0= disable */ 89#define PCI9050_INTR_REG_EN1 0x01 /* 1= enable (def.), 0= disable */
90#define PCI9050_INTR_REG_POL1 0x02 /* 1= active high (def.), 0= active low */ 90#define PCI9050_INTR_REG_POL1 0x02 /* 1= active high (def.), 0= active low */
91#define PCI9050_INTR_REG_STAT1 0x04 /* 1= intr. active, 0= intr. not active (def.) */ 91#define PCI9050_INTR_REG_STAT1 0x04 /* 1= intr. active, 0= intr. not active (def.) */
92#define PCI9050_INTR_REG_ENPCI 0x40 /* 1= PCI interrupts enable (def.) */ 92#define PCI9050_INTR_REG_ENPCI 0x40 /* 1= PCI interrupts enable (def.) */
93 93
94 /* bitmask for PCI9050_USER_IO: */ 94/* bitmask for PCI9050_USER_IO: */
95#define PCI9050_USER_IO_EN3 0x02 /* 1= disable , 0= enable (def.) */ 95#define PCI9050_USER_IO_EN3 0x02 /* 1= disable , 0= enable (def.) */
96#define PCI9050_USER_IO_DIR3 0x04 /* 1= output (def.), 0= input */ 96#define PCI9050_USER_IO_DIR3 0x04 /* 1= output (def.), 0= input */
97#define PCI9050_USER_IO_DAT3 0x08 /* 1= high (def.) , 0= low */ 97#define PCI9050_USER_IO_DAT3 0x08 /* 1= high (def.) , 0= low */
98 98
99#define PCI9050_E1_RESET ( PCI9050_USER_IO_DIR3) /* 0x04 */ 99#define PCI9050_E1_RESET (PCI9050_USER_IO_DIR3) /* 0x04 */
100#define PCI9050_E1_RUN (PCI9050_USER_IO_DAT3|PCI9050_USER_IO_DIR3) /* 0x0C */ 100#define PCI9050_E1_RUN (PCI9050_USER_IO_DAT3 | PCI9050_USER_IO_DIR3) /* 0x0C */
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;
diff --git a/drivers/isdn/hysdn/hysdn_boot.c b/drivers/isdn/hysdn/hysdn_boot.c
index 4f541ef14f9e..eda4741e3f2f 100644
--- a/drivers/isdn/hysdn/hysdn_boot.c
+++ b/drivers/isdn/hysdn/hysdn_boot.c
@@ -82,7 +82,7 @@ DecryptBuf(struct boot_data *boot, int cnt)
82/* id. If successful 0 is returned, a negative value shows an error. */ 82/* id. If successful 0 is returned, a negative value shows an error. */
83/********************************************************************************/ 83/********************************************************************************/
84static int 84static int
85pof_handle_data(hysdn_card * card, int datlen) 85pof_handle_data(hysdn_card *card, int datlen)
86{ 86{
87 struct boot_data *boot = card->boot; /* pointer to boot specific data */ 87 struct boot_data *boot = card->boot; /* pointer to boot specific data */
88 long l; 88 long l;
@@ -92,71 +92,71 @@ pof_handle_data(hysdn_card * card, int datlen)
92 /* handle the different record types */ 92 /* handle the different record types */
93 switch (boot->pof_recid) { 93 switch (boot->pof_recid) {
94 94
95 case TAG_TIMESTMP: 95 case TAG_TIMESTMP:
96 if (card->debug_flags & LOG_POF_RECORD) 96 if (card->debug_flags & LOG_POF_RECORD)
97 hysdn_addlog(card, "POF created %s", boot->buf.PofTime.DateTimeText); 97 hysdn_addlog(card, "POF created %s", boot->buf.PofTime.DateTimeText);
98 break; 98 break;
99
100 case TAG_CBOOTDTA:
101 DecryptBuf(boot, datlen); /* we need to encrypt the buffer */
102 case TAG_BOOTDTA:
103 if (card->debug_flags & LOG_POF_RECORD)
104 hysdn_addlog(card, "POF got %s len=%d offs=0x%lx",
105 (boot->pof_recid == TAG_CBOOTDTA) ? "CBOOTDATA" : "BOOTDTA",
106 datlen, boot->pof_recoffset);
107
108 if (boot->pof_reclen != POF_BOOT_LOADER_TOTAL_SIZE) {
109 boot->last_error = EPOF_BAD_IMG_SIZE; /* invalid length */
110 return (boot->last_error);
111 }
112 imgp = boot->buf.BootBuf; /* start of buffer */
113 img_len = datlen; /* maximum length to transfer */
114
115 l = POF_BOOT_LOADER_OFF_IN_PAGE -
116 (boot->pof_recoffset & (POF_BOOT_LOADER_PAGE_SIZE - 1));
117 if (l > 0) {
118 /* buffer needs to be truncated */
119 imgp += l; /* advance pointer */
120 img_len -= l; /* adjust len */
121 }
122 /* at this point no special handling for data wrapping over buffer */
123 /* is necessary, because the boot image always will be adjusted to */
124 /* match a page boundary inside the buffer. */
125 /* The buffer for the boot image on the card is filled in 2 cycles */
126 /* first the 1024 hi-words are put in the buffer, then the low 1024 */
127 /* word are handled in the same way with different offset. */
128
129 if (img_len > 0) {
130 /* data available for copy */
131 if ((boot->last_error =
132 card->writebootimg(card, imgp,
133 (boot->pof_recoffset > POF_BOOT_LOADER_PAGE_SIZE) ? 2 : 0)) < 0)
134 return (boot->last_error);
135 }
136 break; /* end of case boot image hi/lo */
99 137
100 case TAG_CBOOTDTA: 138 case TAG_CABSDATA:
101 DecryptBuf(boot, datlen); /* we need to encrypt the buffer */ 139 DecryptBuf(boot, datlen); /* we need to encrypt the buffer */
102 case TAG_BOOTDTA: 140 case TAG_ABSDATA:
103 if (card->debug_flags & LOG_POF_RECORD) 141 if (card->debug_flags & LOG_POF_RECORD)
104 hysdn_addlog(card, "POF got %s len=%d offs=0x%lx", 142 hysdn_addlog(card, "POF got %s len=%d offs=0x%lx",
105 (boot->pof_recid == TAG_CBOOTDTA) ? "CBOOTDATA" : "BOOTDTA", 143 (boot->pof_recid == TAG_CABSDATA) ? "CABSDATA" : "ABSDATA",
106 datlen, boot->pof_recoffset); 144 datlen, boot->pof_recoffset);
107 145
108 if (boot->pof_reclen != POF_BOOT_LOADER_TOTAL_SIZE) { 146 if ((boot->last_error = card->writebootseq(card, boot->buf.BootBuf, datlen)) < 0)
109 boot->last_error = EPOF_BAD_IMG_SIZE; /* invalid length */ 147 return (boot->last_error); /* error writing data */
110 return (boot->last_error);
111 }
112 imgp = boot->buf.BootBuf; /* start of buffer */
113 img_len = datlen; /* maximum length to transfer */
114
115 l = POF_BOOT_LOADER_OFF_IN_PAGE -
116 (boot->pof_recoffset & (POF_BOOT_LOADER_PAGE_SIZE - 1));
117 if (l > 0) {
118 /* buffer needs to be truncated */
119 imgp += l; /* advance pointer */
120 img_len -= l; /* adjust len */
121 }
122 /* at this point no special handling for data wrapping over buffer */
123 /* is necessary, because the boot image always will be adjusted to */
124 /* match a page boundary inside the buffer. */
125 /* The buffer for the boot image on the card is filled in 2 cycles */
126 /* first the 1024 hi-words are put in the buffer, then the low 1024 */
127 /* word are handled in the same way with different offset. */
128
129 if (img_len > 0) {
130 /* data available for copy */
131 if ((boot->last_error =
132 card->writebootimg(card, imgp,
133 (boot->pof_recoffset > POF_BOOT_LOADER_PAGE_SIZE) ? 2 : 0)) < 0)
134 return (boot->last_error);
135 }
136 break; /* end of case boot image hi/lo */
137
138 case TAG_CABSDATA:
139 DecryptBuf(boot, datlen); /* we need to encrypt the buffer */
140 case TAG_ABSDATA:
141 if (card->debug_flags & LOG_POF_RECORD)
142 hysdn_addlog(card, "POF got %s len=%d offs=0x%lx",
143 (boot->pof_recid == TAG_CABSDATA) ? "CABSDATA" : "ABSDATA",
144 datlen, boot->pof_recoffset);
145
146 if ((boot->last_error = card->writebootseq(card, boot->buf.BootBuf, datlen)) < 0)
147 return (boot->last_error); /* error writing data */
148
149 if (boot->pof_recoffset + datlen >= boot->pof_reclen)
150 return (card->waitpofready(card)); /* data completely spooled, wait for ready */
151
152 break; /* end of case boot seq data */
153 148
154 default: 149 if (boot->pof_recoffset + datlen >= boot->pof_reclen)
155 if (card->debug_flags & LOG_POF_RECORD) 150 return (card->waitpofready(card)); /* data completely spooled, wait for ready */
156 hysdn_addlog(card, "POF got data(id=0x%lx) len=%d offs=0x%lx", boot->pof_recid, 151
157 datlen, boot->pof_recoffset); 152 break; /* end of case boot seq data */
153
154 default:
155 if (card->debug_flags & LOG_POF_RECORD)
156 hysdn_addlog(card, "POF got data(id=0x%lx) len=%d offs=0x%lx", boot->pof_recid,
157 datlen, boot->pof_recoffset);
158 158
159 break; /* simply skip record */ 159 break; /* simply skip record */
160 } /* switch boot->pof_recid */ 160 } /* switch boot->pof_recid */
161 161
162 return (0); 162 return (0);
@@ -171,7 +171,7 @@ pof_handle_data(hysdn_card * card, int datlen)
171/* occurred and booting must be aborted. */ 171/* occurred and booting must be aborted. */
172/******************************************************************************/ 172/******************************************************************************/
173int 173int
174pof_write_buffer(hysdn_card * card, int datlen) 174pof_write_buffer(hysdn_card *card, int datlen)
175{ 175{
176 struct boot_data *boot = card->boot; /* pointer to boot specific data */ 176 struct boot_data *boot = card->boot; /* pointer to boot specific data */
177 177
@@ -184,77 +184,77 @@ pof_write_buffer(hysdn_card * card, int datlen)
184 hysdn_addlog(card, "POF write: got %d bytes ", datlen); 184 hysdn_addlog(card, "POF write: got %d bytes ", datlen);
185 185
186 switch (boot->pof_state) { 186 switch (boot->pof_state) {
187 case POF_READ_FILE_HEAD: 187 case POF_READ_FILE_HEAD:
188 if (card->debug_flags & LOG_POF_WRITE) 188 if (card->debug_flags & LOG_POF_WRITE)
189 hysdn_addlog(card, "POF write: checking file header"); 189 hysdn_addlog(card, "POF write: checking file header");
190 190
191 if (datlen != sizeof(tPofFileHdr)) { 191 if (datlen != sizeof(tPofFileHdr)) {
192 boot->last_error = -EPOF_INTERNAL; 192 boot->last_error = -EPOF_INTERNAL;
193 break; 193 break;
194 } 194 }
195 if (boot->buf.PofFileHdr.Magic != TAGFILEMAGIC) { 195 if (boot->buf.PofFileHdr.Magic != TAGFILEMAGIC) {
196 boot->last_error = -EPOF_BAD_MAGIC; 196 boot->last_error = -EPOF_BAD_MAGIC;
197 break; 197 break;
198 } 198 }
199 /* Setup the new state and vars */ 199 /* Setup the new state and vars */
200 boot->Nrecs = (unsigned short)(boot->buf.PofFileHdr.N_PofRecs); /* limited to 65535 */ 200 boot->Nrecs = (unsigned short)(boot->buf.PofFileHdr.N_PofRecs); /* limited to 65535 */
201 boot->pof_state = POF_READ_TAG_HEAD; /* now start with single tags */ 201 boot->pof_state = POF_READ_TAG_HEAD; /* now start with single tags */
202 boot->last_error = sizeof(tPofRecHdr); /* new length */ 202 boot->last_error = sizeof(tPofRecHdr); /* new length */
203 break;
204
205 case POF_READ_TAG_HEAD:
206 if (card->debug_flags & LOG_POF_WRITE)
207 hysdn_addlog(card, "POF write: checking tag header");
208
209 if (datlen != sizeof(tPofRecHdr)) {
210 boot->last_error = -EPOF_INTERNAL;
203 break; 211 break;
212 }
213 boot->pof_recid = boot->buf.PofRecHdr.PofRecId; /* actual pof recid */
214 boot->pof_reclen = boot->buf.PofRecHdr.PofRecDataLen; /* total length */
215 boot->pof_recoffset = 0; /* no starting offset */
204 216
205 case POF_READ_TAG_HEAD: 217 if (card->debug_flags & LOG_POF_RECORD)
206 if (card->debug_flags & LOG_POF_WRITE) 218 hysdn_addlog(card, "POF: got record id=0x%lx length=%ld ",
207 hysdn_addlog(card, "POF write: checking tag header"); 219 boot->pof_recid, boot->pof_reclen);
208
209 if (datlen != sizeof(tPofRecHdr)) {
210 boot->last_error = -EPOF_INTERNAL;
211 break;
212 }
213 boot->pof_recid = boot->buf.PofRecHdr.PofRecId; /* actual pof recid */
214 boot->pof_reclen = boot->buf.PofRecHdr.PofRecDataLen; /* total length */
215 boot->pof_recoffset = 0; /* no starting offset */
216
217 if (card->debug_flags & LOG_POF_RECORD)
218 hysdn_addlog(card, "POF: got record id=0x%lx length=%ld ",
219 boot->pof_recid, boot->pof_reclen);
220
221 boot->pof_state = POF_READ_TAG_DATA; /* now start with tag data */
222 if (boot->pof_reclen < BOOT_BUF_SIZE)
223 boot->last_error = boot->pof_reclen; /* limit size */
224 else
225 boot->last_error = BOOT_BUF_SIZE; /* maximum */
226 220
227 if (!boot->last_error) { /* no data inside record */ 221 boot->pof_state = POF_READ_TAG_DATA; /* now start with tag data */
228 boot->pof_state = POF_READ_TAG_HEAD; /* now start with single tags */ 222 if (boot->pof_reclen < BOOT_BUF_SIZE)
229 boot->last_error = sizeof(tPofRecHdr); /* new length */ 223 boot->last_error = boot->pof_reclen; /* limit size */
230 } 224 else
231 break; 225 boot->last_error = BOOT_BUF_SIZE; /* maximum */
232 226
233 case POF_READ_TAG_DATA: 227 if (!boot->last_error) { /* no data inside record */
234 if (card->debug_flags & LOG_POF_WRITE) 228 boot->pof_state = POF_READ_TAG_HEAD; /* now start with single tags */
235 hysdn_addlog(card, "POF write: getting tag data"); 229 boot->last_error = sizeof(tPofRecHdr); /* new length */
236 230 }
237 if (datlen != boot->last_error) { 231 break;
238 boot->last_error = -EPOF_INTERNAL;
239 break;
240 }
241 if ((boot->last_error = pof_handle_data(card, datlen)) < 0)
242 return (boot->last_error); /* an error occurred */
243 boot->pof_recoffset += datlen;
244 if (boot->pof_recoffset >= boot->pof_reclen) {
245 boot->pof_state = POF_READ_TAG_HEAD; /* now start with single tags */
246 boot->last_error = sizeof(tPofRecHdr); /* new length */
247 } else {
248 if (boot->pof_reclen - boot->pof_recoffset < BOOT_BUF_SIZE)
249 boot->last_error = boot->pof_reclen - boot->pof_recoffset; /* limit size */
250 else
251 boot->last_error = BOOT_BUF_SIZE; /* maximum */
252 }
253 break;
254 232
255 default: 233 case POF_READ_TAG_DATA:
256 boot->last_error = -EPOF_INTERNAL; /* unknown state */ 234 if (card->debug_flags & LOG_POF_WRITE)
235 hysdn_addlog(card, "POF write: getting tag data");
236
237 if (datlen != boot->last_error) {
238 boot->last_error = -EPOF_INTERNAL;
257 break; 239 break;
240 }
241 if ((boot->last_error = pof_handle_data(card, datlen)) < 0)
242 return (boot->last_error); /* an error occurred */
243 boot->pof_recoffset += datlen;
244 if (boot->pof_recoffset >= boot->pof_reclen) {
245 boot->pof_state = POF_READ_TAG_HEAD; /* now start with single tags */
246 boot->last_error = sizeof(tPofRecHdr); /* new length */
247 } else {
248 if (boot->pof_reclen - boot->pof_recoffset < BOOT_BUF_SIZE)
249 boot->last_error = boot->pof_reclen - boot->pof_recoffset; /* limit size */
250 else
251 boot->last_error = BOOT_BUF_SIZE; /* maximum */
252 }
253 break;
254
255 default:
256 boot->last_error = -EPOF_INTERNAL; /* unknown state */
257 break;
258 } /* switch (boot->pof_state) */ 258 } /* switch (boot->pof_state) */
259 259
260 return (boot->last_error); 260 return (boot->last_error);
@@ -268,7 +268,7 @@ pof_write_buffer(hysdn_card * card, int datlen)
268/* occurred. Additionally the pointer to the buffer data area is set on success */ 268/* occurred. Additionally the pointer to the buffer data area is set on success */
269/*******************************************************************************/ 269/*******************************************************************************/
270int 270int
271pof_write_open(hysdn_card * card, unsigned char **bufp) 271pof_write_open(hysdn_card *card, unsigned char **bufp)
272{ 272{
273 struct boot_data *boot; /* pointer to boot specific data */ 273 struct boot_data *boot; /* pointer to boot specific data */
274 274
@@ -310,7 +310,7 @@ pof_write_open(hysdn_card * card, unsigned char **bufp)
310/* The return value must be 0 if everything has happened as desired. */ 310/* The return value must be 0 if everything has happened as desired. */
311/********************************************************************************/ 311/********************************************************************************/
312int 312int
313pof_write_close(hysdn_card * card) 313pof_write_close(hysdn_card *card)
314{ 314{
315 struct boot_data *boot = card->boot; /* pointer to boot specific data */ 315 struct boot_data *boot = card->boot; /* pointer to boot specific data */
316 316
@@ -367,27 +367,27 @@ EvalSysrTokData(hysdn_card *card, unsigned char *cp, int len)
367 return (1); 367 return (1);
368 } 368 }
369 switch (*cp) { 369 switch (*cp) {
370 case SYSR_TOK_B_CHAN: /* 1 */ 370 case SYSR_TOK_B_CHAN: /* 1 */
371 if (*(cp + 1) != 1) 371 if (*(cp + 1) != 1)
372 return (1); /* length invalid */ 372 return (1); /* length invalid */
373 card->bchans = *(cp + 2); 373 card->bchans = *(cp + 2);
374 break; 374 break;
375 375
376 case SYSR_TOK_FAX_CHAN: /* 2 */ 376 case SYSR_TOK_FAX_CHAN: /* 2 */
377 if (*(cp + 1) != 1) 377 if (*(cp + 1) != 1)
378 return (1); /* length invalid */ 378 return (1); /* length invalid */
379 card->faxchans = *(cp + 2); 379 card->faxchans = *(cp + 2);
380 break; 380 break;
381 381
382 case SYSR_TOK_MAC_ADDR: /* 3 */ 382 case SYSR_TOK_MAC_ADDR: /* 3 */
383 if (*(cp + 1) != 6) 383 if (*(cp + 1) != 6)
384 return (1); /* length invalid */ 384 return (1); /* length invalid */
385 memcpy(card->mac_addr, cp + 2, 6); 385 memcpy(card->mac_addr, cp + 2, 6);
386 break; 386 break;
387 387
388 default: 388 default:
389 hysdn_addlog(card, "unknown token 0x%02x length %d", *cp, *(cp + 1)); 389 hysdn_addlog(card, "unknown token 0x%02x length %d", *cp, *(cp + 1));
390 break; 390 break;
391 } 391 }
392 len -= (*(cp + 1) + 2); /* adjust len */ 392 len -= (*(cp + 1) + 2); /* adjust len */
393 cp += (*(cp + 1) + 2); /* and pointer */ 393 cp += (*(cp + 1) + 2); /* and pointer */
diff --git a/drivers/isdn/hysdn/hysdn_defs.h b/drivers/isdn/hysdn/hysdn_defs.h
index 18b801ad97a4..cdac46a21692 100644
--- a/drivers/isdn/hysdn/hysdn_defs.h
+++ b/drivers/isdn/hysdn/hysdn_defs.h
@@ -41,7 +41,7 @@
41 41
42#define B1_PROT_64KBIT_HDLC 0x0001 42#define B1_PROT_64KBIT_HDLC 0x0001
43#define B1_PROT_64KBIT_TRANSPARENT 0x0002 43#define B1_PROT_64KBIT_TRANSPARENT 0x0002
44#define B1_PROT_V110_ASYNCH 0x0004 44#define B1_PROT_V110_ASYNCH 0x0004
45#define B1_PROT_V110_SYNCH 0x0008 45#define B1_PROT_V110_SYNCH 0x0008
46#define B1_PROT_T30 0x0010 46#define B1_PROT_T30 0x0010
47#define B1_PROT_64KBIT_INV_HDLC 0x0020 47#define B1_PROT_64KBIT_INV_HDLC 0x0020
@@ -199,14 +199,14 @@ typedef struct HYSDN_CARD {
199 char *version[HYSDN_MAXVERSION]; 199 char *version[HYSDN_MAXVERSION];
200 200
201 char infobuf[128]; /* for function procinfo */ 201 char infobuf[128]; /* for function procinfo */
202 202
203 struct HYSDN_CARD *card; 203 struct HYSDN_CARD *card;
204 struct capi_ctr capi_ctrl; 204 struct capi_ctr capi_ctrl;
205 struct sk_buff *skbs[HYSDN_MAX_CAPI_SKB]; 205 struct sk_buff *skbs[HYSDN_MAX_CAPI_SKB];
206 int in_idx, out_idx; /* indexes to buffer ring */ 206 int in_idx, out_idx; /* indexes to buffer ring */
207 int sk_count; /* number of buffers currently in ring */ 207 int sk_count; /* number of buffers currently in ring */
208 struct sk_buff *tx_skb; /* buffer for tx operation */ 208 struct sk_buff *tx_skb; /* buffer for tx operation */
209 209
210 struct list_head ncci_head; 210 struct list_head ncci_head;
211 } *hyctrlinfo; 211 } *hyctrlinfo;
212#endif /* CONFIG_HYSDN_CAPI */ 212#endif /* CONFIG_HYSDN_CAPI */
@@ -235,11 +235,11 @@ extern void hysdn_procconf_release(void); /* deinit proc config filesys */
235/* hysdn_proclog.c */ 235/* hysdn_proclog.c */
236extern int hysdn_proclog_init(hysdn_card *); /* init proc log entry */ 236extern int hysdn_proclog_init(hysdn_card *); /* init proc log entry */
237extern void hysdn_proclog_release(hysdn_card *); /* deinit proc log entry */ 237extern void hysdn_proclog_release(hysdn_card *); /* deinit proc log entry */
238extern void hysdn_addlog(hysdn_card *, char *,...); /* output data to log */ 238extern void hysdn_addlog(hysdn_card *, char *, ...); /* output data to log */
239extern void hysdn_card_errlog(hysdn_card *, tErrLogEntry *, int); /* output card log */ 239extern void hysdn_card_errlog(hysdn_card *, tErrLogEntry *, int); /* output card log */
240 240
241/* boardergo.c */ 241/* boardergo.c */
242extern int ergo_inithardware(hysdn_card * card); /* get hardware -> module init */ 242extern int ergo_inithardware(hysdn_card *card); /* get hardware -> module init */
243 243
244/* hysdn_boot.c */ 244/* hysdn_boot.c */
245extern int pof_write_close(hysdn_card *); /* close proc file after writing pof */ 245extern int pof_write_close(hysdn_card *); /* close proc file after writing pof */
@@ -249,31 +249,31 @@ extern int EvalSysrTokData(hysdn_card *, unsigned char *, int); /* Check Sysrea
249 249
250/* hysdn_sched.c */ 250/* hysdn_sched.c */
251extern int hysdn_sched_tx(hysdn_card *, unsigned char *, 251extern int hysdn_sched_tx(hysdn_card *, unsigned char *,
252 unsigned short volatile *, unsigned short volatile *, 252 unsigned short volatile *, unsigned short volatile *,
253 unsigned short); 253 unsigned short);
254extern int hysdn_sched_rx(hysdn_card *, unsigned char *, unsigned short, 254extern int hysdn_sched_rx(hysdn_card *, unsigned char *, unsigned short,
255 unsigned short); 255 unsigned short);
256extern int hysdn_tx_cfgline(hysdn_card *, unsigned char *, 256extern int hysdn_tx_cfgline(hysdn_card *, unsigned char *,
257 unsigned short); /* send one cfg line */ 257 unsigned short); /* send one cfg line */
258 258
259/* hysdn_net.c */ 259/* hysdn_net.c */
260extern unsigned int hynet_enable; 260extern unsigned int hynet_enable;
261extern int hysdn_net_create(hysdn_card *); /* create a new net device */ 261extern int hysdn_net_create(hysdn_card *); /* create a new net device */
262extern int hysdn_net_release(hysdn_card *); /* delete the device */ 262extern int hysdn_net_release(hysdn_card *); /* delete the device */
263extern char *hysdn_net_getname(hysdn_card *); /* get name of net interface */ 263extern char *hysdn_net_getname(hysdn_card *); /* get name of net interface */
264extern void hysdn_tx_netack(hysdn_card *); /* acknowledge a packet tx */ 264extern void hysdn_tx_netack(hysdn_card *); /* acknowledge a packet tx */
265extern struct sk_buff *hysdn_tx_netget(hysdn_card *); /* get next network packet */ 265extern struct sk_buff *hysdn_tx_netget(hysdn_card *); /* get next network packet */
266extern void hysdn_rx_netpkt(hysdn_card *, unsigned char *, 266extern void hysdn_rx_netpkt(hysdn_card *, unsigned char *,
267 unsigned short); /* rxed packet from network */ 267 unsigned short); /* rxed packet from network */
268 268
269#ifdef CONFIG_HYSDN_CAPI 269#ifdef CONFIG_HYSDN_CAPI
270extern unsigned int hycapi_enable; 270extern unsigned int hycapi_enable;
271extern int hycapi_capi_create(hysdn_card *); /* create a new capi device */ 271extern int hycapi_capi_create(hysdn_card *); /* create a new capi device */
272extern int hycapi_capi_release(hysdn_card *); /* delete the device */ 272extern int hycapi_capi_release(hysdn_card *); /* delete the device */
273extern int hycapi_capi_stop(hysdn_card *card); /* suspend */ 273extern int hycapi_capi_stop(hysdn_card *card); /* suspend */
274extern void hycapi_rx_capipkt(hysdn_card * card, unsigned char * buf, 274extern void hycapi_rx_capipkt(hysdn_card *card, unsigned char *buf,
275 unsigned short len); 275 unsigned short len);
276extern void hycapi_tx_capiack(hysdn_card * card); 276extern void hycapi_tx_capiack(hysdn_card *card);
277extern struct sk_buff *hycapi_tx_capiget(hysdn_card *card); 277extern struct sk_buff *hycapi_tx_capiget(hysdn_card *card);
278extern int hycapi_init(void); 278extern int hycapi_init(void);
279extern void hycapi_cleanup(void); 279extern void hycapi_cleanup(void);
diff --git a/drivers/isdn/hysdn/hysdn_init.c b/drivers/isdn/hysdn/hysdn_init.c
index 0ab42ace1692..b61bbb4bb52b 100644
--- a/drivers/isdn/hysdn/hysdn_init.c
+++ b/drivers/isdn/hysdn/hysdn_init.c
@@ -169,8 +169,8 @@ hysdn_init(void)
169 hysdn_have_procfs = 1; 169 hysdn_have_procfs = 1;
170 170
171#ifdef CONFIG_HYSDN_CAPI 171#ifdef CONFIG_HYSDN_CAPI
172 if(cardmax > 0) { 172 if (cardmax > 0) {
173 if(hycapi_init()) { 173 if (hycapi_init()) {
174 printk(KERN_ERR "HYCAPI: init failed\n"); 174 printk(KERN_ERR "HYCAPI: init failed\n");
175 175
176 if (hysdn_have_procfs) 176 if (hysdn_have_procfs)
diff --git a/drivers/isdn/hysdn/hysdn_net.c b/drivers/isdn/hysdn/hysdn_net.c
index 11f2cce26005..a0efb4cefa1c 100644
--- a/drivers/isdn/hysdn/hysdn_net.c
+++ b/drivers/isdn/hysdn/hysdn_net.c
@@ -23,7 +23,7 @@
23 23
24#include "hysdn_defs.h" 24#include "hysdn_defs.h"
25 25
26unsigned int hynet_enable = 0xffffffff; 26unsigned int hynet_enable = 0xffffffff;
27module_param(hynet_enable, uint, 0); 27module_param(hynet_enable, uint, 0);
28 28
29#define MAX_SKB_BUFFERS 20 /* number of buffers for keeping TX-data */ 29#define MAX_SKB_BUFFERS 20 /* number of buffers for keeping TX-data */
@@ -155,7 +155,7 @@ net_send_packet(struct sk_buff *skb, struct net_device *dev)
155/* completion */ 155/* completion */
156/***********************************************************************/ 156/***********************************************************************/
157void 157void
158hysdn_tx_netack(hysdn_card * card) 158hysdn_tx_netack(hysdn_card *card)
159{ 159{
160 struct net_local *lp = card->netif; 160 struct net_local *lp = card->netif;
161 161
@@ -181,7 +181,7 @@ hysdn_tx_netack(hysdn_card * card)
181/* we got a packet from the network, go and queue it */ 181/* we got a packet from the network, go and queue it */
182/*****************************************************/ 182/*****************************************************/
183void 183void
184hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len) 184hysdn_rx_netpkt(hysdn_card *card, unsigned char *buf, unsigned short len)
185{ 185{
186 struct net_local *lp = card->netif; 186 struct net_local *lp = card->netif;
187 struct net_device *dev; 187 struct net_device *dev;
@@ -215,7 +215,7 @@ hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len)
215/* return the pointer to a network packet to be send */ 215/* return the pointer to a network packet to be send */
216/*****************************************************/ 216/*****************************************************/
217struct sk_buff * 217struct sk_buff *
218hysdn_tx_netget(hysdn_card * card) 218hysdn_tx_netget(hysdn_card *card)
219{ 219{
220 struct net_local *lp = card->netif; 220 struct net_local *lp = card->netif;
221 221
@@ -229,11 +229,11 @@ hysdn_tx_netget(hysdn_card * card)
229} /* hysdn_tx_netget */ 229} /* hysdn_tx_netget */
230 230
231static const struct net_device_ops hysdn_netdev_ops = { 231static const struct net_device_ops hysdn_netdev_ops = {
232 .ndo_open = net_open, 232 .ndo_open = net_open,
233 .ndo_stop = net_close, 233 .ndo_stop = net_close,
234 .ndo_start_xmit = net_send_packet, 234 .ndo_start_xmit = net_send_packet,
235 .ndo_change_mtu = eth_change_mtu, 235 .ndo_change_mtu = eth_change_mtu,
236 .ndo_set_mac_address = eth_mac_addr, 236 .ndo_set_mac_address = eth_mac_addr,
237 .ndo_validate_addr = eth_validate_addr, 237 .ndo_validate_addr = eth_validate_addr,
238}; 238};
239 239
@@ -244,13 +244,13 @@ static const struct net_device_ops hysdn_netdev_ops = {
244/* 0 announces success, else a negative error code will be returned. */ 244/* 0 announces success, else a negative error code will be returned. */
245/*****************************************************************************/ 245/*****************************************************************************/
246int 246int
247hysdn_net_create(hysdn_card * card) 247hysdn_net_create(hysdn_card *card)
248{ 248{
249 struct net_device *dev; 249 struct net_device *dev;
250 int i; 250 int i;
251 struct net_local *lp; 251 struct net_local *lp;
252 252
253 if(!card) { 253 if (!card) {
254 printk(KERN_WARNING "No card-pt in hysdn_net_create!\n"); 254 printk(KERN_WARNING "No card-pt in hysdn_net_create!\n");
255 return (-ENOMEM); 255 return (-ENOMEM);
256 } 256 }
@@ -291,7 +291,7 @@ hysdn_net_create(hysdn_card * card)
291/* value 0 announces success, else a negative error code will be returned. */ 291/* value 0 announces success, else a negative error code will be returned. */
292/***************************************************************************/ 292/***************************************************************************/
293int 293int
294hysdn_net_release(hysdn_card * card) 294hysdn_net_release(hysdn_card *card)
295{ 295{
296 struct net_device *dev = card->netif; 296 struct net_device *dev = card->netif;
297 297
@@ -316,7 +316,7 @@ hysdn_net_release(hysdn_card * card)
316/* if the interface is not existing, a "-" is returned. */ 316/* if the interface is not existing, a "-" is returned. */
317/*****************************************************************************/ 317/*****************************************************************************/
318char * 318char *
319hysdn_net_getname(hysdn_card * card) 319hysdn_net_getname(hysdn_card *card)
320{ 320{
321 struct net_device *dev = card->netif; 321 struct net_device *dev = card->netif;
322 322
diff --git a/drivers/isdn/hysdn/hysdn_pof.h b/drivers/isdn/hysdn/hysdn_pof.h
index 3a72b908900f..f63f5fa59d7e 100644
--- a/drivers/isdn/hysdn/hysdn_pof.h
+++ b/drivers/isdn/hysdn/hysdn_pof.h
@@ -16,9 +16,9 @@
16#define BOOT_BUF_SIZE 0x1000 /* =4096, maybe moved to other h file */ 16#define BOOT_BUF_SIZE 0x1000 /* =4096, maybe moved to other h file */
17#define CRYPT_FEEDTERM 0x8142 17#define CRYPT_FEEDTERM 0x8142
18#define CRYPT_STARTTERM 0x81a5 18#define CRYPT_STARTTERM 0x81a5
19 /* max. timeout time in seconds 19/* max. timeout time in seconds
20 * from end of booting to POF is ready 20 * from end of booting to POF is ready
21 */ 21 */
22#define POF_READY_TIME_OUT_SEC 10 22#define POF_READY_TIME_OUT_SEC 10
23 23
24/**********************************/ 24/**********************************/
@@ -36,38 +36,38 @@
36 */ 36 */
37 37
38#define POF_BOOT_LOADER_PAGE_SIZE 0x4000 /* =16384U */ 38#define POF_BOOT_LOADER_PAGE_SIZE 0x4000 /* =16384U */
39#define POF_BOOT_LOADER_TOTAL_SIZE (2U*POF_BOOT_LOADER_PAGE_SIZE) 39#define POF_BOOT_LOADER_TOTAL_SIZE (2U * POF_BOOT_LOADER_PAGE_SIZE)
40 40
41#define POF_BOOT_LOADER_CODE_SIZE 0x0800 /* =2KB =2048U */ 41#define POF_BOOT_LOADER_CODE_SIZE 0x0800 /* =2KB =2048U */
42 42
43 /* offset in boot page, where loader code may start */ 43/* offset in boot page, where loader code may start */
44 /* =0x3800= 14336U */ 44/* =0x3800= 14336U */
45#define POF_BOOT_LOADER_OFF_IN_PAGE (POF_BOOT_LOADER_PAGE_SIZE-POF_BOOT_LOADER_CODE_SIZE) 45#define POF_BOOT_LOADER_OFF_IN_PAGE (POF_BOOT_LOADER_PAGE_SIZE-POF_BOOT_LOADER_CODE_SIZE)
46 46
47 47
48/*--------------------------------------POF file record structs------------*/ 48/*--------------------------------------POF file record structs------------*/
49typedef struct PofFileHdr_tag { /* Pof file header */ 49typedef struct PofFileHdr_tag { /* Pof file header */
50/*00 */ unsigned long Magic __attribute__((packed)); 50 /*00 */ unsigned long Magic __attribute__((packed));
51/*04 */ unsigned long N_PofRecs __attribute__((packed)); 51 /*04 */ unsigned long N_PofRecs __attribute__((packed));
52/*08 */ 52/*08 */
53} tPofFileHdr; 53} tPofFileHdr;
54 54
55typedef struct PofRecHdr_tag { /* Pof record header */ 55typedef struct PofRecHdr_tag { /* Pof record header */
56/*00 */ unsigned short PofRecId __attribute__((packed)); 56 /*00 */ unsigned short PofRecId __attribute__((packed));
57/*02 */ unsigned long PofRecDataLen __attribute__((packed)); 57 /*02 */ unsigned long PofRecDataLen __attribute__((packed));
58/*06 */ 58/*06 */
59} tPofRecHdr; 59} tPofRecHdr;
60 60
61typedef struct PofTimeStamp_tag { 61typedef struct PofTimeStamp_tag {
62/*00 */ unsigned long UnixTime __attribute__((packed)); 62 /*00 */ unsigned long UnixTime __attribute__((packed));
63 /*04 */ unsigned char DateTimeText[0x28]; 63 /*04 */ unsigned char DateTimeText[0x28];
64 /* =40 */ 64 /* =40 */
65/*2C */ 65/*2C */
66} tPofTimeStamp; 66} tPofTimeStamp;
67 67
68 /* tPofFileHdr.Magic value: */ 68/* tPofFileHdr.Magic value: */
69#define TAGFILEMAGIC 0x464F501AUL 69#define TAGFILEMAGIC 0x464F501AUL
70 /* tPofRecHdr.PofRecId values: */ 70/* tPofRecHdr.PofRecId values: */
71#define TAG_ABSDATA 0x1000 /* abs. data */ 71#define TAG_ABSDATA 0x1000 /* abs. data */
72#define TAG_BOOTDTA 0x1001 /* boot data */ 72#define TAG_BOOTDTA 0x1001 /* boot data */
73#define TAG_COMMENT 0x0020 73#define TAG_COMMENT 0x0020
diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c
index 5fe83bd42061..8023d2510fba 100644
--- a/drivers/isdn/hysdn/hysdn_procconf.c
+++ b/drivers/isdn/hysdn/hysdn_procconf.c
@@ -91,7 +91,7 @@ process_line(struct conf_writedata *cnf)
91/* write conf file -> boot or send cfg line to card */ 91/* write conf file -> boot or send cfg line to card */
92/****************************************************/ 92/****************************************************/
93static ssize_t 93static ssize_t
94hysdn_conf_write(struct file *file, const char __user *buf, size_t count, loff_t * off) 94hysdn_conf_write(struct file *file, const char __user *buf, size_t count, loff_t *off)
95{ 95{
96 struct conf_writedata *cnf; 96 struct conf_writedata *cnf;
97 int i; 97 int i;
@@ -366,7 +366,7 @@ static const struct file_operations conf_fops =
366 .read = hysdn_conf_read, 366 .read = hysdn_conf_read,
367 .write = hysdn_conf_write, 367 .write = hysdn_conf_write,
368 .open = hysdn_conf_open, 368 .open = hysdn_conf_open,
369 .release = hysdn_conf_close, 369 .release = hysdn_conf_close,
370}; 370};
371 371
372/*****************************/ 372/*****************************/
@@ -395,9 +395,9 @@ hysdn_procconf_init(void)
395 395
396 sprintf(conf_name, "%s%d", PROC_CONF_BASENAME, card->myid); 396 sprintf(conf_name, "%s%d", PROC_CONF_BASENAME, card->myid);
397 if ((card->procconf = (void *) proc_create(conf_name, 397 if ((card->procconf = (void *) proc_create(conf_name,
398 S_IFREG | S_IRUGO | S_IWUSR, 398 S_IFREG | S_IRUGO | S_IWUSR,
399 hysdn_proc_entry, 399 hysdn_proc_entry,
400 &conf_fops)) != NULL) { 400 &conf_fops)) != NULL) {
401 hysdn_proclog_init(card); /* init the log file entry */ 401 hysdn_proclog_init(card); /* init the log file entry */
402 } 402 }
403 card = card->next; /* next entry */ 403 card = card->next; /* next entry */
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c
index 236cc7dadfd0..ba91333e3e41 100644
--- a/drivers/isdn/hysdn/hysdn_proclog.c
+++ b/drivers/isdn/hysdn/hysdn_proclog.c
@@ -24,7 +24,7 @@
24extern struct proc_dir_entry *hysdn_proc_entry; 24extern struct proc_dir_entry *hysdn_proc_entry;
25 25
26static DEFINE_MUTEX(hysdn_log_mutex); 26static DEFINE_MUTEX(hysdn_log_mutex);
27static void put_log_buffer(hysdn_card * card, char *cp); 27static void put_log_buffer(hysdn_card *card, char *cp);
28 28
29/*************************************************/ 29/*************************************************/
30/* structure keeping ascii log for device output */ 30/* structure keeping ascii log for device output */
@@ -54,7 +54,7 @@ struct procdata {
54/* log function for cards error log interface */ 54/* log function for cards error log interface */
55/**********************************************/ 55/**********************************************/
56void 56void
57hysdn_card_errlog(hysdn_card * card, tErrLogEntry * logp, int maxsize) 57hysdn_card_errlog(hysdn_card *card, tErrLogEntry *logp, int maxsize)
58{ 58{
59 char buf[ERRLOG_TEXT_SIZE + 40]; 59 char buf[ERRLOG_TEXT_SIZE + 40];
60 60
@@ -66,7 +66,7 @@ hysdn_card_errlog(hysdn_card * card, tErrLogEntry * logp, int maxsize)
66/* Log function using format specifiers for output */ 66/* Log function using format specifiers for output */
67/***************************************************/ 67/***************************************************/
68void 68void
69hysdn_addlog(hysdn_card * card, char *fmt,...) 69hysdn_addlog(hysdn_card *card, char *fmt, ...)
70{ 70{
71 struct procdata *pd = card->proclog; 71 struct procdata *pd = card->proclog;
72 char *cp; 72 char *cp;
@@ -98,7 +98,7 @@ hysdn_addlog(hysdn_card * card, char *fmt,...)
98/* Flushes buffers not longer in use. */ 98/* Flushes buffers not longer in use. */
99/********************************************/ 99/********************************************/
100static void 100static void
101put_log_buffer(hysdn_card * card, char *cp) 101put_log_buffer(hysdn_card *card, char *cp)
102{ 102{
103 struct log_data *ib; 103 struct log_data *ib;
104 struct procdata *pd = card->proclog; 104 struct procdata *pd = card->proclog;
@@ -115,7 +115,7 @@ put_log_buffer(hysdn_card * card, char *cp)
115 return; /* no open file for read */ 115 return; /* no open file for read */
116 116
117 if (!(ib = kmalloc(sizeof(struct log_data) + strlen(cp), GFP_ATOMIC))) 117 if (!(ib = kmalloc(sizeof(struct log_data) + strlen(cp), GFP_ATOMIC)))
118 return; /* no memory */ 118 return; /* no memory */
119 strcpy(ib->log_start, cp); /* set output string */ 119 strcpy(ib->log_start, cp); /* set output string */
120 ib->next = NULL; 120 ib->next = NULL;
121 ib->proc_ctrl = pd; /* point to own control structure */ 121 ib->proc_ctrl = pd; /* point to own control structure */
@@ -153,7 +153,7 @@ put_log_buffer(hysdn_card * card, char *cp)
153/* write log file -> set log level bits */ 153/* write log file -> set log level bits */
154/****************************************/ 154/****************************************/
155static ssize_t 155static ssize_t
156hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off) 156hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t *off)
157{ 157{
158 int rc; 158 int rc;
159 unsigned char valbuf[128]; 159 unsigned char valbuf[128];
@@ -177,7 +177,7 @@ hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t
177/* read log file */ 177/* read log file */
178/******************/ 178/******************/
179static ssize_t 179static ssize_t
180hysdn_log_read(struct file *file, char __user *buf, size_t count, loff_t * off) 180hysdn_log_read(struct file *file, char __user *buf, size_t count, loff_t *off)
181{ 181{
182 struct log_data *inf; 182 struct log_data *inf;
183 int len; 183 int len;
@@ -324,7 +324,7 @@ hysdn_log_close(struct inode *ino, struct file *filep)
324/* select/poll routine to be able using select() */ 324/* select/poll routine to be able using select() */
325/*************************************************/ 325/*************************************************/
326static unsigned int 326static unsigned int
327hysdn_log_poll(struct file *file, poll_table * wait) 327hysdn_log_poll(struct file *file, poll_table *wait)
328{ 328{
329 unsigned int mask = 0; 329 unsigned int mask = 0;
330 struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); 330 struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
@@ -364,7 +364,7 @@ static const struct file_operations log_fops =
364 .write = hysdn_log_write, 364 .write = hysdn_log_write,
365 .poll = hysdn_log_poll, 365 .poll = hysdn_log_poll,
366 .open = hysdn_log_open, 366 .open = hysdn_log_open,
367 .release = hysdn_log_close, 367 .release = hysdn_log_close,
368}; 368};
369 369
370 370
@@ -373,7 +373,7 @@ static const struct file_operations log_fops =
373/* conf files. */ 373/* conf files. */
374/***********************************************************************************/ 374/***********************************************************************************/
375int 375int
376hysdn_proclog_init(hysdn_card * card) 376hysdn_proclog_init(hysdn_card *card)
377{ 377{
378 struct procdata *pd; 378 struct procdata *pd;
379 379
@@ -382,8 +382,8 @@ hysdn_proclog_init(hysdn_card * card)
382 if ((pd = kzalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) { 382 if ((pd = kzalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) {
383 sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid); 383 sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid);
384 pd->log = proc_create(pd->log_name, 384 pd->log = proc_create(pd->log_name,
385 S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry, 385 S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry,
386 &log_fops); 386 &log_fops);
387 387
388 init_waitqueue_head(&(pd->rd_queue)); 388 init_waitqueue_head(&(pd->rd_queue));
389 389
@@ -398,7 +398,7 @@ hysdn_proclog_init(hysdn_card * card)
398/* The module counter is assumed to be 0 ! */ 398/* The module counter is assumed to be 0 ! */
399/************************************************************************************/ 399/************************************************************************************/
400void 400void
401hysdn_proclog_release(hysdn_card * card) 401hysdn_proclog_release(hysdn_card *card)
402{ 402{
403 struct procdata *pd; 403 struct procdata *pd;
404 404
diff --git a/drivers/isdn/hysdn/hysdn_sched.c b/drivers/isdn/hysdn/hysdn_sched.c
index 3674d30d6a03..31d7c1415543 100644
--- a/drivers/isdn/hysdn/hysdn_sched.c
+++ b/drivers/isdn/hysdn/hysdn_sched.c
@@ -29,33 +29,33 @@
29/*****************************************************************************/ 29/*****************************************************************************/
30int 30int
31hysdn_sched_rx(hysdn_card *card, unsigned char *buf, unsigned short len, 31hysdn_sched_rx(hysdn_card *card, unsigned char *buf, unsigned short len,
32 unsigned short chan) 32 unsigned short chan)
33{ 33{
34 34
35 switch (chan) { 35 switch (chan) {
36 case CHAN_NDIS_DATA: 36 case CHAN_NDIS_DATA:
37 if (hynet_enable & (1 << card->myid)) { 37 if (hynet_enable & (1 << card->myid)) {
38 /* give packet to network handler */ 38 /* give packet to network handler */
39 hysdn_rx_netpkt(card, buf, len); 39 hysdn_rx_netpkt(card, buf, len);
40 } 40 }
41 break; 41 break;
42 42
43 case CHAN_ERRLOG: 43 case CHAN_ERRLOG:
44 hysdn_card_errlog(card, (tErrLogEntry *) buf, len); 44 hysdn_card_errlog(card, (tErrLogEntry *) buf, len);
45 if (card->err_log_state == ERRLOG_STATE_ON) 45 if (card->err_log_state == ERRLOG_STATE_ON)
46 card->err_log_state = ERRLOG_STATE_START; /* start new fetch */ 46 card->err_log_state = ERRLOG_STATE_START; /* start new fetch */
47 break; 47 break;
48#ifdef CONFIG_HYSDN_CAPI 48#ifdef CONFIG_HYSDN_CAPI
49 case CHAN_CAPI: 49 case CHAN_CAPI:
50/* give packet to CAPI handler */ 50/* give packet to CAPI handler */
51 if (hycapi_enable & (1 << card->myid)) { 51 if (hycapi_enable & (1 << card->myid)) {
52 hycapi_rx_capipkt(card, buf, len); 52 hycapi_rx_capipkt(card, buf, len);
53 } 53 }
54 break; 54 break;
55#endif /* CONFIG_HYSDN_CAPI */ 55#endif /* CONFIG_HYSDN_CAPI */
56 default: 56 default:
57 printk(KERN_INFO "irq message channel %d len %d unhandled \n", chan, len); 57 printk(KERN_INFO "irq message channel %d len %d unhandled \n", chan, len);
58 break; 58 break;
59 59
60 } /* switch rx channel */ 60 } /* switch rx channel */
61 61
@@ -72,8 +72,8 @@ hysdn_sched_rx(hysdn_card *card, unsigned char *buf, unsigned short len,
72/*****************************************************************************/ 72/*****************************************************************************/
73int 73int
74hysdn_sched_tx(hysdn_card *card, unsigned char *buf, 74hysdn_sched_tx(hysdn_card *card, unsigned char *buf,
75 unsigned short volatile *len, unsigned short volatile *chan, 75 unsigned short volatile *len, unsigned short volatile *chan,
76 unsigned short maxlen) 76 unsigned short maxlen)
77{ 77{
78 struct sk_buff *skb; 78 struct sk_buff *skb;
79 79
@@ -109,8 +109,8 @@ hysdn_sched_tx(hysdn_card *card, unsigned char *buf,
109 return (1); /* tell that data should be send */ 109 return (1); /* tell that data should be send */
110 } /* error log start and able to send */ 110 } /* error log start and able to send */
111 /* now handle network interface packets */ 111 /* now handle network interface packets */
112 if ((hynet_enable & (1 << card->myid)) && 112 if ((hynet_enable & (1 << card->myid)) &&
113 (skb = hysdn_tx_netget(card)) != NULL) 113 (skb = hysdn_tx_netget(card)) != NULL)
114 { 114 {
115 if (skb->len <= maxlen) { 115 if (skb->len <= maxlen) {
116 /* copy the packet to the buffer */ 116 /* copy the packet to the buffer */
@@ -123,8 +123,8 @@ hysdn_sched_tx(hysdn_card *card, unsigned char *buf,
123 hysdn_tx_netack(card); /* aknowledge packet -> throw away */ 123 hysdn_tx_netack(card); /* aknowledge packet -> throw away */
124 } /* send a network packet if available */ 124 } /* send a network packet if available */
125#ifdef CONFIG_HYSDN_CAPI 125#ifdef CONFIG_HYSDN_CAPI
126 if( ((hycapi_enable & (1 << card->myid))) && 126 if (((hycapi_enable & (1 << card->myid))) &&
127 ((skb = hycapi_tx_capiget(card)) != NULL) ) 127 ((skb = hycapi_tx_capiget(card)) != NULL))
128 { 128 {
129 if (skb->len <= maxlen) { 129 if (skb->len <= maxlen) {
130 skb_copy_from_linear_data(skb, buf, skb->len); 130 skb_copy_from_linear_data(skb, buf, skb->len);
diff --git a/drivers/isdn/hysdn/ince1pc.h b/drivers/isdn/hysdn/ince1pc.h
index 7a36694df6d7..cab68361de65 100644
--- a/drivers/isdn/hysdn/ince1pc.h
+++ b/drivers/isdn/hysdn/ince1pc.h
@@ -17,30 +17,30 @@
17 17
18/* basic scalar definitions have same meanning, 18/* basic scalar definitions have same meanning,
19 * but their declaration location depends on environment 19 * but their declaration location depends on environment
20 */ 20 */
21 21
22/*--------------------------------------channel numbers---------------------*/ 22/*--------------------------------------channel numbers---------------------*/
23#define CHAN_SYSTEM 0x0001 /* system channel (spooler to spooler) */ 23#define CHAN_SYSTEM 0x0001 /* system channel (spooler to spooler) */
24#define CHAN_ERRLOG 0x0005 /* error logger */ 24#define CHAN_ERRLOG 0x0005 /* error logger */
25#define CHAN_CAPI 0x0064 /* CAPI interface */ 25#define CHAN_CAPI 0x0064 /* CAPI interface */
26#define CHAN_NDIS_DATA 0x1001 /* NDIS data transfer */ 26#define CHAN_NDIS_DATA 0x1001 /* NDIS data transfer */
27 27
28/*--------------------------------------POF ready msg-----------------------*/ 28/*--------------------------------------POF ready msg-----------------------*/
29 /* NOTE: after booting POF sends system ready message to PC: */ 29/* NOTE: after booting POF sends system ready message to PC: */
30#define RDY_MAGIC 0x52535953UL /* 'SYSR' reversed */ 30#define RDY_MAGIC 0x52535953UL /* 'SYSR' reversed */
31#define RDY_MAGIC_SIZE 4 /* size in bytes */ 31#define RDY_MAGIC_SIZE 4 /* size in bytes */
32 32
33#define MAX_N_TOK_BYTES 255 33#define MAX_N_TOK_BYTES 255
34 34
35#define MIN_RDY_MSG_SIZE RDY_MAGIC_SIZE 35#define MIN_RDY_MSG_SIZE RDY_MAGIC_SIZE
36#define MAX_RDY_MSG_SIZE (RDY_MAGIC_SIZE+MAX_N_TOK_BYTES) 36#define MAX_RDY_MSG_SIZE (RDY_MAGIC_SIZE + MAX_N_TOK_BYTES)
37 37
38#define SYSR_TOK_END 0 38#define SYSR_TOK_END 0
39#define SYSR_TOK_B_CHAN 1 /* nr. of B-Channels; DataLen=1; def: 2 */ 39#define SYSR_TOK_B_CHAN 1 /* nr. of B-Channels; DataLen=1; def: 2 */
40#define SYSR_TOK_FAX_CHAN 2 /* nr. of FAX Channels; DataLen=1; def: 0 */ 40#define SYSR_TOK_FAX_CHAN 2 /* nr. of FAX Channels; DataLen=1; def: 0 */
41#define SYSR_TOK_MAC_ADDR 3 /* MAC-Address; DataLen=6; def: auto */ 41#define SYSR_TOK_MAC_ADDR 3 /* MAC-Address; DataLen=6; def: auto */
42#define SYSR_TOK_ESC 255 /* undefined data size yet */ 42#define SYSR_TOK_ESC 255 /* undefined data size yet */
43 /* default values, if not corrected by token: */ 43/* default values, if not corrected by token: */
44#define SYSR_TOK_B_CHAN_DEF 2 /* assume 2 B-Channels */ 44#define SYSR_TOK_B_CHAN_DEF 2 /* assume 2 B-Channels */
45#define SYSR_TOK_FAX_CHAN_DEF 1 /* assume 1 FAX Channel */ 45#define SYSR_TOK_FAX_CHAN_DEF 1 /* assume 1 FAX Channel */
46 46
@@ -70,31 +70,31 @@
70 * 70 *
71 * note: 71 * note:
72 * - for 16-bit FIFO add padding 0 byte to achieve even token data bytes! 72 * - for 16-bit FIFO add padding 0 byte to achieve even token data bytes!
73 */ 73 */
74 74
75/*--------------------------------------error logger------------------------*/ 75/*--------------------------------------error logger------------------------*/
76 /* note: pof needs final 0 ! */ 76/* note: pof needs final 0 ! */
77#define ERRLOG_CMD_REQ "ERRLOG ON" 77#define ERRLOG_CMD_REQ "ERRLOG ON"
78#define ERRLOG_CMD_REQ_SIZE 10 /* with final 0 byte ! */ 78#define ERRLOG_CMD_REQ_SIZE 10 /* with final 0 byte ! */
79#define ERRLOG_CMD_STOP "ERRLOG OFF" 79#define ERRLOG_CMD_STOP "ERRLOG OFF"
80#define ERRLOG_CMD_STOP_SIZE 11 /* with final 0 byte ! */ 80#define ERRLOG_CMD_STOP_SIZE 11 /* with final 0 byte ! */
81 81
82#define ERRLOG_ENTRY_SIZE 64 /* sizeof(tErrLogEntry) */ 82#define ERRLOG_ENTRY_SIZE 64 /* sizeof(tErrLogEntry) */
83 /* remaining text size = 55 */ 83 /* remaining text size = 55 */
84#define ERRLOG_TEXT_SIZE (ERRLOG_ENTRY_SIZE-2*4-1) 84#define ERRLOG_TEXT_SIZE (ERRLOG_ENTRY_SIZE - 2 * 4 - 1)
85 85
86typedef struct ErrLogEntry_tag { 86typedef struct ErrLogEntry_tag {
87 87
88/*00 */ unsigned long ulErrType; 88 /*00 */ unsigned long ulErrType;
89 89
90/*04 */ unsigned long ulErrSubtype; 90 /*04 */ unsigned long ulErrSubtype;
91 91
92/*08 */ unsigned char ucTextSize; 92 /*08 */ unsigned char ucTextSize;
93 93
94 /*09 */ unsigned char ucText[ERRLOG_TEXT_SIZE]; 94 /*09 */ unsigned char ucText[ERRLOG_TEXT_SIZE];
95 /* ASCIIZ of len ucTextSize-1 */ 95 /* ASCIIZ of len ucTextSize-1 */
96 96
97/*40 */ 97/*40 */
98} tErrLogEntry; 98} tErrLogEntry;
99 99
100 100
@@ -104,30 +104,30 @@ typedef struct ErrLogEntry_tag {
104#endif /* */ 104#endif /* */
105#endif /* */ 105#endif /* */
106 106
107/*--------------------------------------DPRAM boot spooler------------------*/ 107/*--------------------------------------DPRAM boot spooler------------------*/
108 /* this is the struture used between pc and 108/* this is the struture used between pc and
109 * hyperstone to exchange boot data 109 * hyperstone to exchange boot data
110 */ 110 */
111#define DPRAM_SPOOLER_DATA_SIZE 0x20 111#define DPRAM_SPOOLER_DATA_SIZE 0x20
112typedef struct DpramBootSpooler_tag { 112typedef struct DpramBootSpooler_tag {
113 113
114/*00 */ unsigned char Len; 114 /*00 */ unsigned char Len;
115 115
116/*01 */ volatile unsigned char RdPtr; 116 /*01 */ volatile unsigned char RdPtr;
117 117
118/*02 */ unsigned char WrPtr; 118 /*02 */ unsigned char WrPtr;
119 119
120/*03 */ unsigned char Data[DPRAM_SPOOLER_DATA_SIZE]; 120 /*03 */ unsigned char Data[DPRAM_SPOOLER_DATA_SIZE];
121 121
122/*23 */ 122/*23 */
123} tDpramBootSpooler; 123} tDpramBootSpooler;
124 124
125 125
126#define DPRAM_SPOOLER_MIN_SIZE 5 /* Len+RdPtr+Wrptr+2*data */ 126#define DPRAM_SPOOLER_MIN_SIZE 5 /* Len+RdPtr+Wrptr+2*data */
127#define DPRAM_SPOOLER_DEF_SIZE 0x23 /* current default size */ 127#define DPRAM_SPOOLER_DEF_SIZE 0x23 /* current default size */
128 128
129/*--------------------------------------HYCARD/ERGO DPRAM SoftUart----------*/ 129/*--------------------------------------HYCARD/ERGO DPRAM SoftUart----------*/
130 /* at DPRAM offset 0x1C00: */ 130/* at DPRAM offset 0x1C00: */
131#define SIZE_RSV_SOFT_UART 0x1B0 /* 432 bytes reserved for SoftUart */ 131#define SIZE_RSV_SOFT_UART 0x1B0 /* 432 bytes reserved for SoftUart */
132 132
133 133