diff options
author | Joe Perches <joe@perches.com> | 2012-02-19 22:52:38 -0500 |
---|---|---|
committer | Joe Perches <joe@perches.com> | 2012-02-21 12:04:01 -0500 |
commit | 475be4d85a274d0961593db41cf85689db1d583c (patch) | |
tree | b2b8931eb747794730522c3cf1898e46948527b9 /drivers/isdn/pcbit | |
parent | 0b0a635f79f91f3755b6518627ea06dd0dbfd523 (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/pcbit')
-rw-r--r-- | drivers/isdn/pcbit/callbacks.c | 303 | ||||
-rw-r--r-- | drivers/isdn/pcbit/callbacks.h | 28 | ||||
-rw-r--r-- | drivers/isdn/pcbit/capi.c | 585 | ||||
-rw-r--r-- | drivers/isdn/pcbit/capi.h | 46 | ||||
-rw-r--r-- | drivers/isdn/pcbit/drv.c | 248 | ||||
-rw-r--r-- | drivers/isdn/pcbit/edss1.c | 414 | ||||
-rw-r--r-- | drivers/isdn/pcbit/edss1.h | 13 | ||||
-rw-r--r-- | drivers/isdn/pcbit/layer2.c | 36 | ||||
-rw-r--r-- | drivers/isdn/pcbit/layer2.h | 265 | ||||
-rw-r--r-- | drivers/isdn/pcbit/module.c | 35 | ||||
-rw-r--r-- | drivers/isdn/pcbit/pcbit.h | 32 |
11 files changed, 987 insertions, 1018 deletions
diff --git a/drivers/isdn/pcbit/callbacks.c b/drivers/isdn/pcbit/callbacks.c index 976143b2346d..efb6d6a3639a 100644 --- a/drivers/isdn/pcbit/callbacks.c +++ b/drivers/isdn/pcbit/callbacks.c | |||
@@ -2,16 +2,16 @@ | |||
2 | * Callbacks for the FSM | 2 | * Callbacks for the FSM |
3 | * | 3 | * |
4 | * Copyright (C) 1996 Universidade de Lisboa | 4 | * Copyright (C) 1996 Universidade de Lisboa |
5 | * | 5 | * |
6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) | 6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) |
7 | * | 7 | * |
8 | * This software may be used and distributed according to the terms of | 8 | * This software may be used and distributed according to the terms of |
9 | * the GNU General Public License, incorporated herein by reference. | 9 | * the GNU General Public License, incorporated herein by reference. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | /* | 12 | /* |
13 | * Fix: 19981230 - Carlos Morgado <chbm@techie.com> | 13 | * Fix: 19981230 - Carlos Morgado <chbm@techie.com> |
14 | * Port of Nelson Escravana's <nelson.escravana@usa.net> fix to CalledPN | 14 | * Port of Nelson Escravana's <nelson.escravana@usa.net> fix to CalledPN |
15 | * NULL pointer dereference in cb_in_1 (originally fixed in 2.0) | 15 | * NULL pointer dereference in cb_in_1 (originally fixed in 2.0) |
16 | */ | 16 | */ |
17 | 17 | ||
@@ -39,86 +39,86 @@ ushort last_ref_num = 1; | |||
39 | * | 39 | * |
40 | */ | 40 | */ |
41 | 41 | ||
42 | void cb_out_1(struct pcbit_dev * dev, struct pcbit_chan* chan, | 42 | void cb_out_1(struct pcbit_dev *dev, struct pcbit_chan *chan, |
43 | struct callb_data *cbdata) | 43 | struct callb_data *cbdata) |
44 | { | 44 | { |
45 | struct sk_buff *skb; | 45 | struct sk_buff *skb; |
46 | int len; | 46 | int len; |
47 | ushort refnum; | 47 | ushort refnum; |
48 | 48 | ||
49 | 49 | ||
50 | #ifdef DEBUG | 50 | #ifdef DEBUG |
51 | printk(KERN_DEBUG "Called Party Number: %s\n", | 51 | printk(KERN_DEBUG "Called Party Number: %s\n", |
52 | cbdata->data.setup.CalledPN); | 52 | cbdata->data.setup.CalledPN); |
53 | #endif | 53 | #endif |
54 | /* | 54 | /* |
55 | * hdr - kmalloc in capi_conn_req | 55 | * hdr - kmalloc in capi_conn_req |
56 | * - kfree when msg has been sent | 56 | * - kfree when msg has been sent |
57 | */ | 57 | */ |
58 | 58 | ||
59 | if ((len = capi_conn_req(cbdata->data.setup.CalledPN, &skb, | 59 | if ((len = capi_conn_req(cbdata->data.setup.CalledPN, &skb, |
60 | chan->proto)) < 0) | 60 | chan->proto)) < 0) |
61 | { | 61 | { |
62 | printk("capi_conn_req failed\n"); | 62 | printk("capi_conn_req failed\n"); |
63 | return; | 63 | return; |
64 | } | 64 | } |
65 | 65 | ||
66 | 66 | ||
67 | refnum = last_ref_num++ & 0x7fffU; | 67 | refnum = last_ref_num++ & 0x7fffU; |
68 | 68 | ||
69 | chan->callref = 0; | 69 | chan->callref = 0; |
70 | chan->layer2link = 0; | 70 | chan->layer2link = 0; |
71 | chan->snum = 0; | 71 | chan->snum = 0; |
72 | chan->s_refnum = refnum; | 72 | chan->s_refnum = refnum; |
73 | 73 | ||
74 | pcbit_l2_write(dev, MSG_CONN_REQ, refnum, skb, len); | 74 | pcbit_l2_write(dev, MSG_CONN_REQ, refnum, skb, len); |
75 | } | 75 | } |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * rcv CONNECT | 78 | * rcv CONNECT |
79 | * will go into ACTIVE state | 79 | * will go into ACTIVE state |
80 | * send CONN_ACTIVE_RESP | 80 | * send CONN_ACTIVE_RESP |
81 | * send Select protocol request | 81 | * send Select protocol request |
82 | */ | 82 | */ |
83 | 83 | ||
84 | void cb_out_2(struct pcbit_dev * dev, struct pcbit_chan* chan, | 84 | void cb_out_2(struct pcbit_dev *dev, struct pcbit_chan *chan, |
85 | struct callb_data *data) | 85 | struct callb_data *data) |
86 | { | 86 | { |
87 | isdn_ctrl ictl; | 87 | isdn_ctrl ictl; |
88 | struct sk_buff *skb; | 88 | struct sk_buff *skb; |
89 | int len; | 89 | int len; |
90 | ushort refnum; | 90 | ushort refnum; |
91 | 91 | ||
92 | if ((len=capi_conn_active_resp(chan, &skb)) < 0) | 92 | if ((len = capi_conn_active_resp(chan, &skb)) < 0) |
93 | { | 93 | { |
94 | printk("capi_conn_active_req failed\n"); | 94 | printk("capi_conn_active_req failed\n"); |
95 | return; | 95 | return; |
96 | } | 96 | } |
97 | 97 | ||
98 | refnum = last_ref_num++ & 0x7fffU; | 98 | refnum = last_ref_num++ & 0x7fffU; |
99 | chan->s_refnum = refnum; | 99 | chan->s_refnum = refnum; |
100 | 100 | ||
101 | pcbit_l2_write(dev, MSG_CONN_ACTV_RESP, refnum, skb, len); | 101 | pcbit_l2_write(dev, MSG_CONN_ACTV_RESP, refnum, skb, len); |
102 | 102 | ||
103 | 103 | ||
104 | ictl.command = ISDN_STAT_DCONN; | 104 | ictl.command = ISDN_STAT_DCONN; |
105 | ictl.driver=dev->id; | 105 | ictl.driver = dev->id; |
106 | ictl.arg=chan->id; | 106 | ictl.arg = chan->id; |
107 | dev->dev_if->statcallb(&ictl); | 107 | dev->dev_if->statcallb(&ictl); |
108 | 108 | ||
109 | /* ACTIVE D-channel */ | 109 | /* ACTIVE D-channel */ |
110 | 110 | ||
111 | /* Select protocol */ | 111 | /* Select protocol */ |
112 | 112 | ||
113 | if ((len=capi_select_proto_req(chan, &skb, 1 /*outgoing*/)) < 0) { | 113 | if ((len = capi_select_proto_req(chan, &skb, 1 /*outgoing*/)) < 0) { |
114 | printk("capi_select_proto_req failed\n"); | 114 | printk("capi_select_proto_req failed\n"); |
115 | return; | 115 | return; |
116 | } | 116 | } |
117 | 117 | ||
118 | refnum = last_ref_num++ & 0x7fffU; | 118 | refnum = last_ref_num++ & 0x7fffU; |
119 | chan->s_refnum = refnum; | 119 | chan->s_refnum = refnum; |
120 | 120 | ||
121 | pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len); | 121 | pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len); |
122 | } | 122 | } |
123 | 123 | ||
124 | 124 | ||
@@ -127,22 +127,22 @@ void cb_out_2(struct pcbit_dev * dev, struct pcbit_chan* chan, | |||
127 | * inform user | 127 | * inform user |
128 | */ | 128 | */ |
129 | 129 | ||
130 | void cb_in_1(struct pcbit_dev * dev, struct pcbit_chan* chan, | 130 | void cb_in_1(struct pcbit_dev *dev, struct pcbit_chan *chan, |
131 | struct callb_data *cbdata) | 131 | struct callb_data *cbdata) |
132 | { | 132 | { |
133 | isdn_ctrl ictl; | 133 | isdn_ctrl ictl; |
134 | unsigned short refnum; | 134 | unsigned short refnum; |
135 | struct sk_buff *skb; | 135 | struct sk_buff *skb; |
136 | int len; | 136 | int len; |
137 | 137 | ||
138 | 138 | ||
139 | ictl.command = ISDN_STAT_ICALL; | 139 | ictl.command = ISDN_STAT_ICALL; |
140 | ictl.driver=dev->id; | 140 | ictl.driver = dev->id; |
141 | ictl.arg=chan->id; | 141 | ictl.arg = chan->id; |
142 | 142 | ||
143 | /* | 143 | /* |
144 | * ictl.num >= strlen() + strlen() + 5 | 144 | * ictl.num >= strlen() + strlen() + 5 |
145 | */ | 145 | */ |
146 | 146 | ||
147 | if (cbdata->data.setup.CallingPN == NULL) { | 147 | if (cbdata->data.setup.CallingPN == NULL) { |
148 | printk(KERN_DEBUG "NULL CallingPN to phone; using 0\n"); | 148 | printk(KERN_DEBUG "NULL CallingPN to phone; using 0\n"); |
@@ -167,18 +167,18 @@ void cb_in_1(struct pcbit_dev * dev, struct pcbit_chan* chan, | |||
167 | printk(KERN_DEBUG "statstr: %s\n", ictl.num); | 167 | printk(KERN_DEBUG "statstr: %s\n", ictl.num); |
168 | #endif | 168 | #endif |
169 | 169 | ||
170 | dev->dev_if->statcallb(&ictl); | 170 | dev->dev_if->statcallb(&ictl); |
171 | |||
171 | 172 | ||
172 | 173 | if ((len = capi_conn_resp(chan, &skb)) < 0) { | |
173 | if ((len=capi_conn_resp(chan, &skb)) < 0) { | 174 | printk(KERN_DEBUG "capi_conn_resp failed\n"); |
174 | printk(KERN_DEBUG "capi_conn_resp failed\n"); | 175 | return; |
175 | return; | ||
176 | } | 176 | } |
177 | 177 | ||
178 | refnum = last_ref_num++ & 0x7fffU; | 178 | refnum = last_ref_num++ & 0x7fffU; |
179 | chan->s_refnum = refnum; | 179 | chan->s_refnum = refnum; |
180 | 180 | ||
181 | pcbit_l2_write(dev, MSG_CONN_RESP, refnum, skb, len); | 181 | pcbit_l2_write(dev, MSG_CONN_RESP, refnum, skb, len); |
182 | } | 182 | } |
183 | 183 | ||
184 | /* | 184 | /* |
@@ -187,24 +187,24 @@ void cb_in_1(struct pcbit_dev * dev, struct pcbit_chan* chan, | |||
187 | * send CONNECT message CONNECT_ACTIVE_REQ in CAPI | 187 | * send CONNECT message CONNECT_ACTIVE_REQ in CAPI |
188 | */ | 188 | */ |
189 | 189 | ||
190 | void cb_in_2(struct pcbit_dev * dev, struct pcbit_chan* chan, | 190 | void cb_in_2(struct pcbit_dev *dev, struct pcbit_chan *chan, |
191 | struct callb_data *data) | 191 | struct callb_data *data) |
192 | { | 192 | { |
193 | unsigned short refnum; | 193 | unsigned short refnum; |
194 | struct sk_buff *skb; | 194 | struct sk_buff *skb; |
195 | int len; | 195 | int len; |
196 | 196 | ||
197 | if ((len = capi_conn_active_req(chan, &skb)) < 0) { | 197 | if ((len = capi_conn_active_req(chan, &skb)) < 0) { |
198 | printk(KERN_DEBUG "capi_conn_active_req failed\n"); | 198 | printk(KERN_DEBUG "capi_conn_active_req failed\n"); |
199 | return; | 199 | return; |
200 | } | 200 | } |
201 | 201 | ||
202 | 202 | ||
203 | refnum = last_ref_num++ & 0x7fffU; | 203 | refnum = last_ref_num++ & 0x7fffU; |
204 | chan->s_refnum = refnum; | 204 | chan->s_refnum = refnum; |
205 | 205 | ||
206 | printk(KERN_DEBUG "sending MSG_CONN_ACTV_REQ\n"); | 206 | printk(KERN_DEBUG "sending MSG_CONN_ACTV_REQ\n"); |
207 | pcbit_l2_write(dev, MSG_CONN_ACTV_REQ, refnum, skb, len); | 207 | pcbit_l2_write(dev, MSG_CONN_ACTV_REQ, refnum, skb, len); |
208 | } | 208 | } |
209 | 209 | ||
210 | /* | 210 | /* |
@@ -213,23 +213,23 @@ void cb_in_2(struct pcbit_dev * dev, struct pcbit_chan* chan, | |||
213 | * | 213 | * |
214 | */ | 214 | */ |
215 | 215 | ||
216 | void cb_in_3(struct pcbit_dev * dev, struct pcbit_chan* chan, | 216 | void cb_in_3(struct pcbit_dev *dev, struct pcbit_chan *chan, |
217 | struct callb_data *data) | 217 | struct callb_data *data) |
218 | { | 218 | { |
219 | unsigned short refnum; | 219 | unsigned short refnum; |
220 | struct sk_buff *skb; | 220 | struct sk_buff *skb; |
221 | int len; | 221 | int len; |
222 | |||
223 | if ((len = capi_select_proto_req(chan, &skb, 0 /*incoming*/)) < 0) | ||
224 | { | ||
225 | printk("capi_select_proto_req failed\n"); | ||
226 | return; | ||
227 | } | ||
228 | 222 | ||
229 | refnum = last_ref_num++ & 0x7fffU; | 223 | if ((len = capi_select_proto_req(chan, &skb, 0 /*incoming*/)) < 0) |
230 | chan->s_refnum = refnum; | 224 | { |
225 | printk("capi_select_proto_req failed\n"); | ||
226 | return; | ||
227 | } | ||
228 | |||
229 | refnum = last_ref_num++ & 0x7fffU; | ||
230 | chan->s_refnum = refnum; | ||
231 | 231 | ||
232 | pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len); | 232 | pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len); |
233 | 233 | ||
234 | } | 234 | } |
235 | 235 | ||
@@ -239,52 +239,52 @@ void cb_in_3(struct pcbit_dev * dev, struct pcbit_chan* chan, | |||
239 | * send disconnect resp | 239 | * send disconnect resp |
240 | * send msg to user | 240 | * send msg to user |
241 | */ | 241 | */ |
242 | void cb_disc_1(struct pcbit_dev * dev, struct pcbit_chan* chan, | 242 | void cb_disc_1(struct pcbit_dev *dev, struct pcbit_chan *chan, |
243 | struct callb_data *data) | 243 | struct callb_data *data) |
244 | { | 244 | { |
245 | struct sk_buff *skb; | 245 | struct sk_buff *skb; |
246 | int len; | 246 | int len; |
247 | ushort refnum; | 247 | ushort refnum; |
248 | isdn_ctrl ictl; | 248 | isdn_ctrl ictl; |
249 | 249 | ||
250 | if ((len = capi_disc_resp(chan, &skb)) < 0) { | 250 | if ((len = capi_disc_resp(chan, &skb)) < 0) { |
251 | printk("capi_disc_resp failed\n"); | 251 | printk("capi_disc_resp failed\n"); |
252 | return; | 252 | return; |
253 | } | 253 | } |
254 | 254 | ||
255 | refnum = last_ref_num++ & 0x7fffU; | 255 | refnum = last_ref_num++ & 0x7fffU; |
256 | chan->s_refnum = refnum; | 256 | chan->s_refnum = refnum; |
257 | 257 | ||
258 | pcbit_l2_write(dev, MSG_DISC_RESP, refnum, skb, len); | 258 | pcbit_l2_write(dev, MSG_DISC_RESP, refnum, skb, len); |
259 | 259 | ||
260 | ictl.command = ISDN_STAT_BHUP; | 260 | ictl.command = ISDN_STAT_BHUP; |
261 | ictl.driver=dev->id; | 261 | ictl.driver = dev->id; |
262 | ictl.arg=chan->id; | 262 | ictl.arg = chan->id; |
263 | dev->dev_if->statcallb(&ictl); | 263 | dev->dev_if->statcallb(&ictl); |
264 | } | 264 | } |
265 | 265 | ||
266 | 266 | ||
267 | /* | 267 | /* |
268 | * User HANGUP on active/call proceeding state | 268 | * User HANGUP on active/call proceeding state |
269 | * send disc.req | 269 | * send disc.req |
270 | */ | 270 | */ |
271 | void cb_disc_2(struct pcbit_dev * dev, struct pcbit_chan* chan, | 271 | void cb_disc_2(struct pcbit_dev *dev, struct pcbit_chan *chan, |
272 | struct callb_data *data) | 272 | struct callb_data *data) |
273 | { | 273 | { |
274 | struct sk_buff *skb; | 274 | struct sk_buff *skb; |
275 | int len; | 275 | int len; |
276 | ushort refnum; | 276 | ushort refnum; |
277 | 277 | ||
278 | if ((len = capi_disc_req(chan->callref, &skb, CAUSE_NORMAL)) < 0) | 278 | if ((len = capi_disc_req(chan->callref, &skb, CAUSE_NORMAL)) < 0) |
279 | { | 279 | { |
280 | printk("capi_disc_req failed\n"); | 280 | printk("capi_disc_req failed\n"); |
281 | return; | 281 | return; |
282 | } | 282 | } |
283 | 283 | ||
284 | refnum = last_ref_num++ & 0x7fffU; | 284 | refnum = last_ref_num++ & 0x7fffU; |
285 | chan->s_refnum = refnum; | 285 | chan->s_refnum = refnum; |
286 | 286 | ||
287 | pcbit_l2_write(dev, MSG_DISC_REQ, refnum, skb, len); | 287 | pcbit_l2_write(dev, MSG_DISC_REQ, refnum, skb, len); |
288 | } | 288 | } |
289 | 289 | ||
290 | /* | 290 | /* |
@@ -292,18 +292,18 @@ void cb_disc_2(struct pcbit_dev * dev, struct pcbit_chan* chan, | |||
292 | * Problem: when the HL driver sends the disc req itself | 292 | * Problem: when the HL driver sends the disc req itself |
293 | * LL receives BHUP | 293 | * LL receives BHUP |
294 | */ | 294 | */ |
295 | void cb_disc_3(struct pcbit_dev * dev, struct pcbit_chan* chan, | 295 | void cb_disc_3(struct pcbit_dev *dev, struct pcbit_chan *chan, |
296 | struct callb_data *data) | 296 | struct callb_data *data) |
297 | { | 297 | { |
298 | isdn_ctrl ictl; | 298 | isdn_ctrl ictl; |
299 | 299 | ||
300 | ictl.command = ISDN_STAT_BHUP; | 300 | ictl.command = ISDN_STAT_BHUP; |
301 | ictl.driver=dev->id; | 301 | ictl.driver = dev->id; |
302 | ictl.arg=chan->id; | 302 | ictl.arg = chan->id; |
303 | dev->dev_if->statcallb(&ictl); | 303 | dev->dev_if->statcallb(&ictl); |
304 | } | 304 | } |
305 | 305 | ||
306 | void cb_notdone(struct pcbit_dev * dev, struct pcbit_chan* chan, | 306 | void cb_notdone(struct pcbit_dev *dev, struct pcbit_chan *chan, |
307 | struct callb_data *data) | 307 | struct callb_data *data) |
308 | { | 308 | { |
309 | } | 309 | } |
@@ -311,38 +311,35 @@ void cb_notdone(struct pcbit_dev * dev, struct pcbit_chan* chan, | |||
311 | /* | 311 | /* |
312 | * send activate b-chan protocol | 312 | * send activate b-chan protocol |
313 | */ | 313 | */ |
314 | void cb_selp_1(struct pcbit_dev * dev, struct pcbit_chan* chan, | 314 | void cb_selp_1(struct pcbit_dev *dev, struct pcbit_chan *chan, |
315 | struct callb_data *data) | 315 | struct callb_data *data) |
316 | { | 316 | { |
317 | struct sk_buff *skb; | 317 | struct sk_buff *skb; |
318 | int len; | 318 | int len; |
319 | ushort refnum; | 319 | ushort refnum; |
320 | 320 | ||
321 | if ((len = capi_activate_transp_req(chan, &skb)) < 0) | 321 | if ((len = capi_activate_transp_req(chan, &skb)) < 0) |
322 | { | 322 | { |
323 | printk("capi_conn_activate_transp_req failed\n"); | 323 | printk("capi_conn_activate_transp_req failed\n"); |
324 | return; | 324 | return; |
325 | } | 325 | } |
326 | 326 | ||
327 | refnum = last_ref_num++ & 0x7fffU; | 327 | refnum = last_ref_num++ & 0x7fffU; |
328 | chan->s_refnum = refnum; | 328 | chan->s_refnum = refnum; |
329 | 329 | ||
330 | pcbit_l2_write(dev, MSG_ACT_TRANSP_REQ, refnum, skb, len); | 330 | pcbit_l2_write(dev, MSG_ACT_TRANSP_REQ, refnum, skb, len); |
331 | } | 331 | } |
332 | 332 | ||
333 | /* | 333 | /* |
334 | * Inform User that the B-channel is available | 334 | * Inform User that the B-channel is available |
335 | */ | 335 | */ |
336 | void cb_open(struct pcbit_dev * dev, struct pcbit_chan* chan, | 336 | void cb_open(struct pcbit_dev *dev, struct pcbit_chan *chan, |
337 | struct callb_data *data) | 337 | struct callb_data *data) |
338 | { | 338 | { |
339 | isdn_ctrl ictl; | 339 | isdn_ctrl ictl; |
340 | 340 | ||
341 | ictl.command = ISDN_STAT_BCONN; | 341 | ictl.command = ISDN_STAT_BCONN; |
342 | ictl.driver=dev->id; | 342 | ictl.driver = dev->id; |
343 | ictl.arg=chan->id; | 343 | ictl.arg = chan->id; |
344 | dev->dev_if->statcallb(&ictl); | 344 | dev->dev_if->statcallb(&ictl); |
345 | } | 345 | } |
346 | |||
347 | |||
348 | |||
diff --git a/drivers/isdn/pcbit/callbacks.h b/drivers/isdn/pcbit/callbacks.h index 17aa0f54bfc3..a036b4a7ffad 100644 --- a/drivers/isdn/pcbit/callbacks.h +++ b/drivers/isdn/pcbit/callbacks.h | |||
@@ -2,10 +2,10 @@ | |||
2 | * Callbacks prototypes for FSM | 2 | * Callbacks prototypes for FSM |
3 | * | 3 | * |
4 | * Copyright (C) 1996 Universidade de Lisboa | 4 | * Copyright (C) 1996 Universidade de Lisboa |
5 | * | 5 | * |
6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) | 6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) |
7 | * | 7 | * |
8 | * This software may be used and distributed according to the terms of | 8 | * This software may be used and distributed according to the terms of |
9 | * the GNU General Public License, incorporated herein by reference. | 9 | * the GNU General Public License, incorporated herein by reference. |
10 | */ | 10 | */ |
11 | 11 | ||
@@ -13,34 +13,32 @@ | |||
13 | #define CALLBACKS_H | 13 | #define CALLBACKS_H |
14 | 14 | ||
15 | 15 | ||
16 | extern void cb_out_1(struct pcbit_dev * dev, struct pcbit_chan* chan, | 16 | extern void cb_out_1(struct pcbit_dev *dev, struct pcbit_chan *chan, |
17 | struct callb_data *data); | 17 | struct callb_data *data); |
18 | 18 | ||
19 | extern void cb_out_2(struct pcbit_dev * dev, struct pcbit_chan* chan, | 19 | extern void cb_out_2(struct pcbit_dev *dev, struct pcbit_chan *chan, |
20 | struct callb_data *data); | 20 | struct callb_data *data); |
21 | 21 | ||
22 | extern void cb_in_1(struct pcbit_dev * dev, struct pcbit_chan* chan, | 22 | extern void cb_in_1(struct pcbit_dev *dev, struct pcbit_chan *chan, |
23 | struct callb_data *data); | 23 | struct callb_data *data); |
24 | extern void cb_in_2(struct pcbit_dev * dev, struct pcbit_chan* chan, | 24 | extern void cb_in_2(struct pcbit_dev *dev, struct pcbit_chan *chan, |
25 | struct callb_data *data); | 25 | struct callb_data *data); |
26 | extern void cb_in_3(struct pcbit_dev * dev, struct pcbit_chan* chan, | 26 | extern void cb_in_3(struct pcbit_dev *dev, struct pcbit_chan *chan, |
27 | struct callb_data *data); | 27 | struct callb_data *data); |
28 | 28 | ||
29 | extern void cb_disc_1(struct pcbit_dev * dev, struct pcbit_chan* chan, | 29 | extern void cb_disc_1(struct pcbit_dev *dev, struct pcbit_chan *chan, |
30 | struct callb_data *data); | 30 | struct callb_data *data); |
31 | extern void cb_disc_2(struct pcbit_dev * dev, struct pcbit_chan* chan, | 31 | extern void cb_disc_2(struct pcbit_dev *dev, struct pcbit_chan *chan, |
32 | struct callb_data *data); | 32 | struct callb_data *data); |
33 | extern void cb_disc_3(struct pcbit_dev * dev, struct pcbit_chan* chan, | 33 | extern void cb_disc_3(struct pcbit_dev *dev, struct pcbit_chan *chan, |
34 | struct callb_data *data); | 34 | struct callb_data *data); |
35 | 35 | ||
36 | extern void cb_notdone(struct pcbit_dev * dev, struct pcbit_chan* chan, | 36 | extern void cb_notdone(struct pcbit_dev *dev, struct pcbit_chan *chan, |
37 | struct callb_data *data); | 37 | struct callb_data *data); |
38 | 38 | ||
39 | extern void cb_selp_1(struct pcbit_dev * dev, struct pcbit_chan* chan, | 39 | extern void cb_selp_1(struct pcbit_dev *dev, struct pcbit_chan *chan, |
40 | struct callb_data *data); | 40 | struct callb_data *data); |
41 | extern void cb_open(struct pcbit_dev * dev, struct pcbit_chan* chan, | 41 | extern void cb_open(struct pcbit_dev *dev, struct pcbit_chan *chan, |
42 | struct callb_data *data); | 42 | struct callb_data *data); |
43 | 43 | ||
44 | #endif | 44 | #endif |
45 | |||
46 | |||
diff --git a/drivers/isdn/pcbit/capi.c b/drivers/isdn/pcbit/capi.c index ac5a91ccde81..4e3cbf857d60 100644 --- a/drivers/isdn/pcbit/capi.c +++ b/drivers/isdn/pcbit/capi.c | |||
@@ -3,10 +3,10 @@ | |||
3 | * Portugal Telecom CAPI 2.0 | 3 | * Portugal Telecom CAPI 2.0 |
4 | * | 4 | * |
5 | * Copyright (C) 1996 Universidade de Lisboa | 5 | * Copyright (C) 1996 Universidade de Lisboa |
6 | * | 6 | * |
7 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) | 7 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) |
8 | * | 8 | * |
9 | * This software may be used and distributed according to the terms of | 9 | * This software may be used and distributed according to the terms of |
10 | * the GNU General Public License, incorporated herein by reference. | 10 | * the GNU General Public License, incorporated herein by reference. |
11 | * | 11 | * |
12 | * Not compatible with the AVM Gmbh. CAPI 2.0 | 12 | * Not compatible with the AVM Gmbh. CAPI 2.0 |
@@ -51,39 +51,39 @@ | |||
51 | * | 51 | * |
52 | */ | 52 | */ |
53 | 53 | ||
54 | int capi_conn_req(const char * calledPN, struct sk_buff **skb, int proto) | 54 | int capi_conn_req(const char *calledPN, struct sk_buff **skb, int proto) |
55 | { | 55 | { |
56 | ushort len; | 56 | ushort len; |
57 | 57 | ||
58 | /* | 58 | /* |
59 | * length | 59 | * length |
60 | * AppInfoMask - 2 | 60 | * AppInfoMask - 2 |
61 | * BC0 - 3 | 61 | * BC0 - 3 |
62 | * BC1 - 1 | 62 | * BC1 - 1 |
63 | * Chan - 2 | 63 | * Chan - 2 |
64 | * Keypad - 1 | 64 | * Keypad - 1 |
65 | * CPN - 1 | 65 | * CPN - 1 |
66 | * CPSA - 1 | 66 | * CPSA - 1 |
67 | * CalledPN - 2 + strlen | 67 | * CalledPN - 2 + strlen |
68 | * CalledPSA - 1 | 68 | * CalledPSA - 1 |
69 | * rest... - 4 | 69 | * rest... - 4 |
70 | * ---------------- | 70 | * ---------------- |
71 | * Total 18 + strlen | 71 | * Total 18 + strlen |
72 | */ | 72 | */ |
73 | 73 | ||
74 | len = 18 + strlen(calledPN); | 74 | len = 18 + strlen(calledPN); |
75 | 75 | ||
76 | if (proto == ISDN_PROTO_L2_TRANS) | 76 | if (proto == ISDN_PROTO_L2_TRANS) |
77 | len++; | 77 | len++; |
78 | 78 | ||
79 | if ((*skb = dev_alloc_skb(len)) == NULL) { | 79 | if ((*skb = dev_alloc_skb(len)) == NULL) { |
80 | 80 | ||
81 | printk(KERN_WARNING "capi_conn_req: alloc_skb failed\n"); | 81 | printk(KERN_WARNING "capi_conn_req: alloc_skb failed\n"); |
82 | return -1; | 82 | return -1; |
83 | } | 83 | } |
84 | 84 | ||
85 | /* InfoElmMask */ | 85 | /* InfoElmMask */ |
86 | *((ushort*) skb_put(*skb, 2)) = AppInfoMask; | 86 | *((ushort *)skb_put(*skb, 2)) = AppInfoMask; |
87 | 87 | ||
88 | if (proto == ISDN_PROTO_L2_TRANS) | 88 | if (proto == ISDN_PROTO_L2_TRANS) |
89 | { | 89 | { |
@@ -101,162 +101,162 @@ int capi_conn_req(const char * calledPN, struct sk_buff **skb, int proto) | |||
101 | *(skb_put(*skb, 1)) = 0x90; /* BC0.Octect4 */ | 101 | *(skb_put(*skb, 1)) = 0x90; /* BC0.Octect4 */ |
102 | } | 102 | } |
103 | 103 | ||
104 | /* Bearer Capability - Optional*/ | 104 | /* Bearer Capability - Optional*/ |
105 | *(skb_put(*skb, 1)) = 0; /* BC1.Length = 0 */ | 105 | *(skb_put(*skb, 1)) = 0; /* BC1.Length = 0 */ |
106 | 106 | ||
107 | *(skb_put(*skb, 1)) = 1; /* ChannelID.Length = 1 */ | 107 | *(skb_put(*skb, 1)) = 1; /* ChannelID.Length = 1 */ |
108 | *(skb_put(*skb, 1)) = 0x83; /* Basic Interface - Any Channel */ | 108 | *(skb_put(*skb, 1)) = 0x83; /* Basic Interface - Any Channel */ |
109 | 109 | ||
110 | *(skb_put(*skb, 1)) = 0; /* Keypad.Length = 0 */ | 110 | *(skb_put(*skb, 1)) = 0; /* Keypad.Length = 0 */ |
111 | |||
112 | 111 | ||
113 | *(skb_put(*skb, 1)) = 0; /* CallingPN.Length = 0 */ | ||
114 | *(skb_put(*skb, 1)) = 0; /* CallingPSA.Length = 0 */ | ||
115 | 112 | ||
116 | /* Called Party Number */ | 113 | *(skb_put(*skb, 1)) = 0; /* CallingPN.Length = 0 */ |
117 | *(skb_put(*skb, 1)) = strlen(calledPN) + 1; | 114 | *(skb_put(*skb, 1)) = 0; /* CallingPSA.Length = 0 */ |
118 | *(skb_put(*skb, 1)) = 0x81; | ||
119 | memcpy(skb_put(*skb, strlen(calledPN)), calledPN, strlen(calledPN)); | ||
120 | 115 | ||
121 | /* '#' */ | 116 | /* Called Party Number */ |
117 | *(skb_put(*skb, 1)) = strlen(calledPN) + 1; | ||
118 | *(skb_put(*skb, 1)) = 0x81; | ||
119 | memcpy(skb_put(*skb, strlen(calledPN)), calledPN, strlen(calledPN)); | ||
122 | 120 | ||
123 | *(skb_put(*skb, 1)) = 0; /* CalledPSA.Length = 0 */ | 121 | /* '#' */ |
124 | 122 | ||
125 | /* LLC.Length = 0; */ | 123 | *(skb_put(*skb, 1)) = 0; /* CalledPSA.Length = 0 */ |
126 | /* HLC0.Length = 0; */ | ||
127 | /* HLC1.Length = 0; */ | ||
128 | /* UTUS.Length = 0; */ | ||
129 | memset(skb_put(*skb, 4), 0, 4); | ||
130 | 124 | ||
131 | return len; | 125 | /* LLC.Length = 0; */ |
126 | /* HLC0.Length = 0; */ | ||
127 | /* HLC1.Length = 0; */ | ||
128 | /* UTUS.Length = 0; */ | ||
129 | memset(skb_put(*skb, 4), 0, 4); | ||
130 | |||
131 | return len; | ||
132 | } | 132 | } |
133 | 133 | ||
134 | int capi_conn_resp(struct pcbit_chan* chan, struct sk_buff **skb) | 134 | int capi_conn_resp(struct pcbit_chan *chan, struct sk_buff **skb) |
135 | { | 135 | { |
136 | 136 | ||
137 | if ((*skb = dev_alloc_skb(5)) == NULL) { | 137 | if ((*skb = dev_alloc_skb(5)) == NULL) { |
138 | 138 | ||
139 | printk(KERN_WARNING "capi_conn_resp: alloc_skb failed\n"); | 139 | printk(KERN_WARNING "capi_conn_resp: alloc_skb failed\n"); |
140 | return -1; | 140 | return -1; |
141 | } | 141 | } |
142 | 142 | ||
143 | *((ushort*) skb_put(*skb, 2) ) = chan->callref; | 143 | *((ushort *)skb_put(*skb, 2)) = chan->callref; |
144 | *(skb_put(*skb, 1)) = 0x01; /* ACCEPT_CALL */ | 144 | *(skb_put(*skb, 1)) = 0x01; /* ACCEPT_CALL */ |
145 | *(skb_put(*skb, 1)) = 0; | 145 | *(skb_put(*skb, 1)) = 0; |
146 | *(skb_put(*skb, 1)) = 0; | 146 | *(skb_put(*skb, 1)) = 0; |
147 | 147 | ||
148 | return 5; | 148 | return 5; |
149 | } | 149 | } |
150 | 150 | ||
151 | int capi_conn_active_req(struct pcbit_chan* chan, struct sk_buff **skb) | 151 | int capi_conn_active_req(struct pcbit_chan *chan, struct sk_buff **skb) |
152 | { | 152 | { |
153 | /* | 153 | /* |
154 | * 8 bytes | 154 | * 8 bytes |
155 | */ | 155 | */ |
156 | 156 | ||
157 | if ((*skb = dev_alloc_skb(8)) == NULL) { | 157 | if ((*skb = dev_alloc_skb(8)) == NULL) { |
158 | 158 | ||
159 | printk(KERN_WARNING "capi_conn_active_req: alloc_skb failed\n"); | 159 | printk(KERN_WARNING "capi_conn_active_req: alloc_skb failed\n"); |
160 | return -1; | 160 | return -1; |
161 | } | 161 | } |
162 | 162 | ||
163 | *((ushort*) skb_put(*skb, 2) ) = chan->callref; | 163 | *((ushort *)skb_put(*skb, 2)) = chan->callref; |
164 | 164 | ||
165 | #ifdef DEBUG | 165 | #ifdef DEBUG |
166 | printk(KERN_DEBUG "Call Reference: %04x\n", chan->callref); | 166 | printk(KERN_DEBUG "Call Reference: %04x\n", chan->callref); |
167 | #endif | 167 | #endif |
168 | 168 | ||
169 | *(skb_put(*skb, 1)) = 0; /* BC.Length = 0; */ | 169 | *(skb_put(*skb, 1)) = 0; /* BC.Length = 0; */ |
170 | *(skb_put(*skb, 1)) = 0; /* ConnectedPN.Length = 0 */ | 170 | *(skb_put(*skb, 1)) = 0; /* ConnectedPN.Length = 0 */ |
171 | *(skb_put(*skb, 1)) = 0; /* PSA.Length */ | 171 | *(skb_put(*skb, 1)) = 0; /* PSA.Length */ |
172 | *(skb_put(*skb, 1)) = 0; /* LLC.Length = 0; */ | 172 | *(skb_put(*skb, 1)) = 0; /* LLC.Length = 0; */ |
173 | *(skb_put(*skb, 1)) = 0; /* HLC.Length = 0; */ | 173 | *(skb_put(*skb, 1)) = 0; /* HLC.Length = 0; */ |
174 | *(skb_put(*skb, 1)) = 0; /* UTUS.Length = 0; */ | 174 | *(skb_put(*skb, 1)) = 0; /* UTUS.Length = 0; */ |
175 | 175 | ||
176 | return 8; | 176 | return 8; |
177 | } | 177 | } |
178 | 178 | ||
179 | int capi_conn_active_resp(struct pcbit_chan* chan, struct sk_buff **skb) | 179 | int capi_conn_active_resp(struct pcbit_chan *chan, struct sk_buff **skb) |
180 | { | 180 | { |
181 | /* | 181 | /* |
182 | * 2 bytes | 182 | * 2 bytes |
183 | */ | 183 | */ |
184 | 184 | ||
185 | if ((*skb = dev_alloc_skb(2)) == NULL) { | 185 | if ((*skb = dev_alloc_skb(2)) == NULL) { |
186 | 186 | ||
187 | printk(KERN_WARNING "capi_conn_active_resp: alloc_skb failed\n"); | 187 | printk(KERN_WARNING "capi_conn_active_resp: alloc_skb failed\n"); |
188 | return -1; | 188 | return -1; |
189 | } | 189 | } |
190 | 190 | ||
191 | *((ushort*) skb_put(*skb, 2) ) = chan->callref; | 191 | *((ushort *)skb_put(*skb, 2)) = chan->callref; |
192 | 192 | ||
193 | return 2; | 193 | return 2; |
194 | } | 194 | } |
195 | 195 | ||
196 | 196 | ||
197 | int capi_select_proto_req(struct pcbit_chan *chan, struct sk_buff **skb, | 197 | int capi_select_proto_req(struct pcbit_chan *chan, struct sk_buff **skb, |
198 | int outgoing) | 198 | int outgoing) |
199 | { | 199 | { |
200 | 200 | ||
201 | /* | 201 | /* |
202 | * 18 bytes | 202 | * 18 bytes |
203 | */ | 203 | */ |
204 | 204 | ||
205 | if ((*skb = dev_alloc_skb(18)) == NULL) { | 205 | if ((*skb = dev_alloc_skb(18)) == NULL) { |
206 | 206 | ||
207 | printk(KERN_WARNING "capi_select_proto_req: alloc_skb failed\n"); | 207 | printk(KERN_WARNING "capi_select_proto_req: alloc_skb failed\n"); |
208 | return -1; | 208 | return -1; |
209 | } | 209 | } |
210 | 210 | ||
211 | *((ushort*) skb_put(*skb, 2) ) = chan->callref; | 211 | *((ushort *)skb_put(*skb, 2)) = chan->callref; |
212 | 212 | ||
213 | /* Layer2 protocol */ | 213 | /* Layer2 protocol */ |
214 | 214 | ||
215 | switch (chan->proto) { | 215 | switch (chan->proto) { |
216 | case ISDN_PROTO_L2_X75I: | 216 | case ISDN_PROTO_L2_X75I: |
217 | *(skb_put(*skb, 1)) = 0x05; /* LAPB */ | 217 | *(skb_put(*skb, 1)) = 0x05; /* LAPB */ |
218 | break; | 218 | break; |
219 | case ISDN_PROTO_L2_HDLC: | 219 | case ISDN_PROTO_L2_HDLC: |
220 | *(skb_put(*skb, 1)) = 0x02; | 220 | *(skb_put(*skb, 1)) = 0x02; |
221 | break; | 221 | break; |
222 | case ISDN_PROTO_L2_TRANS: | 222 | case ISDN_PROTO_L2_TRANS: |
223 | /* | 223 | /* |
224 | * Voice (a-law) | 224 | * Voice (a-law) |
225 | */ | 225 | */ |
226 | *(skb_put(*skb, 1)) = 0x06; | 226 | *(skb_put(*skb, 1)) = 0x06; |
227 | break; | 227 | break; |
228 | default: | 228 | default: |
229 | #ifdef DEBUG | 229 | #ifdef DEBUG |
230 | printk(KERN_DEBUG "Transparent\n"); | 230 | printk(KERN_DEBUG "Transparent\n"); |
231 | #endif | 231 | #endif |
232 | *(skb_put(*skb, 1)) = 0x03; | 232 | *(skb_put(*skb, 1)) = 0x03; |
233 | break; | 233 | break; |
234 | } | 234 | } |
235 | 235 | ||
236 | *(skb_put(*skb, 1)) = (outgoing ? 0x02 : 0x42); /* Don't ask */ | 236 | *(skb_put(*skb, 1)) = (outgoing ? 0x02 : 0x42); /* Don't ask */ |
237 | *(skb_put(*skb, 1)) = 0x00; | 237 | *(skb_put(*skb, 1)) = 0x00; |
238 | 238 | ||
239 | *((ushort *) skb_put(*skb, 2)) = MRU; | 239 | *((ushort *) skb_put(*skb, 2)) = MRU; |
240 | 240 | ||
241 | 241 | ||
242 | *(skb_put(*skb, 1)) = 0x08; /* Modulo */ | 242 | *(skb_put(*skb, 1)) = 0x08; /* Modulo */ |
243 | *(skb_put(*skb, 1)) = 0x07; /* Max Window */ | 243 | *(skb_put(*skb, 1)) = 0x07; /* Max Window */ |
244 | 244 | ||
245 | *(skb_put(*skb, 1)) = 0x01; /* No Layer3 Protocol */ | 245 | *(skb_put(*skb, 1)) = 0x01; /* No Layer3 Protocol */ |
246 | 246 | ||
247 | /* | 247 | /* |
248 | * 2 - layer3 MTU [10] | 248 | * 2 - layer3 MTU [10] |
249 | * - Modulo [12] | 249 | * - Modulo [12] |
250 | * - Window | 250 | * - Window |
251 | * - layer1 proto [14] | 251 | * - layer1 proto [14] |
252 | * - bitrate | 252 | * - bitrate |
253 | * - sub-channel [16] | 253 | * - sub-channel [16] |
254 | * - layer1dataformat [17] | 254 | * - layer1dataformat [17] |
255 | */ | 255 | */ |
256 | 256 | ||
257 | memset(skb_put(*skb, 8), 0, 8); | 257 | memset(skb_put(*skb, 8), 0, 8); |
258 | 258 | ||
259 | return 18; | 259 | return 18; |
260 | } | 260 | } |
261 | 261 | ||
262 | 262 | ||
@@ -264,45 +264,45 @@ int capi_activate_transp_req(struct pcbit_chan *chan, struct sk_buff **skb) | |||
264 | { | 264 | { |
265 | 265 | ||
266 | if ((*skb = dev_alloc_skb(7)) == NULL) { | 266 | if ((*skb = dev_alloc_skb(7)) == NULL) { |
267 | 267 | ||
268 | printk(KERN_WARNING "capi_activate_transp_req: alloc_skb failed\n"); | 268 | printk(KERN_WARNING "capi_activate_transp_req: alloc_skb failed\n"); |
269 | return -1; | 269 | return -1; |
270 | } | 270 | } |
271 | 271 | ||
272 | *((ushort*) skb_put(*skb, 2) ) = chan->callref; | 272 | *((ushort *)skb_put(*skb, 2)) = chan->callref; |
273 | 273 | ||
274 | |||
275 | *(skb_put(*skb, 1)) = chan->layer2link; /* Layer2 id */ | ||
276 | *(skb_put(*skb, 1)) = 0x00; /* Transmit by default */ | ||
277 | 274 | ||
278 | *((ushort *) skb_put(*skb, 2)) = MRU; | 275 | *(skb_put(*skb, 1)) = chan->layer2link; /* Layer2 id */ |
276 | *(skb_put(*skb, 1)) = 0x00; /* Transmit by default */ | ||
279 | 277 | ||
280 | *(skb_put(*skb, 1)) = 0x01; /* Enables reception*/ | 278 | *((ushort *) skb_put(*skb, 2)) = MRU; |
281 | 279 | ||
282 | return 7; | 280 | *(skb_put(*skb, 1)) = 0x01; /* Enables reception*/ |
281 | |||
282 | return 7; | ||
283 | } | 283 | } |
284 | 284 | ||
285 | int capi_tdata_req(struct pcbit_chan* chan, struct sk_buff *skb) | 285 | int capi_tdata_req(struct pcbit_chan *chan, struct sk_buff *skb) |
286 | { | 286 | { |
287 | ushort data_len; | 287 | ushort data_len; |
288 | |||
289 | 288 | ||
290 | /* | 289 | |
291 | * callref - 2 | 290 | /* |
291 | * callref - 2 | ||
292 | * layer2link - 1 | 292 | * layer2link - 1 |
293 | * wBlockLength - 2 | 293 | * wBlockLength - 2 |
294 | * data - 4 | 294 | * data - 4 |
295 | * sernum - 1 | 295 | * sernum - 1 |
296 | */ | 296 | */ |
297 | 297 | ||
298 | data_len = skb->len; | 298 | data_len = skb->len; |
299 | 299 | ||
300 | if(skb_headroom(skb) < 10) | 300 | if (skb_headroom(skb) < 10) |
301 | { | 301 | { |
302 | printk(KERN_CRIT "No headspace (%u) on headroom %p for capi header\n", skb_headroom(skb), skb); | 302 | printk(KERN_CRIT "No headspace (%u) on headroom %p for capi header\n", skb_headroom(skb), skb); |
303 | } | 303 | } |
304 | else | 304 | else |
305 | { | 305 | { |
306 | skb_push(skb, 10); | 306 | skb_push(skb, 10); |
307 | } | 307 | } |
308 | 308 | ||
@@ -318,58 +318,58 @@ int capi_tdata_req(struct pcbit_chan* chan, struct sk_buff *skb) | |||
318 | return 10; | 318 | return 10; |
319 | } | 319 | } |
320 | 320 | ||
321 | int capi_tdata_resp(struct pcbit_chan *chan, struct sk_buff ** skb) | 321 | int capi_tdata_resp(struct pcbit_chan *chan, struct sk_buff **skb) |
322 | 322 | ||
323 | { | 323 | { |
324 | if ((*skb = dev_alloc_skb(4)) == NULL) { | 324 | if ((*skb = dev_alloc_skb(4)) == NULL) { |
325 | 325 | ||
326 | printk(KERN_WARNING "capi_tdata_resp: alloc_skb failed\n"); | 326 | printk(KERN_WARNING "capi_tdata_resp: alloc_skb failed\n"); |
327 | return -1; | 327 | return -1; |
328 | } | 328 | } |
329 | 329 | ||
330 | *((ushort*) skb_put(*skb, 2) ) = chan->callref; | 330 | *((ushort *)skb_put(*skb, 2)) = chan->callref; |
331 | 331 | ||
332 | *(skb_put(*skb, 1)) = chan->layer2link; | 332 | *(skb_put(*skb, 1)) = chan->layer2link; |
333 | *(skb_put(*skb, 1)) = chan->r_refnum; | 333 | *(skb_put(*skb, 1)) = chan->r_refnum; |
334 | 334 | ||
335 | return (*skb)->len; | 335 | return (*skb)->len; |
336 | } | 336 | } |
337 | 337 | ||
338 | int capi_disc_req(ushort callref, struct sk_buff **skb, u_char cause) | 338 | int capi_disc_req(ushort callref, struct sk_buff **skb, u_char cause) |
339 | { | 339 | { |
340 | 340 | ||
341 | if ((*skb = dev_alloc_skb(6)) == NULL) { | 341 | if ((*skb = dev_alloc_skb(6)) == NULL) { |
342 | 342 | ||
343 | printk(KERN_WARNING "capi_disc_req: alloc_skb failed\n"); | 343 | printk(KERN_WARNING "capi_disc_req: alloc_skb failed\n"); |
344 | return -1; | 344 | return -1; |
345 | } | 345 | } |
346 | 346 | ||
347 | *((ushort*) skb_put(*skb, 2) ) = callref; | 347 | *((ushort *)skb_put(*skb, 2)) = callref; |
348 | 348 | ||
349 | *(skb_put(*skb, 1)) = 2; /* Cause.Length = 2; */ | 349 | *(skb_put(*skb, 1)) = 2; /* Cause.Length = 2; */ |
350 | *(skb_put(*skb, 1)) = 0x80; | 350 | *(skb_put(*skb, 1)) = 0x80; |
351 | *(skb_put(*skb, 1)) = 0x80 | cause; | 351 | *(skb_put(*skb, 1)) = 0x80 | cause; |
352 | 352 | ||
353 | /* | 353 | /* |
354 | * Change it: we should send 'Sic transit gloria Mundi' here ;-) | 354 | * Change it: we should send 'Sic transit gloria Mundi' here ;-) |
355 | */ | 355 | */ |
356 | 356 | ||
357 | *(skb_put(*skb, 1)) = 0; /* UTUS.Length = 0; */ | 357 | *(skb_put(*skb, 1)) = 0; /* UTUS.Length = 0; */ |
358 | 358 | ||
359 | return 6; | 359 | return 6; |
360 | } | 360 | } |
361 | 361 | ||
362 | int capi_disc_resp(struct pcbit_chan *chan, struct sk_buff **skb) | 362 | int capi_disc_resp(struct pcbit_chan *chan, struct sk_buff **skb) |
363 | { | 363 | { |
364 | if ((*skb = dev_alloc_skb(2)) == NULL) { | 364 | if ((*skb = dev_alloc_skb(2)) == NULL) { |
365 | 365 | ||
366 | printk(KERN_WARNING "capi_disc_resp: alloc_skb failed\n"); | 366 | printk(KERN_WARNING "capi_disc_resp: alloc_skb failed\n"); |
367 | return -1; | 367 | return -1; |
368 | } | 368 | } |
369 | 369 | ||
370 | *((ushort*) skb_put(*skb, 2)) = chan->callref; | 370 | *((ushort *)skb_put(*skb, 2)) = chan->callref; |
371 | 371 | ||
372 | return 2; | 372 | return 2; |
373 | } | 373 | } |
374 | 374 | ||
375 | 375 | ||
@@ -378,57 +378,57 @@ int capi_disc_resp(struct pcbit_chan *chan, struct sk_buff **skb) | |||
378 | * | 378 | * |
379 | */ | 379 | */ |
380 | 380 | ||
381 | int capi_decode_conn_ind(struct pcbit_chan * chan, | 381 | int capi_decode_conn_ind(struct pcbit_chan *chan, |
382 | struct sk_buff *skb, | 382 | struct sk_buff *skb, |
383 | struct callb_data *info) | 383 | struct callb_data *info) |
384 | { | 384 | { |
385 | int CIlen, len; | 385 | int CIlen, len; |
386 | 386 | ||
387 | /* Call Reference [CAPI] */ | 387 | /* Call Reference [CAPI] */ |
388 | chan->callref = *((ushort*) skb->data); | 388 | chan->callref = *((ushort *)skb->data); |
389 | skb_pull(skb, 2); | 389 | skb_pull(skb, 2); |
390 | 390 | ||
391 | #ifdef DEBUG | 391 | #ifdef DEBUG |
392 | printk(KERN_DEBUG "Call Reference: %04x\n", chan->callref); | 392 | printk(KERN_DEBUG "Call Reference: %04x\n", chan->callref); |
393 | #endif | 393 | #endif |
394 | 394 | ||
395 | /* Channel Identification */ | 395 | /* Channel Identification */ |
396 | 396 | ||
397 | /* Expect | 397 | /* Expect |
398 | Len = 1 | 398 | Len = 1 |
399 | Octect 3 = 0100 10CC - [ 7 Basic, 4 , 2-1 chan ] | 399 | Octect 3 = 0100 10CC - [ 7 Basic, 4 , 2-1 chan ] |
400 | */ | 400 | */ |
401 | 401 | ||
402 | CIlen = skb->data[0]; | 402 | CIlen = skb->data[0]; |
403 | #ifdef DEBUG | 403 | #ifdef DEBUG |
404 | if (CIlen == 1) { | 404 | if (CIlen == 1) { |
405 | 405 | ||
406 | if ( ((skb->data[1]) & 0xFC) == 0x48 ) | 406 | if (((skb->data[1]) & 0xFC) == 0x48) |
407 | printk(KERN_DEBUG "decode_conn_ind: chan ok\n"); | 407 | printk(KERN_DEBUG "decode_conn_ind: chan ok\n"); |
408 | printk(KERN_DEBUG "phyChan = %d\n", skb->data[1] & 0x03); | 408 | printk(KERN_DEBUG "phyChan = %d\n", skb->data[1] & 0x03); |
409 | } | 409 | } |
410 | else | 410 | else |
411 | printk(KERN_DEBUG "conn_ind: CIlen = %d\n", CIlen); | 411 | printk(KERN_DEBUG "conn_ind: CIlen = %d\n", CIlen); |
412 | #endif | 412 | #endif |
413 | skb_pull(skb, CIlen + 1); | 413 | skb_pull(skb, CIlen + 1); |
414 | 414 | ||
415 | /* Calling Party Number */ | 415 | /* Calling Party Number */ |
416 | /* An "additional service" as far as Portugal Telecom is concerned */ | 416 | /* An "additional service" as far as Portugal Telecom is concerned */ |
417 | 417 | ||
418 | len = skb->data[0]; | 418 | len = skb->data[0]; |
419 | 419 | ||
420 | if (len > 0) { | 420 | if (len > 0) { |
421 | int count = 1; | 421 | int count = 1; |
422 | 422 | ||
423 | #ifdef DEBUG | 423 | #ifdef DEBUG |
424 | printk(KERN_DEBUG "CPN: Octect 3 %02x\n", skb->data[1]); | 424 | printk(KERN_DEBUG "CPN: Octect 3 %02x\n", skb->data[1]); |
425 | #endif | 425 | #endif |
426 | if ((skb->data[1] & 0x80) == 0) | 426 | if ((skb->data[1] & 0x80) == 0) |
427 | count = 2; | 427 | count = 2; |
428 | 428 | ||
429 | if (!(info->data.setup.CallingPN = kmalloc(len - count + 1, GFP_ATOMIC))) | 429 | if (!(info->data.setup.CallingPN = kmalloc(len - count + 1, GFP_ATOMIC))) |
430 | return -1; | 430 | return -1; |
431 | 431 | ||
432 | skb_copy_from_linear_data_offset(skb, count + 1, | 432 | skb_copy_from_linear_data_offset(skb, count + 1, |
433 | info->data.setup.CallingPN, | 433 | info->data.setup.CallingPN, |
434 | len - count); | 434 | len - count); |
@@ -442,22 +442,22 @@ int capi_decode_conn_ind(struct pcbit_chan * chan, | |||
442 | 442 | ||
443 | skb_pull(skb, len + 1); | 443 | skb_pull(skb, len + 1); |
444 | 444 | ||
445 | /* Calling Party Subaddress */ | 445 | /* Calling Party Subaddress */ |
446 | skb_pull(skb, skb->data[0] + 1); | 446 | skb_pull(skb, skb->data[0] + 1); |
447 | 447 | ||
448 | /* Called Party Number */ | 448 | /* Called Party Number */ |
449 | 449 | ||
450 | len = skb->data[0]; | 450 | len = skb->data[0]; |
451 | 451 | ||
452 | if (len > 0) { | 452 | if (len > 0) { |
453 | int count = 1; | 453 | int count = 1; |
454 | 454 | ||
455 | if ((skb->data[1] & 0x80) == 0) | 455 | if ((skb->data[1] & 0x80) == 0) |
456 | count = 2; | 456 | count = 2; |
457 | 457 | ||
458 | if (!(info->data.setup.CalledPN = kmalloc(len - count + 1, GFP_ATOMIC))) | 458 | if (!(info->data.setup.CalledPN = kmalloc(len - count + 1, GFP_ATOMIC))) |
459 | return -1; | 459 | return -1; |
460 | 460 | ||
461 | skb_copy_from_linear_data_offset(skb, count + 1, | 461 | skb_copy_from_linear_data_offset(skb, count + 1, |
462 | info->data.setup.CalledPN, | 462 | info->data.setup.CalledPN, |
463 | len - count); | 463 | len - count); |
@@ -471,73 +471,73 @@ int capi_decode_conn_ind(struct pcbit_chan * chan, | |||
471 | 471 | ||
472 | skb_pull(skb, len + 1); | 472 | skb_pull(skb, len + 1); |
473 | 473 | ||
474 | /* Called Party Subaddress */ | 474 | /* Called Party Subaddress */ |
475 | skb_pull(skb, skb->data[0] + 1); | 475 | skb_pull(skb, skb->data[0] + 1); |
476 | 476 | ||
477 | /* LLC */ | 477 | /* LLC */ |
478 | skb_pull(skb, skb->data[0] + 1); | 478 | skb_pull(skb, skb->data[0] + 1); |
479 | 479 | ||
480 | /* HLC */ | 480 | /* HLC */ |
481 | skb_pull(skb, skb->data[0] + 1); | 481 | skb_pull(skb, skb->data[0] + 1); |
482 | 482 | ||
483 | /* U2U */ | 483 | /* U2U */ |
484 | skb_pull(skb, skb->data[0] + 1); | 484 | skb_pull(skb, skb->data[0] + 1); |
485 | 485 | ||
486 | return 0; | 486 | return 0; |
487 | } | 487 | } |
488 | 488 | ||
489 | /* | 489 | /* |
490 | * returns errcode | 490 | * returns errcode |
491 | */ | 491 | */ |
492 | 492 | ||
493 | int capi_decode_conn_conf(struct pcbit_chan * chan, struct sk_buff *skb, | 493 | int capi_decode_conn_conf(struct pcbit_chan *chan, struct sk_buff *skb, |
494 | int *complete) | 494 | int *complete) |
495 | { | 495 | { |
496 | int errcode; | 496 | int errcode; |
497 | 497 | ||
498 | chan->callref = *((ushort *) skb->data); /* Update CallReference */ | 498 | chan->callref = *((ushort *)skb->data); /* Update CallReference */ |
499 | skb_pull(skb, 2); | 499 | skb_pull(skb, 2); |
500 | |||
501 | errcode = *((ushort *) skb->data); /* read errcode */ | ||
502 | skb_pull(skb, 2); | ||
500 | 503 | ||
501 | errcode = *((ushort *) skb->data); /* read errcode */ | 504 | *complete = *(skb->data); |
502 | skb_pull(skb, 2); | 505 | skb_pull(skb, 1); |
503 | 506 | ||
504 | *complete = *(skb->data); | 507 | /* FIX ME */ |
505 | skb_pull(skb, 1); | 508 | /* This is actually a firmware bug */ |
509 | if (!*complete) | ||
510 | { | ||
511 | printk(KERN_DEBUG "complete=%02x\n", *complete); | ||
512 | *complete = 1; | ||
513 | } | ||
506 | 514 | ||
507 | /* FIX ME */ | ||
508 | /* This is actually a firmware bug */ | ||
509 | if (!*complete) | ||
510 | { | ||
511 | printk(KERN_DEBUG "complete=%02x\n", *complete); | ||
512 | *complete = 1; | ||
513 | } | ||
514 | 515 | ||
516 | /* Optional Bearer Capability */ | ||
517 | skb_pull(skb, *(skb->data) + 1); | ||
515 | 518 | ||
516 | /* Optional Bearer Capability */ | 519 | /* Channel Identification */ |
517 | skb_pull(skb, *(skb->data) + 1); | 520 | skb_pull(skb, *(skb->data) + 1); |
518 | |||
519 | /* Channel Identification */ | ||
520 | skb_pull(skb, *(skb->data) + 1); | ||
521 | 521 | ||
522 | /* High Layer Compatibility follows */ | 522 | /* High Layer Compatibility follows */ |
523 | skb_pull(skb, *(skb->data) + 1); | 523 | skb_pull(skb, *(skb->data) + 1); |
524 | 524 | ||
525 | return errcode; | 525 | return errcode; |
526 | } | 526 | } |
527 | 527 | ||
528 | int capi_decode_conn_actv_ind(struct pcbit_chan * chan, struct sk_buff *skb) | 528 | int capi_decode_conn_actv_ind(struct pcbit_chan *chan, struct sk_buff *skb) |
529 | { | 529 | { |
530 | ushort len; | 530 | ushort len; |
531 | #ifdef DEBUG | 531 | #ifdef DEBUG |
532 | char str[32]; | 532 | char str[32]; |
533 | #endif | 533 | #endif |
534 | 534 | ||
535 | /* Yet Another Bearer Capability */ | 535 | /* Yet Another Bearer Capability */ |
536 | skb_pull(skb, *(skb->data) + 1); | 536 | skb_pull(skb, *(skb->data) + 1); |
537 | |||
538 | 537 | ||
539 | /* Connected Party Number */ | 538 | |
540 | len=*(skb->data); | 539 | /* Connected Party Number */ |
540 | len = *(skb->data); | ||
541 | 541 | ||
542 | #ifdef DEBUG | 542 | #ifdef DEBUG |
543 | if (len > 1 && len < 31) { | 543 | if (len > 1 && len < 31) { |
@@ -549,106 +549,101 @@ int capi_decode_conn_actv_ind(struct pcbit_chan * chan, struct sk_buff *skb) | |||
549 | printk(KERN_DEBUG "actv_ind CPN len = %d\n", len); | 549 | printk(KERN_DEBUG "actv_ind CPN len = %d\n", len); |
550 | #endif | 550 | #endif |
551 | 551 | ||
552 | skb_pull(skb, len + 1); | 552 | skb_pull(skb, len + 1); |
553 | 553 | ||
554 | /* Connected Subaddress */ | 554 | /* Connected Subaddress */ |
555 | skb_pull(skb, *(skb->data) + 1); | 555 | skb_pull(skb, *(skb->data) + 1); |
556 | 556 | ||
557 | /* Low Layer Capability */ | 557 | /* Low Layer Capability */ |
558 | skb_pull(skb, *(skb->data) + 1); | 558 | skb_pull(skb, *(skb->data) + 1); |
559 | 559 | ||
560 | /* High Layer Capability */ | 560 | /* High Layer Capability */ |
561 | skb_pull(skb, *(skb->data) + 1); | 561 | skb_pull(skb, *(skb->data) + 1); |
562 | 562 | ||
563 | return 0; | 563 | return 0; |
564 | } | 564 | } |
565 | 565 | ||
566 | int capi_decode_conn_actv_conf(struct pcbit_chan * chan, struct sk_buff *skb) | 566 | int capi_decode_conn_actv_conf(struct pcbit_chan *chan, struct sk_buff *skb) |
567 | { | 567 | { |
568 | ushort errcode; | 568 | ushort errcode; |
569 | 569 | ||
570 | errcode = *((ushort*) skb->data); | 570 | errcode = *((ushort *)skb->data); |
571 | skb_pull(skb, 2); | 571 | skb_pull(skb, 2); |
572 | 572 | ||
573 | /* Channel Identification | 573 | /* Channel Identification |
574 | skb_pull(skb, skb->data[0] + 1); | 574 | skb_pull(skb, skb->data[0] + 1); |
575 | */ | 575 | */ |
576 | return errcode; | 576 | return errcode; |
577 | } | 577 | } |
578 | 578 | ||
579 | 579 | ||
580 | int capi_decode_sel_proto_conf(struct pcbit_chan *chan, struct sk_buff *skb) | 580 | int capi_decode_sel_proto_conf(struct pcbit_chan *chan, struct sk_buff *skb) |
581 | { | 581 | { |
582 | ushort errcode; | 582 | ushort errcode; |
583 | |||
584 | chan->layer2link = *(skb->data); | ||
585 | skb_pull(skb, 1); | ||
586 | 583 | ||
587 | errcode = *((ushort*) skb->data); | 584 | chan->layer2link = *(skb->data); |
588 | skb_pull(skb, 2); | 585 | skb_pull(skb, 1); |
589 | 586 | ||
590 | return errcode; | 587 | errcode = *((ushort *)skb->data); |
588 | skb_pull(skb, 2); | ||
589 | |||
590 | return errcode; | ||
591 | } | 591 | } |
592 | 592 | ||
593 | int capi_decode_actv_trans_conf(struct pcbit_chan *chan, struct sk_buff *skb) | 593 | int capi_decode_actv_trans_conf(struct pcbit_chan *chan, struct sk_buff *skb) |
594 | { | 594 | { |
595 | ushort errcode; | 595 | ushort errcode; |
596 | 596 | ||
597 | if (chan->layer2link != *(skb->data) ) | 597 | if (chan->layer2link != *(skb->data)) |
598 | printk("capi_decode_actv_trans_conf: layer2link doesn't match\n"); | 598 | printk("capi_decode_actv_trans_conf: layer2link doesn't match\n"); |
599 | 599 | ||
600 | skb_pull(skb, 1); | 600 | skb_pull(skb, 1); |
601 | 601 | ||
602 | errcode = *((ushort*) skb->data); | 602 | errcode = *((ushort *)skb->data); |
603 | skb_pull(skb, 2); | 603 | skb_pull(skb, 2); |
604 | 604 | ||
605 | return errcode; | 605 | return errcode; |
606 | } | 606 | } |
607 | 607 | ||
608 | int capi_decode_disc_ind(struct pcbit_chan *chan, struct sk_buff *skb) | 608 | int capi_decode_disc_ind(struct pcbit_chan *chan, struct sk_buff *skb) |
609 | { | 609 | { |
610 | ushort len; | 610 | ushort len; |
611 | #ifdef DEBUG | 611 | #ifdef DEBUG |
612 | int i; | 612 | int i; |
613 | #endif | 613 | #endif |
614 | /* Cause */ | 614 | /* Cause */ |
615 | 615 | ||
616 | len = *(skb->data); | 616 | len = *(skb->data); |
617 | skb_pull(skb, 1); | 617 | skb_pull(skb, 1); |
618 | 618 | ||
619 | #ifdef DEBUG | 619 | #ifdef DEBUG |
620 | 620 | ||
621 | for (i=0; i<len; i++) | 621 | for (i = 0; i < len; i++) |
622 | printk(KERN_DEBUG "Cause Octect %d: %02x\n", i+3, | 622 | printk(KERN_DEBUG "Cause Octect %d: %02x\n", i + 3, |
623 | *(skb->data + i)); | 623 | *(skb->data + i)); |
624 | #endif | 624 | #endif |
625 | 625 | ||
626 | skb_pull(skb, len); | 626 | skb_pull(skb, len); |
627 | 627 | ||
628 | return 0; | 628 | return 0; |
629 | } | 629 | } |
630 | 630 | ||
631 | #ifdef DEBUG | 631 | #ifdef DEBUG |
632 | int capi_decode_debug_188(u_char *hdr, ushort hdrlen) | 632 | int capi_decode_debug_188(u_char *hdr, ushort hdrlen) |
633 | { | 633 | { |
634 | char str[64]; | 634 | char str[64]; |
635 | int len; | 635 | int len; |
636 | |||
637 | len = hdr[0]; | ||
638 | |||
639 | if (len < 64 && len == hdrlen - 1) { | ||
640 | memcpy(str, hdr + 1, hdrlen - 1); | ||
641 | str[hdrlen - 1] = 0; | ||
642 | printk("%s\n", str); | ||
643 | } | ||
644 | else | ||
645 | printk("debug message incorrect\n"); | ||
646 | |||
647 | return 0; | ||
648 | } | ||
649 | #endif | ||
650 | |||
651 | |||
652 | 636 | ||
637 | len = hdr[0]; | ||
653 | 638 | ||
639 | if (len < 64 && len == hdrlen - 1) { | ||
640 | memcpy(str, hdr + 1, hdrlen - 1); | ||
641 | str[hdrlen - 1] = 0; | ||
642 | printk("%s\n", str); | ||
643 | } | ||
644 | else | ||
645 | printk("debug message incorrect\n"); | ||
654 | 646 | ||
647 | return 0; | ||
648 | } | ||
649 | #endif | ||
diff --git a/drivers/isdn/pcbit/capi.h b/drivers/isdn/pcbit/capi.h index df8e73c04d7f..635f63476944 100644 --- a/drivers/isdn/pcbit/capi.h +++ b/drivers/isdn/pcbit/capi.h | |||
@@ -2,10 +2,10 @@ | |||
2 | * CAPI encode/decode prototypes and defines | 2 | * CAPI encode/decode prototypes and defines |
3 | * | 3 | * |
4 | * Copyright (C) 1996 Universidade de Lisboa | 4 | * Copyright (C) 1996 Universidade de Lisboa |
5 | * | 5 | * |
6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) | 6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) |
7 | * | 7 | * |
8 | * This software may be used and distributed according to the terms of | 8 | * This software may be used and distributed according to the terms of |
9 | * the GNU General Public License, incorporated herein by reference. | 9 | * the GNU General Public License, incorporated herein by reference. |
10 | */ | 10 | */ |
11 | 11 | ||
@@ -15,42 +15,42 @@ | |||
15 | 15 | ||
16 | #define REQ_CAUSE 0x01 | 16 | #define REQ_CAUSE 0x01 |
17 | #define REQ_DISPLAY 0x04 | 17 | #define REQ_DISPLAY 0x04 |
18 | #define REQ_USER_TO_USER 0x08 | 18 | #define REQ_USER_TO_USER 0x08 |
19 | 19 | ||
20 | #define AppInfoMask REQ_CAUSE|REQ_DISPLAY|REQ_USER_TO_USER | 20 | #define AppInfoMask REQ_CAUSE | REQ_DISPLAY | REQ_USER_TO_USER |
21 | 21 | ||
22 | /* Connection Setup */ | 22 | /* Connection Setup */ |
23 | extern int capi_conn_req(const char * calledPN, struct sk_buff **buf, | 23 | extern int capi_conn_req(const char *calledPN, struct sk_buff **buf, |
24 | int proto); | 24 | int proto); |
25 | extern int capi_decode_conn_conf(struct pcbit_chan * chan, struct sk_buff *skb, | 25 | extern int capi_decode_conn_conf(struct pcbit_chan *chan, struct sk_buff *skb, |
26 | int *complete); | 26 | int *complete); |
27 | 27 | ||
28 | extern int capi_decode_conn_ind(struct pcbit_chan * chan, struct sk_buff *skb, | 28 | extern int capi_decode_conn_ind(struct pcbit_chan *chan, struct sk_buff *skb, |
29 | struct callb_data *info); | 29 | struct callb_data *info); |
30 | extern int capi_conn_resp(struct pcbit_chan* chan, struct sk_buff **skb); | 30 | extern int capi_conn_resp(struct pcbit_chan *chan, struct sk_buff **skb); |
31 | 31 | ||
32 | extern int capi_conn_active_req(struct pcbit_chan* chan, struct sk_buff **skb); | 32 | extern int capi_conn_active_req(struct pcbit_chan *chan, struct sk_buff **skb); |
33 | extern int capi_decode_conn_actv_conf(struct pcbit_chan * chan, | 33 | extern int capi_decode_conn_actv_conf(struct pcbit_chan *chan, |
34 | struct sk_buff *skb); | 34 | struct sk_buff *skb); |
35 | 35 | ||
36 | extern int capi_decode_conn_actv_ind(struct pcbit_chan * chan, | 36 | extern int capi_decode_conn_actv_ind(struct pcbit_chan *chan, |
37 | struct sk_buff *skb); | 37 | struct sk_buff *skb); |
38 | extern int capi_conn_active_resp(struct pcbit_chan* chan, | 38 | extern int capi_conn_active_resp(struct pcbit_chan *chan, |
39 | struct sk_buff **skb); | 39 | struct sk_buff **skb); |
40 | 40 | ||
41 | /* Data */ | 41 | /* Data */ |
42 | extern int capi_select_proto_req(struct pcbit_chan *chan, struct sk_buff **skb, | 42 | extern int capi_select_proto_req(struct pcbit_chan *chan, struct sk_buff **skb, |
43 | int outgoing); | 43 | int outgoing); |
44 | extern int capi_decode_sel_proto_conf(struct pcbit_chan *chan, | 44 | extern int capi_decode_sel_proto_conf(struct pcbit_chan *chan, |
45 | struct sk_buff *skb); | 45 | struct sk_buff *skb); |
46 | 46 | ||
47 | extern int capi_activate_transp_req(struct pcbit_chan *chan, | 47 | extern int capi_activate_transp_req(struct pcbit_chan *chan, |
48 | struct sk_buff **skb); | 48 | struct sk_buff **skb); |
49 | extern int capi_decode_actv_trans_conf(struct pcbit_chan *chan, | 49 | extern int capi_decode_actv_trans_conf(struct pcbit_chan *chan, |
50 | struct sk_buff *skb); | 50 | struct sk_buff *skb); |
51 | 51 | ||
52 | extern int capi_tdata_req(struct pcbit_chan* chan, struct sk_buff *skb); | 52 | extern int capi_tdata_req(struct pcbit_chan *chan, struct sk_buff *skb); |
53 | extern int capi_tdata_resp(struct pcbit_chan *chan, struct sk_buff ** skb); | 53 | extern int capi_tdata_resp(struct pcbit_chan *chan, struct sk_buff **skb); |
54 | 54 | ||
55 | /* Connection Termination */ | 55 | /* Connection Termination */ |
56 | extern int capi_disc_req(ushort callref, struct sk_buff **skb, u_char cause); | 56 | extern int capi_disc_req(ushort callref, struct sk_buff **skb, u_char cause); |
@@ -62,12 +62,12 @@ extern int capi_disc_resp(struct pcbit_chan *chan, struct sk_buff **skb); | |||
62 | extern int capi_decode_debug_188(u_char *hdr, ushort hdrlen); | 62 | extern int capi_decode_debug_188(u_char *hdr, ushort hdrlen); |
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | static inline struct pcbit_chan * | 65 | static inline struct pcbit_chan * |
66 | capi_channel(struct pcbit_dev *dev, struct sk_buff *skb) | 66 | capi_channel(struct pcbit_dev *dev, struct sk_buff *skb) |
67 | { | 67 | { |
68 | ushort callref; | 68 | ushort callref; |
69 | 69 | ||
70 | callref = *((ushort*) skb->data); | 70 | callref = *((ushort *)skb->data); |
71 | skb_pull(skb, 2); | 71 | skb_pull(skb, 2); |
72 | 72 | ||
73 | if (dev->b1->callref == callref) | 73 | if (dev->b1->callref == callref) |
@@ -79,9 +79,3 @@ capi_channel(struct pcbit_dev *dev, struct sk_buff *skb) | |||
79 | } | 79 | } |
80 | 80 | ||
81 | #endif | 81 | #endif |
82 | |||
83 | |||
84 | |||
85 | |||
86 | |||
87 | |||
diff --git a/drivers/isdn/pcbit/drv.c b/drivers/isdn/pcbit/drv.c index 1507d2e83fbb..1eaf62273903 100644 --- a/drivers/isdn/pcbit/drv.c +++ b/drivers/isdn/pcbit/drv.c | |||
@@ -2,10 +2,10 @@ | |||
2 | * PCBIT-D interface with isdn4linux | 2 | * PCBIT-D interface with isdn4linux |
3 | * | 3 | * |
4 | * Copyright (C) 1996 Universidade de Lisboa | 4 | * Copyright (C) 1996 Universidade de Lisboa |
5 | * | 5 | * |
6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) | 6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) |
7 | * | 7 | * |
8 | * This software may be used and distributed according to the terms of | 8 | * This software may be used and distributed according to the terms of |
9 | * the GNU General Public License, incorporated herein by reference. | 9 | * the GNU General Public License, incorporated herein by reference. |
10 | */ | 10 | */ |
11 | 11 | ||
@@ -14,7 +14,7 @@ | |||
14 | * | 14 | * |
15 | * Nuno Grilo <l38486@alfa.ist.utl.pt> | 15 | * Nuno Grilo <l38486@alfa.ist.utl.pt> |
16 | * fixed msn_list NULL pointer dereference. | 16 | * fixed msn_list NULL pointer dereference. |
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
@@ -43,9 +43,9 @@ | |||
43 | 43 | ||
44 | extern ushort last_ref_num; | 44 | extern ushort last_ref_num; |
45 | 45 | ||
46 | static int pcbit_ioctl(isdn_ctrl* ctl); | 46 | static int pcbit_ioctl(isdn_ctrl *ctl); |
47 | 47 | ||
48 | static char* pcbit_devname[MAX_PCBIT_CARDS] = { | 48 | static char *pcbit_devname[MAX_PCBIT_CARDS] = { |
49 | "pcbit0", | 49 | "pcbit0", |
50 | "pcbit1", | 50 | "pcbit1", |
51 | "pcbit2", | 51 | "pcbit2", |
@@ -56,12 +56,12 @@ static char* pcbit_devname[MAX_PCBIT_CARDS] = { | |||
56 | * prototypes | 56 | * prototypes |
57 | */ | 57 | */ |
58 | 58 | ||
59 | static int pcbit_command(isdn_ctrl* ctl); | 59 | static int pcbit_command(isdn_ctrl *ctl); |
60 | static int pcbit_stat(u_char __user * buf, int len, int, int); | 60 | static int pcbit_stat(u_char __user *buf, int len, int, int); |
61 | static int pcbit_xmit(int driver, int chan, int ack, struct sk_buff *skb); | 61 | static int pcbit_xmit(int driver, int chan, int ack, struct sk_buff *skb); |
62 | static int pcbit_writecmd(const u_char __user *, int, int, int); | 62 | static int pcbit_writecmd(const u_char __user *, int, int, int); |
63 | 63 | ||
64 | static int set_protocol_running(struct pcbit_dev * dev); | 64 | static int set_protocol_running(struct pcbit_dev *dev); |
65 | 65 | ||
66 | static void pcbit_clear_msn(struct pcbit_dev *dev); | 66 | static void pcbit_clear_msn(struct pcbit_dev *dev); |
67 | static void pcbit_set_msn(struct pcbit_dev *dev, char *list); | 67 | static void pcbit_set_msn(struct pcbit_dev *dev, char *list); |
@@ -73,7 +73,7 @@ int pcbit_init_dev(int board, int mem_base, int irq) | |||
73 | struct pcbit_dev *dev; | 73 | struct pcbit_dev *dev; |
74 | isdn_if *dev_if; | 74 | isdn_if *dev_if; |
75 | 75 | ||
76 | if ((dev=kzalloc(sizeof(struct pcbit_dev), GFP_KERNEL)) == NULL) | 76 | if ((dev = kzalloc(sizeof(struct pcbit_dev), GFP_KERNEL)) == NULL) |
77 | { | 77 | { |
78 | printk("pcbit_init: couldn't malloc pcbit_dev struct\n"); | 78 | printk("pcbit_init: couldn't malloc pcbit_dev struct\n"); |
79 | return -ENOMEM; | 79 | return -ENOMEM; |
@@ -83,19 +83,19 @@ int pcbit_init_dev(int board, int mem_base, int irq) | |||
83 | init_waitqueue_head(&dev->set_running_wq); | 83 | init_waitqueue_head(&dev->set_running_wq); |
84 | spin_lock_init(&dev->lock); | 84 | spin_lock_init(&dev->lock); |
85 | 85 | ||
86 | if (mem_base >= 0xA0000 && mem_base <= 0xFFFFF ) { | 86 | if (mem_base >= 0xA0000 && mem_base <= 0xFFFFF) { |
87 | dev->ph_mem = mem_base; | 87 | dev->ph_mem = mem_base; |
88 | if (!request_mem_region(dev->ph_mem, 4096, "PCBIT mem")) { | 88 | if (!request_mem_region(dev->ph_mem, 4096, "PCBIT mem")) { |
89 | printk(KERN_WARNING | 89 | printk(KERN_WARNING |
90 | "PCBIT: memory region %lx-%lx already in use\n", | 90 | "PCBIT: memory region %lx-%lx already in use\n", |
91 | dev->ph_mem, dev->ph_mem + 4096); | 91 | dev->ph_mem, dev->ph_mem + 4096); |
92 | kfree(dev); | 92 | kfree(dev); |
93 | dev_pcbit[board] = NULL; | 93 | dev_pcbit[board] = NULL; |
94 | return -EACCES; | 94 | return -EACCES; |
95 | } | 95 | } |
96 | dev->sh_mem = ioremap(dev->ph_mem, 4096); | 96 | dev->sh_mem = ioremap(dev->ph_mem, 4096); |
97 | } | 97 | } |
98 | else | 98 | else |
99 | { | 99 | { |
100 | printk("memory address invalid"); | 100 | printk("memory address invalid"); |
101 | kfree(dev); | 101 | kfree(dev); |
@@ -111,7 +111,7 @@ int pcbit_init_dev(int board, int mem_base, int irq) | |||
111 | kfree(dev); | 111 | kfree(dev); |
112 | return -ENOMEM; | 112 | return -ENOMEM; |
113 | } | 113 | } |
114 | 114 | ||
115 | dev->b2 = kzalloc(sizeof(struct pcbit_chan), GFP_KERNEL); | 115 | dev->b2 = kzalloc(sizeof(struct pcbit_chan), GFP_KERNEL); |
116 | if (!dev->b2) { | 116 | if (!dev->b2) { |
117 | printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); | 117 | printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); |
@@ -130,7 +130,7 @@ int pcbit_init_dev(int board, int mem_base, int irq) | |||
130 | * interrupts | 130 | * interrupts |
131 | */ | 131 | */ |
132 | 132 | ||
133 | if (request_irq(irq, &pcbit_irq_handler, 0, pcbit_devname[board], dev) != 0) | 133 | if (request_irq(irq, &pcbit_irq_handler, 0, pcbit_devname[board], dev) != 0) |
134 | { | 134 | { |
135 | kfree(dev->b1); | 135 | kfree(dev->b1); |
136 | kfree(dev->b2); | 136 | kfree(dev->b2); |
@@ -168,16 +168,16 @@ int pcbit_init_dev(int board, int mem_base, int irq) | |||
168 | dev_if->owner = THIS_MODULE; | 168 | dev_if->owner = THIS_MODULE; |
169 | 169 | ||
170 | dev_if->channels = 2; | 170 | dev_if->channels = 2; |
171 | 171 | ||
172 | dev_if->features = (ISDN_FEATURE_P_EURO | ISDN_FEATURE_L3_TRANS | | 172 | dev_if->features = (ISDN_FEATURE_P_EURO | ISDN_FEATURE_L3_TRANS | |
173 | ISDN_FEATURE_L2_HDLC | ISDN_FEATURE_L2_TRANS ); | 173 | ISDN_FEATURE_L2_HDLC | ISDN_FEATURE_L2_TRANS); |
174 | 174 | ||
175 | dev_if->writebuf_skb = pcbit_xmit; | 175 | dev_if->writebuf_skb = pcbit_xmit; |
176 | dev_if->hl_hdrlen = 16; | 176 | dev_if->hl_hdrlen = 16; |
177 | 177 | ||
178 | dev_if->maxbufsize = MAXBUFSIZE; | 178 | dev_if->maxbufsize = MAXBUFSIZE; |
179 | dev_if->command = pcbit_command; | 179 | dev_if->command = pcbit_command; |
180 | 180 | ||
181 | dev_if->writecmd = pcbit_writecmd; | 181 | dev_if->writecmd = pcbit_writecmd; |
182 | dev_if->readstat = pcbit_stat; | 182 | dev_if->readstat = pcbit_stat; |
183 | 183 | ||
@@ -211,12 +211,12 @@ int pcbit_init_dev(int board, int mem_base, int irq) | |||
211 | #ifdef MODULE | 211 | #ifdef MODULE |
212 | void pcbit_terminate(int board) | 212 | void pcbit_terminate(int board) |
213 | { | 213 | { |
214 | struct pcbit_dev * dev; | 214 | struct pcbit_dev *dev; |
215 | 215 | ||
216 | dev = dev_pcbit[board]; | 216 | dev = dev_pcbit[board]; |
217 | 217 | ||
218 | if (dev) { | 218 | if (dev) { |
219 | /* unregister_isdn(dev->dev_if); */ | 219 | /* unregister_isdn(dev->dev_if); */ |
220 | free_irq(dev->irq, dev); | 220 | free_irq(dev->irq, dev); |
221 | pcbit_clear_msn(dev); | 221 | pcbit_clear_msn(dev); |
222 | kfree(dev->dev_if); | 222 | kfree(dev->dev_if); |
@@ -233,9 +233,9 @@ void pcbit_terminate(int board) | |||
233 | } | 233 | } |
234 | #endif | 234 | #endif |
235 | 235 | ||
236 | static int pcbit_command(isdn_ctrl* ctl) | 236 | static int pcbit_command(isdn_ctrl *ctl) |
237 | { | 237 | { |
238 | struct pcbit_dev *dev; | 238 | struct pcbit_dev *dev; |
239 | struct pcbit_chan *chan; | 239 | struct pcbit_chan *chan; |
240 | struct callb_data info; | 240 | struct callb_data info; |
241 | 241 | ||
@@ -250,7 +250,7 @@ static int pcbit_command(isdn_ctrl* ctl) | |||
250 | chan = (ctl->arg & 0x0F) ? dev->b2 : dev->b1; | 250 | chan = (ctl->arg & 0x0F) ? dev->b2 : dev->b1; |
251 | 251 | ||
252 | 252 | ||
253 | switch(ctl->command) { | 253 | switch (ctl->command) { |
254 | case ISDN_CMD_IOCTL: | 254 | case ISDN_CMD_IOCTL: |
255 | return pcbit_ioctl(ctl); | 255 | return pcbit_ioctl(ctl); |
256 | break; | 256 | break; |
@@ -299,10 +299,10 @@ static int pcbit_command(isdn_ctrl* ctl) | |||
299 | static void pcbit_block_timer(unsigned long data) | 299 | static void pcbit_block_timer(unsigned long data) |
300 | { | 300 | { |
301 | struct pcbit_chan *chan; | 301 | struct pcbit_chan *chan; |
302 | struct pcbit_dev * dev; | 302 | struct pcbit_dev *dev; |
303 | isdn_ctrl ictl; | 303 | isdn_ctrl ictl; |
304 | 304 | ||
305 | chan = (struct pcbit_chan *) data; | 305 | chan = (struct pcbit_chan *)data; |
306 | 306 | ||
307 | dev = chan2dev(chan); | 307 | dev = chan2dev(chan); |
308 | 308 | ||
@@ -316,12 +316,12 @@ static void pcbit_block_timer(unsigned long data) | |||
316 | 316 | ||
317 | #ifdef DEBUG | 317 | #ifdef DEBUG |
318 | printk(KERN_DEBUG "pcbit_block_timer\n"); | 318 | printk(KERN_DEBUG "pcbit_block_timer\n"); |
319 | #endif | 319 | #endif |
320 | chan->queued = 0; | 320 | chan->queued = 0; |
321 | ictl.driver = dev->id; | 321 | ictl.driver = dev->id; |
322 | ictl.command = ISDN_STAT_BSENT; | 322 | ictl.command = ISDN_STAT_BSENT; |
323 | ictl.arg = chan->id; | 323 | ictl.arg = chan->id; |
324 | dev->dev_if->statcallb(&ictl); | 324 | dev->dev_if->statcallb(&ictl); |
325 | } | 325 | } |
326 | #endif | 326 | #endif |
327 | 327 | ||
@@ -329,7 +329,7 @@ static int pcbit_xmit(int driver, int chnum, int ack, struct sk_buff *skb) | |||
329 | { | 329 | { |
330 | ushort hdrlen; | 330 | ushort hdrlen; |
331 | int refnum, len; | 331 | int refnum, len; |
332 | struct pcbit_chan * chan; | 332 | struct pcbit_chan *chan; |
333 | struct pcbit_dev *dev; | 333 | struct pcbit_dev *dev; |
334 | 334 | ||
335 | dev = finddev(driver); | 335 | dev = finddev(driver); |
@@ -345,10 +345,10 @@ static int pcbit_xmit(int driver, int chnum, int ack, struct sk_buff *skb) | |||
345 | if (chan->fsm_state != ST_ACTIVE) | 345 | if (chan->fsm_state != ST_ACTIVE) |
346 | return -1; | 346 | return -1; |
347 | 347 | ||
348 | if (chan->queued >= MAX_QUEUED ) | 348 | if (chan->queued >= MAX_QUEUED) |
349 | { | 349 | { |
350 | #ifdef DEBUG_QUEUE | 350 | #ifdef DEBUG_QUEUE |
351 | printk(KERN_DEBUG | 351 | printk(KERN_DEBUG |
352 | "pcbit: %d packets already in queue - write fails\n", | 352 | "pcbit: %d packets already in queue - write fails\n", |
353 | chan->queued); | 353 | chan->queued); |
354 | #endif | 354 | #endif |
@@ -365,14 +365,14 @@ static int pcbit_xmit(int driver, int chnum, int ack, struct sk_buff *skb) | |||
365 | chan->block_timer.expires = jiffies + 1 * HZ; | 365 | chan->block_timer.expires = jiffies + 1 * HZ; |
366 | add_timer(&chan->block_timer); | 366 | add_timer(&chan->block_timer); |
367 | } | 367 | } |
368 | #endif | 368 | #endif |
369 | return 0; | 369 | return 0; |
370 | } | 370 | } |
371 | 371 | ||
372 | 372 | ||
373 | chan->queued++; | 373 | chan->queued++; |
374 | 374 | ||
375 | len = skb->len; | 375 | len = skb->len; |
376 | 376 | ||
377 | hdrlen = capi_tdata_req(chan, skb); | 377 | hdrlen = capi_tdata_req(chan, skb); |
378 | 378 | ||
@@ -386,10 +386,10 @@ static int pcbit_xmit(int driver, int chnum, int ack, struct sk_buff *skb) | |||
386 | 386 | ||
387 | static int pcbit_writecmd(const u_char __user *buf, int len, int driver, int channel) | 387 | static int pcbit_writecmd(const u_char __user *buf, int len, int driver, int channel) |
388 | { | 388 | { |
389 | struct pcbit_dev * dev; | 389 | struct pcbit_dev *dev; |
390 | int i, j; | 390 | int i, j; |
391 | const u_char * loadbuf; | 391 | const u_char *loadbuf; |
392 | u_char * ptr = NULL; | 392 | u_char *ptr = NULL; |
393 | u_char *cbuf; | 393 | u_char *cbuf; |
394 | 394 | ||
395 | int errstat; | 395 | int errstat; |
@@ -402,7 +402,7 @@ static int pcbit_writecmd(const u_char __user *buf, int len, int driver, int cha | |||
402 | return -ENODEV; | 402 | return -ENODEV; |
403 | } | 403 | } |
404 | 404 | ||
405 | switch(dev->l2_state) { | 405 | switch (dev->l2_state) { |
406 | case L2_LWMODE: | 406 | case L2_LWMODE: |
407 | /* check (size <= rdp_size); write buf into board */ | 407 | /* check (size <= rdp_size); write buf into board */ |
408 | if (len < 0 || len > BANK4 + 1 || len > 1024) | 408 | if (len < 0 || len > BANK4 + 1 || len > 1024) |
@@ -422,19 +422,19 @@ static int pcbit_writecmd(const u_char __user *buf, int len, int driver, int cha | |||
422 | /* this is the hard part */ | 422 | /* this is the hard part */ |
423 | /* dumb board */ | 423 | /* dumb board */ |
424 | /* get it into kernel space */ | 424 | /* get it into kernel space */ |
425 | if ((ptr = kmalloc(len, GFP_KERNEL))==NULL) | 425 | if ((ptr = kmalloc(len, GFP_KERNEL)) == NULL) |
426 | return -ENOMEM; | 426 | return -ENOMEM; |
427 | if (copy_from_user(ptr, buf, len)) { | 427 | if (copy_from_user(ptr, buf, len)) { |
428 | kfree(ptr); | 428 | kfree(ptr); |
429 | return -EFAULT; | 429 | return -EFAULT; |
430 | } | 430 | } |
431 | loadbuf = ptr; | 431 | loadbuf = ptr; |
432 | 432 | ||
433 | errstat = 0; | 433 | errstat = 0; |
434 | 434 | ||
435 | for (i=0; i < len; i++) | 435 | for (i = 0; i < len; i++) |
436 | { | 436 | { |
437 | for(j=0; j < LOAD_RETRY; j++) | 437 | for (j = 0; j < LOAD_RETRY; j++) |
438 | if (!(readb(dev->sh_mem + dev->loadptr))) | 438 | if (!(readb(dev->sh_mem + dev->loadptr))) |
439 | break; | 439 | break; |
440 | 440 | ||
@@ -464,9 +464,9 @@ static int pcbit_writecmd(const u_char __user *buf, int len, int driver, int cha | |||
464 | * | 464 | * |
465 | */ | 465 | */ |
466 | 466 | ||
467 | void pcbit_l3_receive(struct pcbit_dev * dev, ulong msg, | 467 | void pcbit_l3_receive(struct pcbit_dev *dev, ulong msg, |
468 | struct sk_buff * skb, | 468 | struct sk_buff *skb, |
469 | ushort hdr_len, ushort refnum) | 469 | ushort hdr_len, ushort refnum) |
470 | { | 470 | { |
471 | struct pcbit_chan *chan; | 471 | struct pcbit_chan *chan; |
472 | struct sk_buff *skb2; | 472 | struct sk_buff *skb2; |
@@ -475,11 +475,11 @@ void pcbit_l3_receive(struct pcbit_dev * dev, ulong msg, | |||
475 | int complete, err; | 475 | int complete, err; |
476 | isdn_ctrl ictl; | 476 | isdn_ctrl ictl; |
477 | 477 | ||
478 | switch(msg) { | 478 | switch (msg) { |
479 | 479 | ||
480 | case MSG_TDATA_IND: | 480 | case MSG_TDATA_IND: |
481 | if (!(chan = capi_channel(dev, skb))) { | 481 | if (!(chan = capi_channel(dev, skb))) { |
482 | printk(KERN_WARNING | 482 | printk(KERN_WARNING |
483 | "CAPI header: unknown channel id\n"); | 483 | "CAPI header: unknown channel id\n"); |
484 | break; | 484 | break; |
485 | } | 485 | } |
@@ -488,30 +488,30 @@ void pcbit_l3_receive(struct pcbit_dev * dev, ulong msg, | |||
488 | 488 | ||
489 | dev->dev_if->rcvcallb_skb(dev->id, chan->id, skb); | 489 | dev->dev_if->rcvcallb_skb(dev->id, chan->id, skb); |
490 | 490 | ||
491 | if (capi_tdata_resp(chan, &skb2) > 0) | 491 | if (capi_tdata_resp(chan, &skb2) > 0) |
492 | pcbit_l2_write(dev, MSG_TDATA_RESP, refnum, | 492 | pcbit_l2_write(dev, MSG_TDATA_RESP, refnum, |
493 | skb2, skb2->len); | 493 | skb2, skb2->len); |
494 | return; | 494 | return; |
495 | break; | 495 | break; |
496 | case MSG_TDATA_CONF: | 496 | case MSG_TDATA_CONF: |
497 | if (!(chan = capi_channel(dev, skb))) { | 497 | if (!(chan = capi_channel(dev, skb))) { |
498 | printk(KERN_WARNING | 498 | printk(KERN_WARNING |
499 | "CAPI header: unknown channel id\n"); | 499 | "CAPI header: unknown channel id\n"); |
500 | break; | 500 | break; |
501 | } | 501 | } |
502 | 502 | ||
503 | #ifdef DEBUG | 503 | #ifdef DEBUG |
504 | if ( (*((ushort *) (skb->data + 2) )) != 0) { | 504 | if ((*((ushort *)(skb->data + 2))) != 0) { |
505 | printk(KERN_DEBUG "TDATA_CONF error\n"); | 505 | printk(KERN_DEBUG "TDATA_CONF error\n"); |
506 | } | 506 | } |
507 | #endif | 507 | #endif |
508 | #ifdef BLOCK_TIMER | 508 | #ifdef BLOCK_TIMER |
509 | if (chan->queued == MAX_QUEUED) { | 509 | if (chan->queued == MAX_QUEUED) { |
510 | del_timer(&chan->block_timer); | 510 | del_timer(&chan->block_timer); |
511 | chan->block_timer.function = NULL; | 511 | chan->block_timer.function = NULL; |
512 | } | 512 | } |
513 | 513 | ||
514 | #endif | 514 | #endif |
515 | chan->queued--; | 515 | chan->queued--; |
516 | 516 | ||
517 | ictl.driver = dev->id; | 517 | ictl.driver = dev->id; |
@@ -523,7 +523,7 @@ void pcbit_l3_receive(struct pcbit_dev * dev, ulong msg, | |||
523 | case MSG_CONN_IND: | 523 | case MSG_CONN_IND: |
524 | /* | 524 | /* |
525 | * channel: 1st not used will do | 525 | * channel: 1st not used will do |
526 | * if both are used we're in trouble | 526 | * if both are used we're in trouble |
527 | */ | 527 | */ |
528 | 528 | ||
529 | if (!dev->b1->fsm_state) | 529 | if (!dev->b1->fsm_state) |
@@ -531,12 +531,12 @@ void pcbit_l3_receive(struct pcbit_dev * dev, ulong msg, | |||
531 | else if (!dev->b2->fsm_state) | 531 | else if (!dev->b2->fsm_state) |
532 | chan = dev->b2; | 532 | chan = dev->b2; |
533 | else { | 533 | else { |
534 | printk(KERN_INFO | 534 | printk(KERN_INFO |
535 | "Incoming connection: no channels available"); | 535 | "Incoming connection: no channels available"); |
536 | 536 | ||
537 | if ((len = capi_disc_req(*(ushort*)(skb->data), &skb2, CAUSE_NOCHAN)) > 0) | 537 | if ((len = capi_disc_req(*(ushort *)(skb->data), &skb2, CAUSE_NOCHAN)) > 0) |
538 | pcbit_l2_write(dev, MSG_DISC_REQ, refnum, skb2, len); | 538 | pcbit_l2_write(dev, MSG_DISC_REQ, refnum, skb2, len); |
539 | break; | 539 | break; |
540 | } | 540 | } |
541 | 541 | ||
542 | cbdata.data.setup.CalledPN = NULL; | 542 | cbdata.data.setup.CalledPN = NULL; |
@@ -547,7 +547,7 @@ void pcbit_l3_receive(struct pcbit_dev * dev, ulong msg, | |||
547 | 547 | ||
548 | pcbit_fsm_event(dev, chan, EV_NET_SETUP, NULL); | 548 | pcbit_fsm_event(dev, chan, EV_NET_SETUP, NULL); |
549 | 549 | ||
550 | if (pcbit_check_msn(dev, cbdata.data.setup.CallingPN)) | 550 | if (pcbit_check_msn(dev, cbdata.data.setup.CallingPN)) |
551 | pcbit_fsm_event(dev, chan, EV_USR_PROCED_REQ, &cbdata); | 551 | pcbit_fsm_event(dev, chan, EV_USR_PROCED_REQ, &cbdata); |
552 | else | 552 | else |
553 | pcbit_fsm_event(dev, chan, EV_USR_RELEASE_REQ, NULL); | 553 | pcbit_fsm_event(dev, chan, EV_USR_RELEASE_REQ, NULL); |
@@ -555,26 +555,26 @@ void pcbit_l3_receive(struct pcbit_dev * dev, ulong msg, | |||
555 | kfree(cbdata.data.setup.CalledPN); | 555 | kfree(cbdata.data.setup.CalledPN); |
556 | kfree(cbdata.data.setup.CallingPN); | 556 | kfree(cbdata.data.setup.CallingPN); |
557 | break; | 557 | break; |
558 | 558 | ||
559 | case MSG_CONN_CONF: | 559 | case MSG_CONN_CONF: |
560 | /* | 560 | /* |
561 | * We should be able to find the channel by the message | 561 | * We should be able to find the channel by the message |
562 | * reference number. The current version of the firmware | 562 | * reference number. The current version of the firmware |
563 | * doesn't sent the ref number correctly. | 563 | * doesn't sent the ref number correctly. |
564 | */ | 564 | */ |
565 | #ifdef DEBUG | 565 | #ifdef DEBUG |
566 | printk(KERN_DEBUG "refnum=%04x b1=%04x b2=%04x\n", refnum, | 566 | printk(KERN_DEBUG "refnum=%04x b1=%04x b2=%04x\n", refnum, |
567 | dev->b1->s_refnum, | 567 | dev->b1->s_refnum, |
568 | dev->b2->s_refnum); | 568 | dev->b2->s_refnum); |
569 | #endif | 569 | #endif |
570 | /* We just try to find a channel in the right state */ | 570 | /* We just try to find a channel in the right state */ |
571 | 571 | ||
572 | if (dev->b1->fsm_state == ST_CALL_INIT) | 572 | if (dev->b1->fsm_state == ST_CALL_INIT) |
573 | chan = dev->b1; | 573 | chan = dev->b1; |
574 | else { | 574 | else { |
575 | if (dev->b2->s_refnum == ST_CALL_INIT) | 575 | if (dev->b2->s_refnum == ST_CALL_INIT) |
576 | chan = dev->b2; | 576 | chan = dev->b2; |
577 | else { | 577 | else { |
578 | chan = NULL; | 578 | chan = NULL; |
579 | printk(KERN_WARNING "Connection Confirm - no channel in Call Init state\n"); | 579 | printk(KERN_WARNING "Connection Confirm - no channel in Call Init state\n"); |
580 | break; | 580 | break; |
@@ -589,18 +589,18 @@ void pcbit_l3_receive(struct pcbit_dev * dev, ulong msg, | |||
589 | pcbit_fsm_event(dev, chan, EV_NET_CALL_PROC, NULL); | 589 | pcbit_fsm_event(dev, chan, EV_NET_CALL_PROC, NULL); |
590 | else | 590 | else |
591 | pcbit_fsm_event(dev, chan, EV_NET_SETUP_ACK, NULL); | 591 | pcbit_fsm_event(dev, chan, EV_NET_SETUP_ACK, NULL); |
592 | break; | 592 | break; |
593 | case MSG_CONN_ACTV_IND: | 593 | case MSG_CONN_ACTV_IND: |
594 | 594 | ||
595 | if (!(chan = capi_channel(dev, skb))) { | 595 | if (!(chan = capi_channel(dev, skb))) { |
596 | printk(KERN_WARNING | 596 | printk(KERN_WARNING |
597 | "CAPI header: unknown channel id\n"); | 597 | "CAPI header: unknown channel id\n"); |
598 | break; | 598 | break; |
599 | } | 599 | } |
600 | 600 | ||
601 | if (capi_decode_conn_actv_ind(chan, skb)) { | 601 | if (capi_decode_conn_actv_ind(chan, skb)) { |
602 | printk("error in capi_decode_conn_actv_ind\n"); | 602 | printk("error in capi_decode_conn_actv_ind\n"); |
603 | /* pcbit_fsm_event(dev, chan, EV_ERROR, NULL); */ | 603 | /* pcbit_fsm_event(dev, chan, EV_ERROR, NULL); */ |
604 | break; | 604 | break; |
605 | } | 605 | } |
606 | chan->r_refnum = refnum; | 606 | chan->r_refnum = refnum; |
@@ -609,14 +609,14 @@ void pcbit_l3_receive(struct pcbit_dev * dev, ulong msg, | |||
609 | case MSG_CONN_ACTV_CONF: | 609 | case MSG_CONN_ACTV_CONF: |
610 | 610 | ||
611 | if (!(chan = capi_channel(dev, skb))) { | 611 | if (!(chan = capi_channel(dev, skb))) { |
612 | printk(KERN_WARNING | 612 | printk(KERN_WARNING |
613 | "CAPI header: unknown channel id\n"); | 613 | "CAPI header: unknown channel id\n"); |
614 | break; | 614 | break; |
615 | } | 615 | } |
616 | 616 | ||
617 | if (capi_decode_conn_actv_conf(chan, skb) == 0) | 617 | if (capi_decode_conn_actv_conf(chan, skb) == 0) |
618 | pcbit_fsm_event(dev, chan, EV_NET_CONN_ACK, NULL); | 618 | pcbit_fsm_event(dev, chan, EV_NET_CONN_ACK, NULL); |
619 | 619 | ||
620 | else | 620 | else |
621 | printk(KERN_DEBUG "decode_conn_actv_conf failed\n"); | 621 | printk(KERN_DEBUG "decode_conn_actv_conf failed\n"); |
622 | break; | 622 | break; |
@@ -624,7 +624,7 @@ void pcbit_l3_receive(struct pcbit_dev * dev, ulong msg, | |||
624 | case MSG_SELP_CONF: | 624 | case MSG_SELP_CONF: |
625 | 625 | ||
626 | if (!(chan = capi_channel(dev, skb))) { | 626 | if (!(chan = capi_channel(dev, skb))) { |
627 | printk(KERN_WARNING | 627 | printk(KERN_WARNING |
628 | "CAPI header: unknown channel id\n"); | 628 | "CAPI header: unknown channel id\n"); |
629 | break; | 629 | break; |
630 | } | 630 | } |
@@ -638,7 +638,7 @@ void pcbit_l3_receive(struct pcbit_dev * dev, ulong msg, | |||
638 | break; | 638 | break; |
639 | case MSG_ACT_TRANSP_CONF: | 639 | case MSG_ACT_TRANSP_CONF: |
640 | if (!(chan = capi_channel(dev, skb))) { | 640 | if (!(chan = capi_channel(dev, skb))) { |
641 | printk(KERN_WARNING | 641 | printk(KERN_WARNING |
642 | "CAPI header: unknown channel id\n"); | 642 | "CAPI header: unknown channel id\n"); |
643 | break; | 643 | break; |
644 | } | 644 | } |
@@ -650,7 +650,7 @@ void pcbit_l3_receive(struct pcbit_dev * dev, ulong msg, | |||
650 | case MSG_DISC_IND: | 650 | case MSG_DISC_IND: |
651 | 651 | ||
652 | if (!(chan = capi_channel(dev, skb))) { | 652 | if (!(chan = capi_channel(dev, skb))) { |
653 | printk(KERN_WARNING | 653 | printk(KERN_WARNING |
654 | "CAPI header: unknown channel id\n"); | 654 | "CAPI header: unknown channel id\n"); |
655 | break; | 655 | break; |
656 | } | 656 | } |
@@ -662,7 +662,7 @@ void pcbit_l3_receive(struct pcbit_dev * dev, ulong msg, | |||
662 | break; | 662 | break; |
663 | case MSG_DISC_CONF: | 663 | case MSG_DISC_CONF: |
664 | if (!(chan = capi_channel(dev, skb))) { | 664 | if (!(chan = capi_channel(dev, skb))) { |
665 | printk(KERN_WARNING | 665 | printk(KERN_WARNING |
666 | "CAPI header: unknown channel id\n"); | 666 | "CAPI header: unknown channel id\n"); |
667 | break; | 667 | break; |
668 | } | 668 | } |
@@ -711,24 +711,24 @@ static int pcbit_stat(u_char __user *buf, int len, int driver, int channel) | |||
711 | stat_count = STATBUF_LEN - stat_st + stat_end; | 711 | stat_count = STATBUF_LEN - stat_st + stat_end; |
712 | 712 | ||
713 | /* FIXME: should we sleep and wait for more cookies ? */ | 713 | /* FIXME: should we sleep and wait for more cookies ? */ |
714 | if (len > stat_count) | 714 | if (len > stat_count) |
715 | len = stat_count; | 715 | len = stat_count; |
716 | 716 | ||
717 | if (stat_st < stat_end) | 717 | if (stat_st < stat_end) |
718 | { | 718 | { |
719 | if (copy_to_user(buf, statbuf + stat_st, len)) | 719 | if (copy_to_user(buf, statbuf + stat_st, len)) |
720 | return -EFAULT; | 720 | return -EFAULT; |
721 | stat_st += len; | 721 | stat_st += len; |
722 | } | 722 | } |
723 | else | 723 | else |
724 | { | 724 | { |
725 | if (len > STATBUF_LEN - stat_st) | 725 | if (len > STATBUF_LEN - stat_st) |
726 | { | 726 | { |
727 | if (copy_to_user(buf, statbuf + stat_st, | 727 | if (copy_to_user(buf, statbuf + stat_st, |
728 | STATBUF_LEN - stat_st)) | 728 | STATBUF_LEN - stat_st)) |
729 | return -EFAULT; | 729 | return -EFAULT; |
730 | if (copy_to_user(buf, statbuf, | 730 | if (copy_to_user(buf, statbuf, |
731 | len - (STATBUF_LEN - stat_st))) | 731 | len - (STATBUF_LEN - stat_st))) |
732 | return -EFAULT; | 732 | return -EFAULT; |
733 | 733 | ||
734 | stat_st = len - (STATBUF_LEN - stat_st); | 734 | stat_st = len - (STATBUF_LEN - stat_st); |
@@ -739,7 +739,7 @@ static int pcbit_stat(u_char __user *buf, int len, int driver, int channel) | |||
739 | return -EFAULT; | 739 | return -EFAULT; |
740 | 740 | ||
741 | stat_st += len; | 741 | stat_st += len; |
742 | 742 | ||
743 | if (stat_st == STATBUF_LEN) | 743 | if (stat_st == STATBUF_LEN) |
744 | stat_st = 0; | 744 | stat_st = 0; |
745 | } | 745 | } |
@@ -756,27 +756,27 @@ static void pcbit_logstat(struct pcbit_dev *dev, char *str) | |||
756 | int i; | 756 | int i; |
757 | isdn_ctrl ictl; | 757 | isdn_ctrl ictl; |
758 | 758 | ||
759 | for (i=stat_end; i<strlen(str); i++) | 759 | for (i = stat_end; i < strlen(str); i++) |
760 | { | 760 | { |
761 | statbuf[i]=str[i]; | 761 | statbuf[i] = str[i]; |
762 | stat_end = (stat_end + 1) % STATBUF_LEN; | 762 | stat_end = (stat_end + 1) % STATBUF_LEN; |
763 | if (stat_end == stat_st) | 763 | if (stat_end == stat_st) |
764 | stat_st = (stat_st + 1) % STATBUF_LEN; | 764 | stat_st = (stat_st + 1) % STATBUF_LEN; |
765 | } | 765 | } |
766 | 766 | ||
767 | ictl.command=ISDN_STAT_STAVAIL; | 767 | ictl.command = ISDN_STAT_STAVAIL; |
768 | ictl.driver=dev->id; | 768 | ictl.driver = dev->id; |
769 | ictl.arg=strlen(str); | 769 | ictl.arg = strlen(str); |
770 | dev->dev_if->statcallb(&ictl); | 770 | dev->dev_if->statcallb(&ictl); |
771 | } | 771 | } |
772 | 772 | ||
773 | void pcbit_state_change(struct pcbit_dev * dev, struct pcbit_chan * chan, | 773 | void pcbit_state_change(struct pcbit_dev *dev, struct pcbit_chan *chan, |
774 | unsigned short i, unsigned short ev, unsigned short f) | 774 | unsigned short i, unsigned short ev, unsigned short f) |
775 | { | 775 | { |
776 | char buf[256]; | 776 | char buf[256]; |
777 | 777 | ||
778 | sprintf(buf, "change on device: %d channel:%d\n%s -> %s -> %s\n", | 778 | sprintf(buf, "change on device: %d channel:%d\n%s -> %s -> %s\n", |
779 | dev->id, chan->id, | 779 | dev->id, chan->id, |
780 | isdn_state_table[i], strisdnevent(ev), isdn_state_table[f] | 780 | isdn_state_table[i], strisdnevent(ev), isdn_state_table[f] |
781 | ); | 781 | ); |
782 | 782 | ||
@@ -789,7 +789,7 @@ void pcbit_state_change(struct pcbit_dev * dev, struct pcbit_chan * chan, | |||
789 | 789 | ||
790 | static void set_running_timeout(unsigned long ptr) | 790 | static void set_running_timeout(unsigned long ptr) |
791 | { | 791 | { |
792 | struct pcbit_dev * dev; | 792 | struct pcbit_dev *dev; |
793 | 793 | ||
794 | #ifdef DEBUG | 794 | #ifdef DEBUG |
795 | printk(KERN_DEBUG "set_running_timeout\n"); | 795 | printk(KERN_DEBUG "set_running_timeout\n"); |
@@ -799,7 +799,7 @@ static void set_running_timeout(unsigned long ptr) | |||
799 | wake_up_interruptible(&dev->set_running_wq); | 799 | wake_up_interruptible(&dev->set_running_wq); |
800 | } | 800 | } |
801 | 801 | ||
802 | static int set_protocol_running(struct pcbit_dev * dev) | 802 | static int set_protocol_running(struct pcbit_dev *dev) |
803 | { | 803 | { |
804 | isdn_ctrl ctl; | 804 | isdn_ctrl ctl; |
805 | 805 | ||
@@ -813,7 +813,7 @@ static int set_protocol_running(struct pcbit_dev * dev) | |||
813 | 813 | ||
814 | dev->l2_state = L2_STARTING; | 814 | dev->l2_state = L2_STARTING; |
815 | 815 | ||
816 | writeb((0x80U | ((dev->rcv_seq & 0x07) << 3) | (dev->send_seq & 0x07)), | 816 | writeb((0x80U | ((dev->rcv_seq & 0x07) << 3) | (dev->send_seq & 0x07)), |
817 | dev->sh_mem + BANK4); | 817 | dev->sh_mem + BANK4); |
818 | 818 | ||
819 | add_timer(&dev->set_running_timer); | 819 | add_timer(&dev->set_running_timer); |
@@ -830,8 +830,8 @@ static int set_protocol_running(struct pcbit_dev * dev) | |||
830 | 830 | ||
831 | dev->writeptr = dev->sh_mem; | 831 | dev->writeptr = dev->sh_mem; |
832 | dev->readptr = dev->sh_mem + BANK2; | 832 | dev->readptr = dev->sh_mem + BANK2; |
833 | 833 | ||
834 | /* tell the good news to the upper layer */ | 834 | /* tell the good news to the upper layer */ |
835 | ctl.driver = dev->id; | 835 | ctl.driver = dev->id; |
836 | ctl.command = ISDN_STAT_RUN; | 836 | ctl.command = ISDN_STAT_RUN; |
837 | 837 | ||
@@ -845,7 +845,7 @@ static int set_protocol_running(struct pcbit_dev * dev) | |||
845 | dev->l2_state = L2_DOWN; | 845 | dev->l2_state = L2_DOWN; |
846 | 846 | ||
847 | #ifdef DEBUG | 847 | #ifdef DEBUG |
848 | printk(KERN_DEBUG "Bank3 = %02x\n", | 848 | printk(KERN_DEBUG "Bank3 = %02x\n", |
849 | readb(dev->sh_mem + BANK3)); | 849 | readb(dev->sh_mem + BANK3)); |
850 | #endif | 850 | #endif |
851 | writeb(0x40, dev->sh_mem + BANK4); | 851 | writeb(0x40, dev->sh_mem + BANK4); |
@@ -862,13 +862,13 @@ static int set_protocol_running(struct pcbit_dev * dev) | |||
862 | return 0; | 862 | return 0; |
863 | } | 863 | } |
864 | 864 | ||
865 | static int pcbit_ioctl(isdn_ctrl* ctl) | 865 | static int pcbit_ioctl(isdn_ctrl *ctl) |
866 | { | 866 | { |
867 | struct pcbit_dev * dev; | 867 | struct pcbit_dev *dev; |
868 | struct pcbit_ioctl *cmd; | 868 | struct pcbit_ioctl *cmd; |
869 | 869 | ||
870 | dev = finddev(ctl->driver); | 870 | dev = finddev(ctl->driver); |
871 | 871 | ||
872 | if (!dev) | 872 | if (!dev) |
873 | { | 873 | { |
874 | printk(KERN_DEBUG "pcbit_ioctl: unknown device\n"); | 874 | printk(KERN_DEBUG "pcbit_ioctl: unknown device\n"); |
@@ -877,7 +877,7 @@ static int pcbit_ioctl(isdn_ctrl* ctl) | |||
877 | 877 | ||
878 | cmd = (struct pcbit_ioctl *) ctl->parm.num; | 878 | cmd = (struct pcbit_ioctl *) ctl->parm.num; |
879 | 879 | ||
880 | switch(ctl->arg) { | 880 | switch (ctl->arg) { |
881 | case PCBIT_IOCTL_GETSTAT: | 881 | case PCBIT_IOCTL_GETSTAT: |
882 | cmd->info.l2_status = dev->l2_state; | 882 | cmd->info.l2_status = dev->l2_state; |
883 | break; | 883 | break; |
@@ -890,7 +890,7 @@ static int pcbit_ioctl(isdn_ctrl* ctl) | |||
890 | 890 | ||
891 | dev->writeptr = dev->sh_mem; | 891 | dev->writeptr = dev->sh_mem; |
892 | dev->readptr = dev->sh_mem + BANK2; | 892 | dev->readptr = dev->sh_mem + BANK2; |
893 | 893 | ||
894 | dev->l2_state = L2_LOADING; | 894 | dev->l2_state = L2_LOADING; |
895 | break; | 895 | break; |
896 | 896 | ||
@@ -907,21 +907,21 @@ static int pcbit_ioctl(isdn_ctrl* ctl) | |||
907 | dev->loadptr = LOAD_ZONE_START; | 907 | dev->loadptr = LOAD_ZONE_START; |
908 | dev->l2_state = L2_FWMODE; | 908 | dev->l2_state = L2_FWMODE; |
909 | 909 | ||
910 | break; | 910 | break; |
911 | case PCBIT_IOCTL_ENDLOAD: | 911 | case PCBIT_IOCTL_ENDLOAD: |
912 | if (dev->l2_state == L2_RUNNING) | 912 | if (dev->l2_state == L2_RUNNING) |
913 | return -EBUSY; | 913 | return -EBUSY; |
914 | dev->l2_state = L2_DOWN; | 914 | dev->l2_state = L2_DOWN; |
915 | break; | 915 | break; |
916 | 916 | ||
917 | case PCBIT_IOCTL_SETBYTE: | 917 | case PCBIT_IOCTL_SETBYTE: |
918 | if (dev->l2_state == L2_RUNNING) | 918 | if (dev->l2_state == L2_RUNNING) |
919 | return -EBUSY; | 919 | return -EBUSY; |
920 | 920 | ||
921 | /* check addr */ | 921 | /* check addr */ |
922 | if (cmd->info.rdp_byte.addr > BANK4) | 922 | if (cmd->info.rdp_byte.addr > BANK4) |
923 | return -EFAULT; | 923 | return -EFAULT; |
924 | 924 | ||
925 | writeb(cmd->info.rdp_byte.value, dev->sh_mem + cmd->info.rdp_byte.addr); | 925 | writeb(cmd->info.rdp_byte.value, dev->sh_mem + cmd->info.rdp_byte.addr); |
926 | break; | 926 | break; |
927 | case PCBIT_IOCTL_GETBYTE: | 927 | case PCBIT_IOCTL_GETBYTE: |
@@ -935,10 +935,10 @@ static int pcbit_ioctl(isdn_ctrl* ctl) | |||
935 | printk("getbyte: invalid addr %04x\n", cmd->info.rdp_byte.addr); | 935 | printk("getbyte: invalid addr %04x\n", cmd->info.rdp_byte.addr); |
936 | return -EFAULT; | 936 | return -EFAULT; |
937 | } | 937 | } |
938 | 938 | ||
939 | cmd->info.rdp_byte.value = readb(dev->sh_mem + cmd->info.rdp_byte.addr); | 939 | cmd->info.rdp_byte.value = readb(dev->sh_mem + cmd->info.rdp_byte.addr); |
940 | break; | 940 | break; |
941 | case PCBIT_IOCTL_RUNNING: | 941 | case PCBIT_IOCTL_RUNNING: |
942 | if (dev->l2_state == L2_RUNNING) | 942 | if (dev->l2_state == L2_RUNNING) |
943 | return -EBUSY; | 943 | return -EBUSY; |
944 | return set_protocol_running(dev); | 944 | return set_protocol_running(dev); |
@@ -972,25 +972,25 @@ static int pcbit_ioctl(isdn_ctrl* ctl) | |||
972 | return 0; | 972 | return 0; |
973 | } | 973 | } |
974 | 974 | ||
975 | /* | 975 | /* |
976 | * MSN list handling | 976 | * MSN list handling |
977 | * | 977 | * |
978 | * if null reject all calls | 978 | * if null reject all calls |
979 | * if first entry has null MSN accept all calls | 979 | * if first entry has null MSN accept all calls |
980 | */ | 980 | */ |
981 | 981 | ||
982 | static void pcbit_clear_msn(struct pcbit_dev *dev) | 982 | static void pcbit_clear_msn(struct pcbit_dev *dev) |
983 | { | 983 | { |
984 | struct msn_entry *ptr, *back; | 984 | struct msn_entry *ptr, *back; |
985 | 985 | ||
986 | for (ptr=dev->msn_list; ptr; ) | 986 | for (ptr = dev->msn_list; ptr;) |
987 | { | 987 | { |
988 | back = ptr->next; | 988 | back = ptr->next; |
989 | kfree(ptr); | 989 | kfree(ptr); |
990 | ptr = back; | 990 | ptr = back; |
991 | } | 991 | } |
992 | 992 | ||
993 | dev->msn_list = NULL; | 993 | dev->msn_list = NULL; |
994 | } | 994 | } |
995 | 995 | ||
996 | static void pcbit_set_msn(struct pcbit_dev *dev, char *list) | 996 | static void pcbit_set_msn(struct pcbit_dev *dev, char *list) |
@@ -1016,12 +1016,12 @@ static void pcbit_set_msn(struct pcbit_dev *dev, char *list) | |||
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | if (dev->msn_list) | 1018 | if (dev->msn_list) |
1019 | for (back=dev->msn_list; back->next; back=back->next); | 1019 | for (back = dev->msn_list; back->next; back = back->next); |
1020 | 1020 | ||
1021 | sp = list; | 1021 | sp = list; |
1022 | 1022 | ||
1023 | do { | 1023 | do { |
1024 | cp=strchr(sp, ','); | 1024 | cp = strchr(sp, ','); |
1025 | if (cp) | 1025 | if (cp) |
1026 | len = cp - sp; | 1026 | len = cp - sp; |
1027 | else | 1027 | else |
@@ -1034,7 +1034,7 @@ static void pcbit_set_msn(struct pcbit_dev *dev, char *list) | |||
1034 | return; | 1034 | return; |
1035 | } | 1035 | } |
1036 | ptr->next = NULL; | 1036 | ptr->next = NULL; |
1037 | 1037 | ||
1038 | ptr->msn = kmalloc(len, GFP_ATOMIC); | 1038 | ptr->msn = kmalloc(len, GFP_ATOMIC); |
1039 | if (!ptr->msn) { | 1039 | if (!ptr->msn) { |
1040 | printk(KERN_WARNING "kmalloc failed\n"); | 1040 | printk(KERN_WARNING "kmalloc failed\n"); |
@@ -1054,7 +1054,7 @@ static void pcbit_set_msn(struct pcbit_dev *dev, char *list) | |||
1054 | back->next = ptr; | 1054 | back->next = ptr; |
1055 | back = ptr; | 1055 | back = ptr; |
1056 | sp += len; | 1056 | sp += len; |
1057 | } while(cp); | 1057 | } while (cp); |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | /* | 1060 | /* |
@@ -1063,12 +1063,12 @@ static void pcbit_set_msn(struct pcbit_dev *dev, char *list) | |||
1063 | static int pcbit_check_msn(struct pcbit_dev *dev, char *msn) | 1063 | static int pcbit_check_msn(struct pcbit_dev *dev, char *msn) |
1064 | { | 1064 | { |
1065 | struct msn_entry *ptr; | 1065 | struct msn_entry *ptr; |
1066 | |||
1067 | for (ptr=dev->msn_list; ptr; ptr=ptr->next) { | ||
1068 | 1066 | ||
1069 | if (ptr->msn == NULL) | 1067 | for (ptr = dev->msn_list; ptr; ptr = ptr->next) { |
1068 | |||
1069 | if (ptr->msn == NULL) | ||
1070 | return 1; | 1070 | return 1; |
1071 | 1071 | ||
1072 | if (strcmp(ptr->msn, msn) == 0) | 1072 | if (strcmp(ptr->msn, msn) == 0) |
1073 | return 1; | 1073 | return 1; |
1074 | } | 1074 | } |
diff --git a/drivers/isdn/pcbit/edss1.c b/drivers/isdn/pcbit/edss1.c index 80c9c16fd5ef..b2262ba6f0c9 100644 --- a/drivers/isdn/pcbit/edss1.c +++ b/drivers/isdn/pcbit/edss1.c | |||
@@ -3,10 +3,10 @@ | |||
3 | * base: ITU-T Rec Q.931 | 3 | * base: ITU-T Rec Q.931 |
4 | * | 4 | * |
5 | * Copyright (C) 1996 Universidade de Lisboa | 5 | * Copyright (C) 1996 Universidade de Lisboa |
6 | * | 6 | * |
7 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) | 7 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) |
8 | * | 8 | * |
9 | * This software may be used and distributed according to the terms of | 9 | * This software may be used and distributed according to the terms of |
10 | * the GNU General Public License, incorporated herein by reference. | 10 | * the GNU General Public License, incorporated herein by reference. |
11 | */ | 11 | */ |
12 | 12 | ||
@@ -34,145 +34,145 @@ | |||
34 | 34 | ||
35 | 35 | ||
36 | const char * const isdn_state_table[] = { | 36 | const char * const isdn_state_table[] = { |
37 | "Closed", | 37 | "Closed", |
38 | "Call initiated", | 38 | "Call initiated", |
39 | "Overlap sending", | 39 | "Overlap sending", |
40 | "Outgoing call proceeding", | 40 | "Outgoing call proceeding", |
41 | "NOT DEFINED", | 41 | "NOT DEFINED", |
42 | "Call delivered", | 42 | "Call delivered", |
43 | "Call present", | 43 | "Call present", |
44 | "Call received", | 44 | "Call received", |
45 | "Connect request", | 45 | "Connect request", |
46 | "Incoming call proceeding", | 46 | "Incoming call proceeding", |
47 | "Active", | 47 | "Active", |
48 | "Disconnect request", | 48 | "Disconnect request", |
49 | "Disconnect indication", | 49 | "Disconnect indication", |
50 | "NOT DEFINED", | 50 | "NOT DEFINED", |
51 | "NOT DEFINED", | 51 | "NOT DEFINED", |
52 | "Suspend request", | 52 | "Suspend request", |
53 | "NOT DEFINED", | 53 | "NOT DEFINED", |
54 | "Resume request", | 54 | "Resume request", |
55 | "NOT DEFINED", | 55 | "NOT DEFINED", |
56 | "Release Request", | 56 | "Release Request", |
57 | "NOT DEFINED", | 57 | "NOT DEFINED", |
58 | "NOT DEFINED", | 58 | "NOT DEFINED", |
59 | "NOT DEFINED", | 59 | "NOT DEFINED", |
60 | "NOT DEFINED", | 60 | "NOT DEFINED", |
61 | "NOT DEFINED", | 61 | "NOT DEFINED", |
62 | "Overlap receiving", | 62 | "Overlap receiving", |
63 | "Select protocol on B-Channel", | 63 | "Select protocol on B-Channel", |
64 | "Activate B-channel protocol" | 64 | "Activate B-channel protocol" |
65 | }; | 65 | }; |
66 | 66 | ||
67 | #ifdef DEBUG_ERRS | 67 | #ifdef DEBUG_ERRS |
68 | static | 68 | static |
69 | struct CauseValue { | 69 | struct CauseValue { |
70 | byte nr; | 70 | byte nr; |
71 | char *descr; | 71 | char *descr; |
72 | } cvlist[]={ | 72 | } cvlist[] = { |
73 | {0x01,"Unallocated (unassigned) number"}, | 73 | {0x01, "Unallocated (unassigned) number"}, |
74 | {0x02,"No route to specified transit network"}, | 74 | {0x02, "No route to specified transit network"}, |
75 | {0x03,"No route to destination"}, | 75 | {0x03, "No route to destination"}, |
76 | {0x04,"Send special information tone"}, | 76 | {0x04, "Send special information tone"}, |
77 | {0x05,"Misdialled trunk prefix"}, | 77 | {0x05, "Misdialled trunk prefix"}, |
78 | {0x06,"Channel unacceptable"}, | 78 | {0x06, "Channel unacceptable"}, |
79 | {0x07,"Channel awarded and being delivered in an established channel"}, | 79 | {0x07, "Channel awarded and being delivered in an established channel"}, |
80 | {0x08,"Preemption"}, | 80 | {0x08, "Preemption"}, |
81 | {0x09,"Preemption - circuit reserved for reuse"}, | 81 | {0x09, "Preemption - circuit reserved for reuse"}, |
82 | {0x10,"Normal call clearing"}, | 82 | {0x10, "Normal call clearing"}, |
83 | {0x11,"User busy"}, | 83 | {0x11, "User busy"}, |
84 | {0x12,"No user responding"}, | 84 | {0x12, "No user responding"}, |
85 | {0x13,"No answer from user (user alerted)"}, | 85 | {0x13, "No answer from user (user alerted)"}, |
86 | {0x14,"Subscriber absent"}, | 86 | {0x14, "Subscriber absent"}, |
87 | {0x15,"Call rejected"}, | 87 | {0x15, "Call rejected"}, |
88 | {0x16,"Number changed"}, | 88 | {0x16, "Number changed"}, |
89 | {0x1a,"non-selected user clearing"}, | 89 | {0x1a, "non-selected user clearing"}, |
90 | {0x1b,"Destination out of order"}, | 90 | {0x1b, "Destination out of order"}, |
91 | {0x1c,"Invalid number format (address incomplete)"}, | 91 | {0x1c, "Invalid number format (address incomplete)"}, |
92 | {0x1d,"Facility rejected"}, | 92 | {0x1d, "Facility rejected"}, |
93 | {0x1e,"Response to Status enquiry"}, | 93 | {0x1e, "Response to Status enquiry"}, |
94 | {0x1f,"Normal, unspecified"}, | 94 | {0x1f, "Normal, unspecified"}, |
95 | {0x22,"No circuit/channel available"}, | 95 | {0x22, "No circuit/channel available"}, |
96 | {0x26,"Network out of order"}, | 96 | {0x26, "Network out of order"}, |
97 | {0x27,"Permanent frame mode connection out-of-service"}, | 97 | {0x27, "Permanent frame mode connection out-of-service"}, |
98 | {0x28,"Permanent frame mode connection operational"}, | 98 | {0x28, "Permanent frame mode connection operational"}, |
99 | {0x29,"Temporary failure"}, | 99 | {0x29, "Temporary failure"}, |
100 | {0x2a,"Switching equipment congestion"}, | 100 | {0x2a, "Switching equipment congestion"}, |
101 | {0x2b,"Access information discarded"}, | 101 | {0x2b, "Access information discarded"}, |
102 | {0x2c,"Requested circuit/channel not available"}, | 102 | {0x2c, "Requested circuit/channel not available"}, |
103 | {0x2e,"Precedence call blocked"}, | 103 | {0x2e, "Precedence call blocked"}, |
104 | {0x2f,"Resource unavailable, unspecified"}, | 104 | {0x2f, "Resource unavailable, unspecified"}, |
105 | {0x31,"Quality of service unavailable"}, | 105 | {0x31, "Quality of service unavailable"}, |
106 | {0x32,"Requested facility not subscribed"}, | 106 | {0x32, "Requested facility not subscribed"}, |
107 | {0x35,"Outgoing calls barred within CUG"}, | 107 | {0x35, "Outgoing calls barred within CUG"}, |
108 | {0x37,"Incoming calls barred within CUG"}, | 108 | {0x37, "Incoming calls barred within CUG"}, |
109 | {0x39,"Bearer capability not authorized"}, | 109 | {0x39, "Bearer capability not authorized"}, |
110 | {0x3a,"Bearer capability not presently available"}, | 110 | {0x3a, "Bearer capability not presently available"}, |
111 | {0x3e,"Inconsistency in designated outgoing access information and subscriber class"}, | 111 | {0x3e, "Inconsistency in designated outgoing access information and subscriber class"}, |
112 | {0x3f,"Service or option not available, unspecified"}, | 112 | {0x3f, "Service or option not available, unspecified"}, |
113 | {0x41,"Bearer capability not implemented"}, | 113 | {0x41, "Bearer capability not implemented"}, |
114 | {0x42,"Channel type not implemented"}, | 114 | {0x42, "Channel type not implemented"}, |
115 | {0x43,"Requested facility not implemented"}, | 115 | {0x43, "Requested facility not implemented"}, |
116 | {0x44,"Only restricted digital information bearer capability is available"}, | 116 | {0x44, "Only restricted digital information bearer capability is available"}, |
117 | {0x4f,"Service or option not implemented"}, | 117 | {0x4f, "Service or option not implemented"}, |
118 | {0x51,"Invalid call reference value"}, | 118 | {0x51, "Invalid call reference value"}, |
119 | {0x52,"Identified channel does not exist"}, | 119 | {0x52, "Identified channel does not exist"}, |
120 | {0x53,"A suspended call exists, but this call identity does not"}, | 120 | {0x53, "A suspended call exists, but this call identity does not"}, |
121 | {0x54,"Call identity in use"}, | 121 | {0x54, "Call identity in use"}, |
122 | {0x55,"No call suspended"}, | 122 | {0x55, "No call suspended"}, |
123 | {0x56,"Call having the requested call identity has been cleared"}, | 123 | {0x56, "Call having the requested call identity has been cleared"}, |
124 | {0x57,"User not member of CUG"}, | 124 | {0x57, "User not member of CUG"}, |
125 | {0x58,"Incompatible destination"}, | 125 | {0x58, "Incompatible destination"}, |
126 | {0x5a,"Non-existent CUG"}, | 126 | {0x5a, "Non-existent CUG"}, |
127 | {0x5b,"Invalid transit network selection"}, | 127 | {0x5b, "Invalid transit network selection"}, |
128 | {0x5f,"Invalid message, unspecified"}, | 128 | {0x5f, "Invalid message, unspecified"}, |
129 | {0x60,"Mandatory information element is missing"}, | 129 | {0x60, "Mandatory information element is missing"}, |
130 | {0x61,"Message type non-existent or not implemented"}, | 130 | {0x61, "Message type non-existent or not implemented"}, |
131 | {0x62,"Message not compatible with call state or message type non-existent or not implemented"}, | 131 | {0x62, "Message not compatible with call state or message type non-existent or not implemented"}, |
132 | {0x63,"Information element/parameter non-existent or not implemented"}, | 132 | {0x63, "Information element/parameter non-existent or not implemented"}, |
133 | {0x64,"Invalid information element contents"}, | 133 | {0x64, "Invalid information element contents"}, |
134 | {0x65,"Message not compatible with call state"}, | 134 | {0x65, "Message not compatible with call state"}, |
135 | {0x66,"Recovery on timer expiry"}, | 135 | {0x66, "Recovery on timer expiry"}, |
136 | {0x67,"Parameter non-existent or not implemented - passed on"}, | 136 | {0x67, "Parameter non-existent or not implemented - passed on"}, |
137 | {0x6e,"Message with unrecognized parameter discarded"}, | 137 | {0x6e, "Message with unrecognized parameter discarded"}, |
138 | {0x6f,"Protocol error, unspecified"}, | 138 | {0x6f, "Protocol error, unspecified"}, |
139 | {0x7f,"Interworking, unspecified"} | 139 | {0x7f, "Interworking, unspecified"} |
140 | }; | 140 | }; |
141 | 141 | ||
142 | #endif | 142 | #endif |
143 | 143 | ||
144 | static struct isdn_event_desc { | 144 | static struct isdn_event_desc { |
145 | unsigned short ev; | 145 | unsigned short ev; |
146 | char * desc; | 146 | char *desc; |
147 | } isdn_event_table [] = { | 147 | } isdn_event_table[] = { |
148 | {EV_USR_SETUP_REQ, "CC->L3: Setup Request"}, | 148 | {EV_USR_SETUP_REQ, "CC->L3: Setup Request"}, |
149 | {EV_USR_SETUP_RESP, "CC->L3: Setup Response"}, | 149 | {EV_USR_SETUP_RESP, "CC->L3: Setup Response"}, |
150 | {EV_USR_PROCED_REQ, "CC->L3: Proceeding Request"}, | 150 | {EV_USR_PROCED_REQ, "CC->L3: Proceeding Request"}, |
151 | {EV_USR_RELEASE_REQ, "CC->L3: Release Request"}, | 151 | {EV_USR_RELEASE_REQ, "CC->L3: Release Request"}, |
152 | 152 | ||
153 | {EV_NET_SETUP, "NET->TE: setup "}, | 153 | {EV_NET_SETUP, "NET->TE: setup "}, |
154 | {EV_NET_CALL_PROC, "NET->TE: call proceeding"}, | 154 | {EV_NET_CALL_PROC, "NET->TE: call proceeding"}, |
155 | {EV_NET_SETUP_ACK, "NET->TE: setup acknowledge (more info needed)"}, | 155 | {EV_NET_SETUP_ACK, "NET->TE: setup acknowledge (more info needed)"}, |
156 | {EV_NET_CONN, "NET->TE: connect"}, | 156 | {EV_NET_CONN, "NET->TE: connect"}, |
157 | {EV_NET_CONN_ACK, "NET->TE: connect acknowledge"}, | 157 | {EV_NET_CONN_ACK, "NET->TE: connect acknowledge"}, |
158 | {EV_NET_DISC, "NET->TE: disconnect indication"}, | 158 | {EV_NET_DISC, "NET->TE: disconnect indication"}, |
159 | {EV_NET_RELEASE, "NET->TE: release"}, | 159 | {EV_NET_RELEASE, "NET->TE: release"}, |
160 | {EV_NET_RELEASE_COMP, "NET->TE: release complete"}, | 160 | {EV_NET_RELEASE_COMP, "NET->TE: release complete"}, |
161 | {EV_NET_SELP_RESP, "Board: Select B-channel protocol ack"}, | 161 | {EV_NET_SELP_RESP, "Board: Select B-channel protocol ack"}, |
162 | {EV_NET_ACTV_RESP, "Board: Activate B-channel protocol ack"}, | 162 | {EV_NET_ACTV_RESP, "Board: Activate B-channel protocol ack"}, |
163 | {EV_TIMER, "Timeout"}, | 163 | {EV_TIMER, "Timeout"}, |
164 | {0, "NULL"} | 164 | {0, "NULL"} |
165 | }; | 165 | }; |
166 | 166 | ||
167 | char * strisdnevent(ushort ev) | 167 | char *strisdnevent(ushort ev) |
168 | { | 168 | { |
169 | struct isdn_event_desc * entry; | 169 | struct isdn_event_desc *entry; |
170 | 170 | ||
171 | for (entry = isdn_event_table; entry->ev; entry++) | 171 | for (entry = isdn_event_table; entry->ev; entry++) |
172 | if (entry->ev == ev) | 172 | if (entry->ev == ev) |
173 | break; | 173 | break; |
174 | 174 | ||
175 | return entry->desc; | 175 | return entry->desc; |
176 | } | 176 | } |
177 | 177 | ||
178 | /* | 178 | /* |
@@ -180,130 +180,130 @@ char * strisdnevent(ushort ev) | |||
180 | */ | 180 | */ |
181 | 181 | ||
182 | static struct fsm_timer_entry fsm_timers[] = { | 182 | static struct fsm_timer_entry fsm_timers[] = { |
183 | {ST_CALL_PROC, 10}, | 183 | {ST_CALL_PROC, 10}, |
184 | {ST_DISC_REQ, 2}, | 184 | {ST_DISC_REQ, 2}, |
185 | {ST_ACTIVE_SELP, 5}, | 185 | {ST_ACTIVE_SELP, 5}, |
186 | {ST_ACTIVE_ACTV, 5}, | 186 | {ST_ACTIVE_ACTV, 5}, |
187 | {ST_INCM_PROC, 10}, | 187 | {ST_INCM_PROC, 10}, |
188 | {ST_CONN_REQ, 2}, | 188 | {ST_CONN_REQ, 2}, |
189 | {0xff, 0} | 189 | {0xff, 0} |
190 | }; | 190 | }; |
191 | 191 | ||
192 | static struct fsm_entry fsm_table[] = { | 192 | static struct fsm_entry fsm_table[] = { |
193 | /* Connect Phase */ | 193 | /* Connect Phase */ |
194 | /* Outgoing */ | 194 | /* Outgoing */ |
195 | {ST_NULL, ST_CALL_INIT, EV_USR_SETUP_REQ, cb_out_1}, | 195 | {ST_NULL, ST_CALL_INIT, EV_USR_SETUP_REQ, cb_out_1}, |
196 | 196 | ||
197 | {ST_CALL_INIT, ST_OVER_SEND, EV_NET_SETUP_ACK, cb_notdone}, | 197 | {ST_CALL_INIT, ST_OVER_SEND, EV_NET_SETUP_ACK, cb_notdone}, |
198 | {ST_CALL_INIT, ST_CALL_PROC, EV_NET_CALL_PROC, NULL}, | 198 | {ST_CALL_INIT, ST_CALL_PROC, EV_NET_CALL_PROC, NULL}, |
199 | {ST_CALL_INIT, ST_NULL, EV_NET_DISC, cb_out_2}, | 199 | {ST_CALL_INIT, ST_NULL, EV_NET_DISC, cb_out_2}, |
200 | 200 | ||
201 | {ST_CALL_PROC, ST_ACTIVE_SELP, EV_NET_CONN, cb_out_2}, | 201 | {ST_CALL_PROC, ST_ACTIVE_SELP, EV_NET_CONN, cb_out_2}, |
202 | {ST_CALL_PROC, ST_NULL, EV_NET_DISC, cb_disc_1}, | 202 | {ST_CALL_PROC, ST_NULL, EV_NET_DISC, cb_disc_1}, |
203 | {ST_CALL_PROC, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, | 203 | {ST_CALL_PROC, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, |
204 | 204 | ||
205 | /* Incoming */ | 205 | /* Incoming */ |
206 | {ST_NULL, ST_CALL_PRES, EV_NET_SETUP, NULL}, | 206 | {ST_NULL, ST_CALL_PRES, EV_NET_SETUP, NULL}, |
207 | 207 | ||
208 | {ST_CALL_PRES, ST_INCM_PROC, EV_USR_PROCED_REQ, cb_in_1}, | 208 | {ST_CALL_PRES, ST_INCM_PROC, EV_USR_PROCED_REQ, cb_in_1}, |
209 | {ST_CALL_PRES, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, | 209 | {ST_CALL_PRES, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, |
210 | 210 | ||
211 | {ST_INCM_PROC, ST_CONN_REQ, EV_USR_SETUP_RESP, cb_in_2}, | 211 | {ST_INCM_PROC, ST_CONN_REQ, EV_USR_SETUP_RESP, cb_in_2}, |
212 | {ST_INCM_PROC, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, | 212 | {ST_INCM_PROC, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, |
213 | 213 | ||
214 | {ST_CONN_REQ, ST_ACTIVE_SELP, EV_NET_CONN_ACK, cb_in_3}, | 214 | {ST_CONN_REQ, ST_ACTIVE_SELP, EV_NET_CONN_ACK, cb_in_3}, |
215 | 215 | ||
216 | /* Active */ | 216 | /* Active */ |
217 | {ST_ACTIVE, ST_NULL, EV_NET_DISC, cb_disc_1}, | 217 | {ST_ACTIVE, ST_NULL, EV_NET_DISC, cb_disc_1}, |
218 | {ST_ACTIVE, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, | 218 | {ST_ACTIVE, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, |
219 | {ST_ACTIVE, ST_NULL, EV_NET_RELEASE, cb_disc_3}, | 219 | {ST_ACTIVE, ST_NULL, EV_NET_RELEASE, cb_disc_3}, |
220 | 220 | ||
221 | /* Disconnect */ | 221 | /* Disconnect */ |
222 | 222 | ||
223 | {ST_DISC_REQ, ST_NULL, EV_NET_DISC, cb_disc_1}, | 223 | {ST_DISC_REQ, ST_NULL, EV_NET_DISC, cb_disc_1}, |
224 | {ST_DISC_REQ, ST_NULL, EV_NET_RELEASE, cb_disc_3}, | 224 | {ST_DISC_REQ, ST_NULL, EV_NET_RELEASE, cb_disc_3}, |
225 | 225 | ||
226 | /* protocol selection */ | 226 | /* protocol selection */ |
227 | {ST_ACTIVE_SELP, ST_ACTIVE_ACTV, EV_NET_SELP_RESP, cb_selp_1}, | 227 | {ST_ACTIVE_SELP, ST_ACTIVE_ACTV, EV_NET_SELP_RESP, cb_selp_1}, |
228 | {ST_ACTIVE_SELP, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, | 228 | {ST_ACTIVE_SELP, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, |
229 | 229 | ||
230 | {ST_ACTIVE_ACTV, ST_ACTIVE, EV_NET_ACTV_RESP, cb_open}, | 230 | {ST_ACTIVE_ACTV, ST_ACTIVE, EV_NET_ACTV_RESP, cb_open}, |
231 | {ST_ACTIVE_ACTV, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, | 231 | {ST_ACTIVE_ACTV, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, |
232 | 232 | ||
233 | /* Timers */ | 233 | /* Timers */ |
234 | {ST_CALL_PROC, ST_DISC_REQ, EV_TIMER, cb_disc_2}, | 234 | {ST_CALL_PROC, ST_DISC_REQ, EV_TIMER, cb_disc_2}, |
235 | {ST_DISC_REQ, ST_NULL, EV_TIMER, cb_disc_3}, | 235 | {ST_DISC_REQ, ST_NULL, EV_TIMER, cb_disc_3}, |
236 | {ST_ACTIVE_SELP, ST_DISC_REQ, EV_TIMER, cb_disc_2}, | 236 | {ST_ACTIVE_SELP, ST_DISC_REQ, EV_TIMER, cb_disc_2}, |
237 | {ST_ACTIVE_ACTV, ST_DISC_REQ, EV_TIMER, cb_disc_2}, | 237 | {ST_ACTIVE_ACTV, ST_DISC_REQ, EV_TIMER, cb_disc_2}, |
238 | {ST_INCM_PROC, ST_DISC_REQ, EV_TIMER, cb_disc_2}, | 238 | {ST_INCM_PROC, ST_DISC_REQ, EV_TIMER, cb_disc_2}, |
239 | {ST_CONN_REQ, ST_CONN_REQ, EV_TIMER, cb_in_2}, | 239 | {ST_CONN_REQ, ST_CONN_REQ, EV_TIMER, cb_in_2}, |
240 | 240 | ||
241 | {0xff, 0, 0, NULL} | 241 | {0xff, 0, 0, NULL} |
242 | }; | 242 | }; |
243 | 243 | ||
244 | 244 | ||
245 | static void pcbit_fsm_timer(unsigned long data) | 245 | static void pcbit_fsm_timer(unsigned long data) |
246 | { | 246 | { |
247 | struct pcbit_dev *dev; | 247 | struct pcbit_dev *dev; |
248 | struct pcbit_chan *chan; | 248 | struct pcbit_chan *chan; |
249 | 249 | ||
250 | chan = (struct pcbit_chan *) data; | 250 | chan = (struct pcbit_chan *) data; |
251 | 251 | ||
252 | del_timer(&chan->fsm_timer); | 252 | del_timer(&chan->fsm_timer); |
253 | chan->fsm_timer.function = NULL; | 253 | chan->fsm_timer.function = NULL; |
254 | 254 | ||
255 | dev = chan2dev(chan); | 255 | dev = chan2dev(chan); |
256 | 256 | ||
257 | if (dev == NULL) { | 257 | if (dev == NULL) { |
258 | printk(KERN_WARNING "pcbit: timer for unknown device\n"); | 258 | printk(KERN_WARNING "pcbit: timer for unknown device\n"); |
259 | return; | 259 | return; |
260 | } | 260 | } |
261 | 261 | ||
262 | pcbit_fsm_event(dev, chan, EV_TIMER, NULL); | 262 | pcbit_fsm_event(dev, chan, EV_TIMER, NULL); |
263 | } | 263 | } |
264 | 264 | ||
265 | 265 | ||
266 | void pcbit_fsm_event(struct pcbit_dev *dev, struct pcbit_chan *chan, | 266 | void pcbit_fsm_event(struct pcbit_dev *dev, struct pcbit_chan *chan, |
267 | unsigned short event, struct callb_data *data) | 267 | unsigned short event, struct callb_data *data) |
268 | { | 268 | { |
269 | struct fsm_entry * action; | 269 | struct fsm_entry *action; |
270 | struct fsm_timer_entry *tentry; | 270 | struct fsm_timer_entry *tentry; |
271 | unsigned long flags; | 271 | unsigned long flags; |
272 | 272 | ||
273 | spin_lock_irqsave(&dev->lock, flags); | 273 | spin_lock_irqsave(&dev->lock, flags); |
274 | 274 | ||
275 | for (action = fsm_table; action->init != 0xff; action++) | 275 | for (action = fsm_table; action->init != 0xff; action++) |
276 | if (action->init == chan->fsm_state && action->event == event) | 276 | if (action->init == chan->fsm_state && action->event == event) |
277 | break; | 277 | break; |
278 | 278 | ||
279 | if (action->init == 0xff) { | 279 | if (action->init == 0xff) { |
280 | 280 | ||
281 | spin_unlock_irqrestore(&dev->lock, flags); | 281 | spin_unlock_irqrestore(&dev->lock, flags); |
282 | printk(KERN_DEBUG "fsm error: event %x on state %x\n", | 282 | printk(KERN_DEBUG "fsm error: event %x on state %x\n", |
283 | event, chan->fsm_state); | 283 | event, chan->fsm_state); |
284 | return; | 284 | return; |
285 | } | 285 | } |
286 | 286 | ||
287 | if (chan->fsm_timer.function) { | 287 | if (chan->fsm_timer.function) { |
288 | del_timer(&chan->fsm_timer); | 288 | del_timer(&chan->fsm_timer); |
289 | chan->fsm_timer.function = NULL; | 289 | chan->fsm_timer.function = NULL; |
290 | } | 290 | } |
291 | 291 | ||
292 | chan->fsm_state = action->final; | 292 | chan->fsm_state = action->final; |
293 | 293 | ||
294 | pcbit_state_change(dev, chan, action->init, event, action->final); | 294 | pcbit_state_change(dev, chan, action->init, event, action->final); |
295 | 295 | ||
296 | for (tentry = fsm_timers; tentry->init != 0xff; tentry++) | 296 | for (tentry = fsm_timers; tentry->init != 0xff; tentry++) |
297 | if (tentry->init == chan->fsm_state) | 297 | if (tentry->init == chan->fsm_state) |
298 | break; | 298 | break; |
299 | 299 | ||
300 | if (tentry->init != 0xff) { | 300 | if (tentry->init != 0xff) { |
301 | init_timer(&chan->fsm_timer); | 301 | init_timer(&chan->fsm_timer); |
302 | chan->fsm_timer.function = &pcbit_fsm_timer; | 302 | chan->fsm_timer.function = &pcbit_fsm_timer; |
303 | chan->fsm_timer.data = (ulong) chan; | 303 | chan->fsm_timer.data = (ulong) chan; |
304 | chan->fsm_timer.expires = jiffies + tentry->timeout * HZ; | 304 | chan->fsm_timer.expires = jiffies + tentry->timeout * HZ; |
305 | add_timer(&chan->fsm_timer); | 305 | add_timer(&chan->fsm_timer); |
306 | } | 306 | } |
307 | 307 | ||
308 | spin_unlock_irqrestore(&dev->lock, flags); | 308 | spin_unlock_irqrestore(&dev->lock, flags); |
309 | 309 | ||
@@ -311,7 +311,3 @@ void pcbit_fsm_event(struct pcbit_dev *dev, struct pcbit_chan *chan, | |||
311 | action->callb(dev, chan, data); | 311 | action->callb(dev, chan, data); |
312 | 312 | ||
313 | } | 313 | } |
314 | |||
315 | |||
316 | |||
317 | |||
diff --git a/drivers/isdn/pcbit/edss1.h b/drivers/isdn/pcbit/edss1.h index 39f8346e28c5..2f6b3a8edfba 100644 --- a/drivers/isdn/pcbit/edss1.h +++ b/drivers/isdn/pcbit/edss1.h | |||
@@ -2,10 +2,10 @@ | |||
2 | * DSS.1 module definitions | 2 | * DSS.1 module definitions |
3 | * | 3 | * |
4 | * Copyright (C) 1996 Universidade de Lisboa | 4 | * Copyright (C) 1996 Universidade de Lisboa |
5 | * | 5 | * |
6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) | 6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) |
7 | * | 7 | * |
8 | * This software may be used and distributed according to the terms of | 8 | * This software may be used and distributed according to the terms of |
9 | * the GNU General Public License, incorporated herein by reference. | 9 | * the GNU General Public License, incorporated herein by reference. |
10 | */ | 10 | */ |
11 | 11 | ||
@@ -62,9 +62,9 @@ | |||
62 | /* | 62 | /* |
63 | * Cause values | 63 | * Cause values |
64 | * only the ones we use | 64 | * only the ones we use |
65 | */ | 65 | */ |
66 | 66 | ||
67 | #define CAUSE_NORMAL 0x10U | 67 | #define CAUSE_NORMAL 0x10U |
68 | #define CAUSE_NOCHAN 0x22U | 68 | #define CAUSE_NOCHAN 0x22U |
69 | 69 | ||
70 | struct callb_data { | 70 | struct callb_data { |
@@ -94,9 +94,6 @@ extern const char * const isdn_state_table[]; | |||
94 | 94 | ||
95 | void pcbit_fsm_event(struct pcbit_dev *, struct pcbit_chan *, | 95 | void pcbit_fsm_event(struct pcbit_dev *, struct pcbit_chan *, |
96 | unsigned short event, struct callb_data *); | 96 | unsigned short event, struct callb_data *); |
97 | char * strisdnevent(ushort ev); | 97 | char *strisdnevent(ushort ev); |
98 | 98 | ||
99 | #endif | 99 | #endif |
100 | |||
101 | |||
102 | |||
diff --git a/drivers/isdn/pcbit/layer2.c b/drivers/isdn/pcbit/layer2.c index 30f0f45e3139..682911f81138 100644 --- a/drivers/isdn/pcbit/layer2.c +++ b/drivers/isdn/pcbit/layer2.c | |||
@@ -12,7 +12,7 @@ | |||
12 | /* | 12 | /* |
13 | * 19991203 - Fernando Carvalho - takion@superbofh.org | 13 | * 19991203 - Fernando Carvalho - takion@superbofh.org |
14 | * Hacked to compile with egcs and run with current version of isdn modules | 14 | * Hacked to compile with egcs and run with current version of isdn modules |
15 | */ | 15 | */ |
16 | 16 | ||
17 | /* | 17 | /* |
18 | * Based on documentation provided by Inesc: | 18 | * Based on documentation provided by Inesc: |
@@ -77,7 +77,7 @@ pcbit_l2_write(struct pcbit_dev *dev, ulong msg, ushort refnum, | |||
77 | struct sk_buff *skb, unsigned short hdr_len) | 77 | struct sk_buff *skb, unsigned short hdr_len) |
78 | { | 78 | { |
79 | struct frame_buf *frame, | 79 | struct frame_buf *frame, |
80 | *ptr; | 80 | *ptr; |
81 | unsigned long flags; | 81 | unsigned long flags; |
82 | 82 | ||
83 | if (dev->l2_state != L2_RUNNING && dev->l2_state != L2_LOADING) { | 83 | if (dev->l2_state != L2_RUNNING && dev->l2_state != L2_LOADING) { |
@@ -85,7 +85,7 @@ pcbit_l2_write(struct pcbit_dev *dev, ulong msg, ushort refnum, | |||
85 | return -1; | 85 | return -1; |
86 | } | 86 | } |
87 | if ((frame = kmalloc(sizeof(struct frame_buf), | 87 | if ((frame = kmalloc(sizeof(struct frame_buf), |
88 | GFP_ATOMIC)) == NULL) { | 88 | GFP_ATOMIC)) == NULL) { |
89 | printk(KERN_WARNING "pcbit_2_write: kmalloc failed\n"); | 89 | printk(KERN_WARNING "pcbit_2_write: kmalloc failed\n"); |
90 | dev_kfree_skb(skb); | 90 | dev_kfree_skb(skb); |
91 | return -1; | 91 | return -1; |
@@ -147,7 +147,7 @@ pcbit_transmit(struct pcbit_dev *dev) | |||
147 | int flen; /* fragment frame length including all headers */ | 147 | int flen; /* fragment frame length including all headers */ |
148 | int free; | 148 | int free; |
149 | int count, | 149 | int count, |
150 | cp_len; | 150 | cp_len; |
151 | unsigned long flags; | 151 | unsigned long flags; |
152 | unsigned short tt; | 152 | unsigned short tt; |
153 | 153 | ||
@@ -177,7 +177,7 @@ pcbit_transmit(struct pcbit_dev *dev) | |||
177 | 177 | ||
178 | /* Type 0 frame */ | 178 | /* Type 0 frame */ |
179 | 179 | ||
180 | ulong msg; | 180 | ulong msg; |
181 | 181 | ||
182 | if (frame->skb) | 182 | if (frame->skb) |
183 | flen = FRAME_HDR_LEN + PREHDR_LEN + frame->skb->len; | 183 | flen = FRAME_HDR_LEN + PREHDR_LEN + frame->skb->len; |
@@ -270,7 +270,7 @@ pcbit_transmit(struct pcbit_dev *dev) | |||
270 | spin_unlock_irqrestore(&dev->lock, flags); | 270 | spin_unlock_irqrestore(&dev->lock, flags); |
271 | #ifdef DEBUG | 271 | #ifdef DEBUG |
272 | printk(KERN_DEBUG "unacked %d free %d write_queue %s\n", | 272 | printk(KERN_DEBUG "unacked %d free %d write_queue %s\n", |
273 | unacked, dev->free, dev->write_queue ? "not empty" : | 273 | unacked, dev->free, dev->write_queue ? "not empty" : |
274 | "empty"); | 274 | "empty"); |
275 | #endif | 275 | #endif |
276 | } | 276 | } |
@@ -301,8 +301,8 @@ pcbit_deliver(struct work_struct *work) | |||
301 | SET_MSG_CMD(msg, frame->skb->data[2]); | 301 | SET_MSG_CMD(msg, frame->skb->data[2]); |
302 | SET_MSG_SCMD(msg, frame->skb->data[3]); | 302 | SET_MSG_SCMD(msg, frame->skb->data[3]); |
303 | 303 | ||
304 | frame->refnum = *((ushort *) frame->skb->data + 4); | 304 | frame->refnum = *((ushort *)frame->skb->data + 4); |
305 | frame->msg = *((ulong *) & msg); | 305 | frame->msg = *((ulong *)&msg); |
306 | 306 | ||
307 | skb_pull(frame->skb, 6); | 307 | skb_pull(frame->skb, 6); |
308 | 308 | ||
@@ -326,7 +326,7 @@ pcbit_receive(struct pcbit_dev *dev) | |||
326 | { | 326 | { |
327 | unsigned short tt; | 327 | unsigned short tt; |
328 | u_char cpu, | 328 | u_char cpu, |
329 | proc; | 329 | proc; |
330 | struct frame_buf *frame = NULL; | 330 | struct frame_buf *frame = NULL; |
331 | unsigned long flags; | 331 | unsigned long flags; |
332 | u_char type1; | 332 | u_char type1; |
@@ -378,10 +378,10 @@ pcbit_receive(struct pcbit_dev *dev) | |||
378 | frame->dt_len = pcbit_readw(dev); | 378 | frame->dt_len = pcbit_readw(dev); |
379 | 379 | ||
380 | /* | 380 | /* |
381 | * 0 sized packet | 381 | * 0 sized packet |
382 | * I don't know if they are an error or not... | 382 | * I don't know if they are an error or not... |
383 | * But they are very frequent | 383 | * But they are very frequent |
384 | * Not documented | 384 | * Not documented |
385 | */ | 385 | */ |
386 | 386 | ||
387 | if (frame->hdr_len == 0) { | 387 | if (frame->hdr_len == 0) { |
@@ -499,8 +499,8 @@ pcbit_irq_handler(int interrupt, void *devptr) | |||
499 | { | 499 | { |
500 | struct pcbit_dev *dev; | 500 | struct pcbit_dev *dev; |
501 | u_char info, | 501 | u_char info, |
502 | ack_seq, | 502 | ack_seq, |
503 | read_seq; | 503 | read_seq; |
504 | 504 | ||
505 | dev = (struct pcbit_dev *) devptr; | 505 | dev = (struct pcbit_dev *) devptr; |
506 | 506 | ||
@@ -666,7 +666,7 @@ static void | |||
666 | pcbit_recv_ack(struct pcbit_dev *dev, unsigned char ack) | 666 | pcbit_recv_ack(struct pcbit_dev *dev, unsigned char ack) |
667 | { | 667 | { |
668 | int i, | 668 | int i, |
669 | count; | 669 | count; |
670 | int unacked; | 670 | int unacked; |
671 | 671 | ||
672 | unacked = (dev->send_seq + (8 - dev->unack_seq)) & 0x07; | 672 | unacked = (dev->send_seq + (8 - dev->unack_seq)) & 0x07; |
@@ -678,13 +678,13 @@ pcbit_recv_ack(struct pcbit_dev *dev, unsigned char ack) | |||
678 | if (dev->send_seq > dev->unack_seq) { | 678 | if (dev->send_seq > dev->unack_seq) { |
679 | if (ack <= dev->unack_seq || ack > dev->send_seq) { | 679 | if (ack <= dev->unack_seq || ack > dev->send_seq) { |
680 | printk(KERN_DEBUG | 680 | printk(KERN_DEBUG |
681 | "layer 2 ack unacceptable - dev %d", | 681 | "layer 2 ack unacceptable - dev %d", |
682 | dev->id); | 682 | dev->id); |
683 | 683 | ||
684 | pcbit_l2_error(dev); | 684 | pcbit_l2_error(dev); |
685 | } else if (ack > dev->send_seq && ack <= dev->unack_seq) { | 685 | } else if (ack > dev->send_seq && ack <= dev->unack_seq) { |
686 | printk(KERN_DEBUG | 686 | printk(KERN_DEBUG |
687 | "layer 2 ack unacceptable - dev %d", | 687 | "layer 2 ack unacceptable - dev %d", |
688 | dev->id); | 688 | dev->id); |
689 | pcbit_l2_error(dev); | 689 | pcbit_l2_error(dev); |
690 | } | 690 | } |
diff --git a/drivers/isdn/pcbit/layer2.h b/drivers/isdn/pcbit/layer2.h index 2ac295e1a6e5..be1327bc162a 100644 --- a/drivers/isdn/pcbit/layer2.h +++ b/drivers/isdn/pcbit/layer2.h | |||
@@ -2,17 +2,17 @@ | |||
2 | * PCBIT-D low-layer interface definitions | 2 | * PCBIT-D low-layer interface definitions |
3 | * | 3 | * |
4 | * Copyright (C) 1996 Universidade de Lisboa | 4 | * Copyright (C) 1996 Universidade de Lisboa |
5 | * | 5 | * |
6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) | 6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) |
7 | * | 7 | * |
8 | * This software may be used and distributed according to the terms of | 8 | * This software may be used and distributed according to the terms of |
9 | * the GNU General Public License, incorporated herein by reference. | 9 | * the GNU General Public License, incorporated herein by reference. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | /* | 12 | /* |
13 | * 19991203 - Fernando Carvalho - takion@superbofh.org | 13 | * 19991203 - Fernando Carvalho - takion@superbofh.org |
14 | * Hacked to compile with egcs and run with current version of isdn modules | 14 | * Hacked to compile with egcs and run with current version of isdn modules |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifndef LAYER2_H | 17 | #ifndef LAYER2_H |
18 | #define LAYER2_H | 18 | #define LAYER2_H |
@@ -37,8 +37,8 @@ | |||
37 | 37 | ||
38 | /* TAM - XX - C - S - NUM */ | 38 | /* TAM - XX - C - S - NUM */ |
39 | #define PREHDR_LEN 8 | 39 | #define PREHDR_LEN 8 |
40 | /* TT - M - I - TH - TD */ | 40 | /* TT - M - I - TH - TD */ |
41 | #define FRAME_HDR_LEN 8 | 41 | #define FRAME_HDR_LEN 8 |
42 | 42 | ||
43 | #define MSG_CONN_REQ 0x08000100 | 43 | #define MSG_CONN_REQ 0x08000100 |
44 | #define MSG_CONN_CONF 0x00000101 | 44 | #define MSG_CONN_CONF 0x00000101 |
@@ -84,21 +84,21 @@ | |||
84 | #define MSG_DEBUG_188 0x0000ff00 | 84 | #define MSG_DEBUG_188 0x0000ff00 |
85 | 85 | ||
86 | /* | 86 | /* |
87 | 87 | ||
88 | long 4 3 2 1 | 88 | long 4 3 2 1 |
89 | Intel 1 2 3 4 | 89 | Intel 1 2 3 4 |
90 | */ | 90 | */ |
91 | 91 | ||
92 | #ifdef __LITTLE_ENDIAN | 92 | #ifdef __LITTLE_ENDIAN |
93 | #define SET_MSG_SCMD(msg, ch) (msg = (msg & 0xffffff00) | (((ch) & 0xff))) | 93 | #define SET_MSG_SCMD(msg, ch) (msg = (msg & 0xffffff00) | (((ch) & 0xff))) |
94 | #define SET_MSG_CMD(msg, ch) (msg = (msg & 0xffff00ff) | (((ch) & 0xff) << 8)) | 94 | #define SET_MSG_CMD(msg, ch) (msg = (msg & 0xffff00ff) | (((ch) & 0xff) << 8)) |
95 | #define SET_MSG_PROC(msg, ch) (msg = (msg & 0xff00ffff) | (((ch) & 0xff) << 16)) | 95 | #define SET_MSG_PROC(msg, ch) (msg = (msg & 0xff00ffff) | (((ch) & 0xff) << 16)) |
96 | #define SET_MSG_CPU(msg, ch) (msg = (msg & 0x00ffffff) | (((ch) & 0xff) << 24)) | 96 | #define SET_MSG_CPU(msg, ch) (msg = (msg & 0x00ffffff) | (((ch) & 0xff) << 24)) |
97 | 97 | ||
98 | #define GET_MSG_SCMD(msg) ((msg) & 0xFF) | 98 | #define GET_MSG_SCMD(msg) ((msg) & 0xFF) |
99 | #define GET_MSG_CMD(msg) ((msg) >> 8 & 0xFF) | 99 | #define GET_MSG_CMD(msg) ((msg) >> 8 & 0xFF) |
100 | #define GET_MSG_PROC(msg) ((msg) >> 16 & 0xFF) | 100 | #define GET_MSG_PROC(msg) ((msg) >> 16 & 0xFF) |
101 | #define GET_MSG_CPU(msg) ((msg) >> 24) | 101 | #define GET_MSG_CPU(msg) ((msg) >> 24) |
102 | 102 | ||
103 | #else | 103 | #else |
104 | #error "Non-Intel CPU" | 104 | #error "Non-Intel CPU" |
@@ -109,60 +109,60 @@ | |||
109 | #define SCHED_READ 0x01 | 109 | #define SCHED_READ 0x01 |
110 | #define SCHED_WRITE 0x02 | 110 | #define SCHED_WRITE 0x02 |
111 | 111 | ||
112 | #define SET_RUN_TIMEOUT 2*HZ /* 2 seconds */ | 112 | #define SET_RUN_TIMEOUT 2 * HZ /* 2 seconds */ |
113 | 113 | ||
114 | struct frame_buf { | 114 | struct frame_buf { |
115 | ulong msg; | 115 | ulong msg; |
116 | unsigned int refnum; | 116 | unsigned int refnum; |
117 | unsigned int dt_len; | 117 | unsigned int dt_len; |
118 | unsigned int hdr_len; | 118 | unsigned int hdr_len; |
119 | struct sk_buff *skb; | 119 | struct sk_buff *skb; |
120 | unsigned int copied; | 120 | unsigned int copied; |
121 | struct frame_buf * next; | 121 | struct frame_buf *next; |
122 | }; | 122 | }; |
123 | 123 | ||
124 | extern int pcbit_l2_write(struct pcbit_dev * dev, ulong msg, ushort refnum, | 124 | extern int pcbit_l2_write(struct pcbit_dev *dev, ulong msg, ushort refnum, |
125 | struct sk_buff *skb, unsigned short hdr_len); | 125 | struct sk_buff *skb, unsigned short hdr_len); |
126 | 126 | ||
127 | extern irqreturn_t pcbit_irq_handler(int interrupt, void *); | 127 | extern irqreturn_t pcbit_irq_handler(int interrupt, void *); |
128 | 128 | ||
129 | extern struct pcbit_dev * dev_pcbit[MAX_PCBIT_CARDS]; | 129 | extern struct pcbit_dev *dev_pcbit[MAX_PCBIT_CARDS]; |
130 | 130 | ||
131 | #ifdef DEBUG | 131 | #ifdef DEBUG |
132 | static __inline__ void log_state(struct pcbit_dev *dev) { | 132 | static __inline__ void log_state(struct pcbit_dev *dev) { |
133 | printk(KERN_DEBUG "writeptr = %ld\n", | 133 | printk(KERN_DEBUG "writeptr = %ld\n", |
134 | (ulong) (dev->writeptr - dev->sh_mem)); | 134 | (ulong) (dev->writeptr - dev->sh_mem)); |
135 | printk(KERN_DEBUG "readptr = %ld\n", | 135 | printk(KERN_DEBUG "readptr = %ld\n", |
136 | (ulong) (dev->readptr - (dev->sh_mem + BANK2))); | 136 | (ulong) (dev->readptr - (dev->sh_mem + BANK2))); |
137 | printk(KERN_DEBUG "{rcv_seq=%01x, send_seq=%01x, unack_seq=%01x}\n", | 137 | printk(KERN_DEBUG "{rcv_seq=%01x, send_seq=%01x, unack_seq=%01x}\n", |
138 | dev->rcv_seq, dev->send_seq, dev->unack_seq); | 138 | dev->rcv_seq, dev->send_seq, dev->unack_seq); |
139 | } | 139 | } |
140 | #endif | 140 | #endif |
141 | 141 | ||
142 | static __inline__ struct pcbit_dev * chan2dev(struct pcbit_chan * chan) | 142 | static __inline__ struct pcbit_dev *chan2dev(struct pcbit_chan *chan) |
143 | { | 143 | { |
144 | struct pcbit_dev * dev; | 144 | struct pcbit_dev *dev; |
145 | int i; | 145 | int i; |
146 | 146 | ||
147 | 147 | ||
148 | for (i=0; i<MAX_PCBIT_CARDS; i++) | 148 | for (i = 0; i < MAX_PCBIT_CARDS; i++) |
149 | if ((dev=dev_pcbit[i])) | 149 | if ((dev = dev_pcbit[i])) |
150 | if (dev->b1 == chan || dev->b2 == chan) | 150 | if (dev->b1 == chan || dev->b2 == chan) |
151 | return dev; | 151 | return dev; |
152 | return NULL; | 152 | return NULL; |
153 | 153 | ||
154 | } | 154 | } |
155 | 155 | ||
156 | static __inline__ struct pcbit_dev * finddev(int id) | 156 | static __inline__ struct pcbit_dev *finddev(int id) |
157 | { | 157 | { |
158 | struct pcbit_dev * dev; | 158 | struct pcbit_dev *dev; |
159 | int i; | 159 | int i; |
160 | 160 | ||
161 | for (i=0; i<MAX_PCBIT_CARDS; i++) | 161 | for (i = 0; i < MAX_PCBIT_CARDS; i++) |
162 | if ((dev=dev_pcbit[i])) | 162 | if ((dev = dev_pcbit[i])) |
163 | if (dev->id == id) | 163 | if (dev->id == id) |
164 | return dev; | 164 | return dev; |
165 | return NULL; | 165 | return NULL; |
166 | } | 166 | } |
167 | 167 | ||
168 | 168 | ||
@@ -172,117 +172,110 @@ static __inline__ struct pcbit_dev * finddev(int id) | |||
172 | 172 | ||
173 | static __inline__ void pcbit_writeb(struct pcbit_dev *dev, unsigned char dt) | 173 | static __inline__ void pcbit_writeb(struct pcbit_dev *dev, unsigned char dt) |
174 | { | 174 | { |
175 | writeb(dt, dev->writeptr++); | 175 | writeb(dt, dev->writeptr++); |
176 | if (dev->writeptr == dev->sh_mem + BANKLEN) | 176 | if (dev->writeptr == dev->sh_mem + BANKLEN) |
177 | dev->writeptr = dev->sh_mem; | 177 | dev->writeptr = dev->sh_mem; |
178 | } | 178 | } |
179 | 179 | ||
180 | static __inline__ void pcbit_writew(struct pcbit_dev *dev, unsigned short dt) | 180 | static __inline__ void pcbit_writew(struct pcbit_dev *dev, unsigned short dt) |
181 | { | 181 | { |
182 | int dist; | 182 | int dist; |
183 | 183 | ||
184 | dist = BANKLEN - (dev->writeptr - dev->sh_mem); | 184 | dist = BANKLEN - (dev->writeptr - dev->sh_mem); |
185 | switch (dist) { | 185 | switch (dist) { |
186 | case 2: | 186 | case 2: |
187 | writew(dt, dev->writeptr); | 187 | writew(dt, dev->writeptr); |
188 | dev->writeptr = dev->sh_mem; | 188 | dev->writeptr = dev->sh_mem; |
189 | break; | 189 | break; |
190 | case 1: | 190 | case 1: |
191 | writeb((u_char) (dt & 0x00ffU), dev->writeptr); | 191 | writeb((u_char) (dt & 0x00ffU), dev->writeptr); |
192 | dev->writeptr = dev->sh_mem; | 192 | dev->writeptr = dev->sh_mem; |
193 | writeb((u_char) (dt >> 8), dev->writeptr++); | 193 | writeb((u_char) (dt >> 8), dev->writeptr++); |
194 | break; | 194 | break; |
195 | default: | 195 | default: |
196 | writew(dt, dev->writeptr); | 196 | writew(dt, dev->writeptr); |
197 | dev->writeptr += 2; | 197 | dev->writeptr += 2; |
198 | break; | 198 | break; |
199 | }; | 199 | }; |
200 | } | 200 | } |
201 | 201 | ||
202 | static __inline__ void memcpy_topcbit(struct pcbit_dev * dev, u_char * data, | 202 | static __inline__ void memcpy_topcbit(struct pcbit_dev *dev, u_char *data, |
203 | int len) | 203 | int len) |
204 | { | 204 | { |
205 | int diff; | 205 | int diff; |
206 | 206 | ||
207 | diff = len - (BANKLEN - (dev->writeptr - dev->sh_mem) ); | 207 | diff = len - (BANKLEN - (dev->writeptr - dev->sh_mem)); |
208 | 208 | ||
209 | if (diff > 0) | 209 | if (diff > 0) |
210 | { | 210 | { |
211 | memcpy_toio(dev->writeptr, data, len - diff); | 211 | memcpy_toio(dev->writeptr, data, len - diff); |
212 | memcpy_toio(dev->sh_mem, data + (len - diff), diff); | 212 | memcpy_toio(dev->sh_mem, data + (len - diff), diff); |
213 | dev->writeptr = dev->sh_mem + diff; | 213 | dev->writeptr = dev->sh_mem + diff; |
214 | } | 214 | } |
215 | else | 215 | else |
216 | { | 216 | { |
217 | memcpy_toio(dev->writeptr, data, len); | 217 | memcpy_toio(dev->writeptr, data, len); |
218 | 218 | ||
219 | dev->writeptr += len; | 219 | dev->writeptr += len; |
220 | if (diff == 0) | 220 | if (diff == 0) |
221 | dev->writeptr = dev->sh_mem; | 221 | dev->writeptr = dev->sh_mem; |
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | static __inline__ unsigned char pcbit_readb(struct pcbit_dev *dev) | 225 | static __inline__ unsigned char pcbit_readb(struct pcbit_dev *dev) |
226 | { | 226 | { |
227 | unsigned char val; | 227 | unsigned char val; |
228 | 228 | ||
229 | val = readb(dev->readptr++); | 229 | val = readb(dev->readptr++); |
230 | if (dev->readptr == dev->sh_mem + BANK2 + BANKLEN) | 230 | if (dev->readptr == dev->sh_mem + BANK2 + BANKLEN) |
231 | dev->readptr = dev->sh_mem + BANK2; | 231 | dev->readptr = dev->sh_mem + BANK2; |
232 | 232 | ||
233 | return val; | 233 | return val; |
234 | } | 234 | } |
235 | 235 | ||
236 | static __inline__ unsigned short pcbit_readw(struct pcbit_dev *dev) | 236 | static __inline__ unsigned short pcbit_readw(struct pcbit_dev *dev) |
237 | { | 237 | { |
238 | int dist; | 238 | int dist; |
239 | unsigned short val; | 239 | unsigned short val; |
240 | 240 | ||
241 | dist = BANKLEN - ( dev->readptr - (dev->sh_mem + BANK2 ) ); | 241 | dist = BANKLEN - (dev->readptr - (dev->sh_mem + BANK2)); |
242 | switch (dist) { | 242 | switch (dist) { |
243 | case 2: | 243 | case 2: |
244 | val = readw(dev->readptr); | 244 | val = readw(dev->readptr); |
245 | dev->readptr = dev->sh_mem + BANK2; | 245 | dev->readptr = dev->sh_mem + BANK2; |
246 | break; | 246 | break; |
247 | case 1: | 247 | case 1: |
248 | val = readb(dev->readptr); | 248 | val = readb(dev->readptr); |
249 | dev->readptr = dev->sh_mem + BANK2; | 249 | dev->readptr = dev->sh_mem + BANK2; |
250 | val = (readb(dev->readptr++) << 8) | val; | 250 | val = (readb(dev->readptr++) << 8) | val; |
251 | break; | 251 | break; |
252 | default: | 252 | default: |
253 | val = readw(dev->readptr); | 253 | val = readw(dev->readptr); |
254 | dev->readptr += 2; | 254 | dev->readptr += 2; |
255 | break; | 255 | break; |
256 | }; | 256 | }; |
257 | return val; | 257 | return val; |
258 | } | 258 | } |
259 | 259 | ||
260 | static __inline__ void memcpy_frompcbit(struct pcbit_dev * dev, u_char * data, int len) | 260 | static __inline__ void memcpy_frompcbit(struct pcbit_dev *dev, u_char *data, int len) |
261 | { | 261 | { |
262 | int diff; | 262 | int diff; |
263 | 263 | ||
264 | diff = len - (BANKLEN - (dev->readptr - (dev->sh_mem + BANK2) ) ); | 264 | diff = len - (BANKLEN - (dev->readptr - (dev->sh_mem + BANK2))); |
265 | if (diff > 0) | 265 | if (diff > 0) |
266 | { | 266 | { |
267 | memcpy_fromio(data, dev->readptr, len - diff); | 267 | memcpy_fromio(data, dev->readptr, len - diff); |
268 | memcpy_fromio(data + (len - diff), dev->sh_mem + BANK2 , diff); | 268 | memcpy_fromio(data + (len - diff), dev->sh_mem + BANK2 , diff); |
269 | dev->readptr = dev->sh_mem + BANK2 + diff; | 269 | dev->readptr = dev->sh_mem + BANK2 + diff; |
270 | } | 270 | } |
271 | else | 271 | else |
272 | { | 272 | { |
273 | memcpy_fromio(data, dev->readptr, len); | 273 | memcpy_fromio(data, dev->readptr, len); |
274 | dev->readptr += len; | 274 | dev->readptr += len; |
275 | if (diff == 0) | 275 | if (diff == 0) |
276 | dev->readptr = dev->sh_mem + BANK2; | 276 | dev->readptr = dev->sh_mem + BANK2; |
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||
280 | 280 | ||
281 | #endif | 281 | #endif |
282 | |||
283 | |||
284 | |||
285 | |||
286 | |||
287 | |||
288 | |||
diff --git a/drivers/isdn/pcbit/module.c b/drivers/isdn/pcbit/module.c index 04ea241ff176..0a59bd0b8210 100644 --- a/drivers/isdn/pcbit/module.c +++ b/drivers/isdn/pcbit/module.c | |||
@@ -2,10 +2,10 @@ | |||
2 | * PCBIT-D module support | 2 | * PCBIT-D module support |
3 | * | 3 | * |
4 | * Copyright (C) 1996 Universidade de Lisboa | 4 | * Copyright (C) 1996 Universidade de Lisboa |
5 | * | 5 | * |
6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) | 6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) |
7 | * | 7 | * |
8 | * This software may be used and distributed according to the terms of | 8 | * This software may be used and distributed according to the terms of |
9 | * the GNU General Public License, incorporated herein by reference. | 9 | * the GNU General Public License, incorporated herein by reference. |
10 | */ | 10 | */ |
11 | 11 | ||
@@ -29,7 +29,7 @@ module_param_array(mem, int, NULL, 0); | |||
29 | module_param_array(irq, int, NULL, 0); | 29 | module_param_array(irq, int, NULL, 0); |
30 | 30 | ||
31 | static int num_boards; | 31 | static int num_boards; |
32 | struct pcbit_dev * dev_pcbit[MAX_PCBIT_CARDS]; | 32 | struct pcbit_dev *dev_pcbit[MAX_PCBIT_CARDS]; |
33 | 33 | ||
34 | static int __init pcbit_init(void) | 34 | static int __init pcbit_init(void) |
35 | { | 35 | { |
@@ -37,26 +37,26 @@ static int __init pcbit_init(void) | |||
37 | 37 | ||
38 | num_boards = 0; | 38 | num_boards = 0; |
39 | 39 | ||
40 | printk(KERN_NOTICE | 40 | printk(KERN_NOTICE |
41 | "PCBIT-D device driver v 0.5-fjpc0 19991204 - " | 41 | "PCBIT-D device driver v 0.5-fjpc0 19991204 - " |
42 | "Copyright (C) 1996 Universidade de Lisboa\n"); | 42 | "Copyright (C) 1996 Universidade de Lisboa\n"); |
43 | 43 | ||
44 | if (mem[0] || irq[0]) | 44 | if (mem[0] || irq[0]) |
45 | { | 45 | { |
46 | for (board=0; board < MAX_PCBIT_CARDS && mem[board] && irq[board]; board++) | 46 | for (board = 0; board < MAX_PCBIT_CARDS && mem[board] && irq[board]; board++) |
47 | { | 47 | { |
48 | if (!mem[board]) | 48 | if (!mem[board]) |
49 | mem[board] = 0xD0000; | 49 | mem[board] = 0xD0000; |
50 | if (!irq[board]) | 50 | if (!irq[board]) |
51 | irq[board] = 5; | 51 | irq[board] = 5; |
52 | 52 | ||
53 | if (pcbit_init_dev(board, mem[board], irq[board]) == 0) | 53 | if (pcbit_init_dev(board, mem[board], irq[board]) == 0) |
54 | num_boards++; | 54 | num_boards++; |
55 | 55 | ||
56 | else | 56 | else |
57 | { | 57 | { |
58 | printk(KERN_WARNING | 58 | printk(KERN_WARNING |
59 | "pcbit_init failed for dev %d", | 59 | "pcbit_init failed for dev %d", |
60 | board + 1); | 60 | board + 1); |
61 | return -EIO; | 61 | return -EIO; |
62 | } | 62 | } |
@@ -67,7 +67,7 @@ static int __init pcbit_init(void) | |||
67 | 67 | ||
68 | if (!num_boards) | 68 | if (!num_boards) |
69 | { | 69 | { |
70 | printk(KERN_INFO | 70 | printk(KERN_INFO |
71 | "Trying to detect board using default settings\n"); | 71 | "Trying to detect board using default settings\n"); |
72 | if (pcbit_init_dev(0, 0xD0000, 5) == 0) | 72 | if (pcbit_init_dev(0, 0xD0000, 5) == 0) |
73 | num_boards++; | 73 | num_boards++; |
@@ -84,7 +84,7 @@ static void __exit pcbit_exit(void) | |||
84 | 84 | ||
85 | for (board = 0; board < num_boards; board++) | 85 | for (board = 0; board < num_boards; board++) |
86 | pcbit_terminate(board); | 86 | pcbit_terminate(board); |
87 | printk(KERN_NOTICE | 87 | printk(KERN_NOTICE |
88 | "PCBIT-D module unloaded\n"); | 88 | "PCBIT-D module unloaded\n"); |
89 | #endif | 89 | #endif |
90 | } | 90 | } |
@@ -95,20 +95,20 @@ static int __init pcbit_setup(char *line) | |||
95 | { | 95 | { |
96 | int i, j, argc; | 96 | int i, j, argc; |
97 | char *str; | 97 | char *str; |
98 | int ints[MAX_PARA+1]; | 98 | int ints[MAX_PARA + 1]; |
99 | 99 | ||
100 | str = get_options(line, MAX_PARA, ints); | 100 | str = get_options(line, MAX_PARA, ints); |
101 | argc = ints[0]; | 101 | argc = ints[0]; |
102 | i = 0; | 102 | i = 0; |
103 | j = 1; | 103 | j = 1; |
104 | 104 | ||
105 | while (argc && (i<MAX_PCBIT_CARDS)) { | 105 | while (argc && (i < MAX_PCBIT_CARDS)) { |
106 | 106 | ||
107 | if (argc) { | 107 | if (argc) { |
108 | mem[i] = ints[j]; | 108 | mem[i] = ints[j]; |
109 | j++; argc--; | 109 | j++; argc--; |
110 | } | 110 | } |
111 | 111 | ||
112 | if (argc) { | 112 | if (argc) { |
113 | irq[i] = ints[j]; | 113 | irq[i] = ints[j]; |
114 | j++; argc--; | 114 | j++; argc--; |
@@ -116,11 +116,10 @@ static int __init pcbit_setup(char *line) | |||
116 | 116 | ||
117 | i++; | 117 | i++; |
118 | } | 118 | } |
119 | return(1); | 119 | return (1); |
120 | } | 120 | } |
121 | __setup("pcbit=", pcbit_setup); | 121 | __setup("pcbit=", pcbit_setup); |
122 | #endif | 122 | #endif |
123 | 123 | ||
124 | module_init(pcbit_init); | 124 | module_init(pcbit_init); |
125 | module_exit(pcbit_exit); | 125 | module_exit(pcbit_exit); |
126 | |||
diff --git a/drivers/isdn/pcbit/pcbit.h b/drivers/isdn/pcbit/pcbit.h index d76fffc88b82..0a5a99440a80 100644 --- a/drivers/isdn/pcbit/pcbit.h +++ b/drivers/isdn/pcbit/pcbit.h | |||
@@ -2,10 +2,10 @@ | |||
2 | * PCBIT-D device driver definitions | 2 | * PCBIT-D device driver definitions |
3 | * | 3 | * |
4 | * Copyright (C) 1996 Universidade de Lisboa | 4 | * Copyright (C) 1996 Universidade de Lisboa |
5 | * | 5 | * |
6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) | 6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) |
7 | * | 7 | * |
8 | * This software may be used and distributed according to the terms of | 8 | * This software may be used and distributed according to the terms of |
9 | * the GNU General Public License, incorporated herein by reference. | 9 | * the GNU General Public License, incorporated herein by reference. |
10 | */ | 10 | */ |
11 | 11 | ||
@@ -32,14 +32,14 @@ struct pcbit_chan { | |||
32 | unsigned short r_refnum; | 32 | unsigned short r_refnum; |
33 | unsigned short fsm_state; | 33 | unsigned short fsm_state; |
34 | struct timer_list fsm_timer; | 34 | struct timer_list fsm_timer; |
35 | #ifdef BLOCK_TIMER | 35 | #ifdef BLOCK_TIMER |
36 | struct timer_list block_timer; | 36 | struct timer_list block_timer; |
37 | #endif | 37 | #endif |
38 | }; | 38 | }; |
39 | 39 | ||
40 | struct msn_entry { | 40 | struct msn_entry { |
41 | char *msn; | 41 | char *msn; |
42 | struct msn_entry * next; | 42 | struct msn_entry *next; |
43 | }; | 43 | }; |
44 | 44 | ||
45 | struct pcbit_dev { | 45 | struct pcbit_dev { |
@@ -49,15 +49,15 @@ struct pcbit_dev { | |||
49 | unsigned long ph_mem; | 49 | unsigned long ph_mem; |
50 | unsigned int irq; | 50 | unsigned int irq; |
51 | unsigned int id; | 51 | unsigned int id; |
52 | unsigned int interrupt; /* set during interrupt | 52 | unsigned int interrupt; /* set during interrupt |
53 | processing */ | 53 | processing */ |
54 | spinlock_t lock; | 54 | spinlock_t lock; |
55 | /* isdn4linux */ | 55 | /* isdn4linux */ |
56 | 56 | ||
57 | struct msn_entry * msn_list; /* ISDN address list */ | 57 | struct msn_entry *msn_list; /* ISDN address list */ |
58 | 58 | ||
59 | isdn_if * dev_if; | 59 | isdn_if *dev_if; |
60 | 60 | ||
61 | ushort ll_hdrlen; | 61 | ushort ll_hdrlen; |
62 | ushort hl_hdrlen; | 62 | ushort hl_hdrlen; |
63 | 63 | ||
@@ -89,17 +89,17 @@ struct pcbit_dev { | |||
89 | unsigned char send_seq; | 89 | unsigned char send_seq; |
90 | unsigned char rcv_seq; | 90 | unsigned char rcv_seq; |
91 | unsigned char unack_seq; | 91 | unsigned char unack_seq; |
92 | 92 | ||
93 | unsigned short free; | 93 | unsigned short free; |
94 | 94 | ||
95 | /* channels */ | 95 | /* channels */ |
96 | 96 | ||
97 | struct pcbit_chan *b1; | 97 | struct pcbit_chan *b1; |
98 | struct pcbit_chan *b2; | 98 | struct pcbit_chan *b2; |
99 | }; | 99 | }; |
100 | 100 | ||
101 | #define STATS_TIMER (10*HZ) | 101 | #define STATS_TIMER (10 * HZ) |
102 | #define ERRTIME (HZ/10) | 102 | #define ERRTIME (HZ / 10) |
103 | 103 | ||
104 | /* MRU */ | 104 | /* MRU */ |
105 | #define MAXBUFSIZE 1534 | 105 | #define MAXBUFSIZE 1534 |
@@ -107,7 +107,7 @@ struct pcbit_dev { | |||
107 | 107 | ||
108 | #define STATBUF_LEN 2048 | 108 | #define STATBUF_LEN 2048 |
109 | /* | 109 | /* |
110 | * | 110 | * |
111 | */ | 111 | */ |
112 | 112 | ||
113 | #endif /* __KERNEL__ */ | 113 | #endif /* __KERNEL__ */ |
@@ -169,9 +169,9 @@ struct pcbit_ioctl { | |||
169 | void pcbit_deliver(struct work_struct *work); | 169 | void pcbit_deliver(struct work_struct *work); |
170 | int pcbit_init_dev(int board, int mem_base, int irq); | 170 | int pcbit_init_dev(int board, int mem_base, int irq); |
171 | void pcbit_terminate(int board); | 171 | void pcbit_terminate(int board); |
172 | void pcbit_l3_receive(struct pcbit_dev * dev, ulong msg, struct sk_buff * skb, | 172 | void pcbit_l3_receive(struct pcbit_dev *dev, ulong msg, struct sk_buff *skb, |
173 | ushort hdr_len, ushort refnum); | 173 | ushort hdr_len, ushort refnum); |
174 | void pcbit_state_change(struct pcbit_dev * dev, struct pcbit_chan * chan, | 174 | void pcbit_state_change(struct pcbit_dev *dev, struct pcbit_chan *chan, |
175 | unsigned short i, unsigned short ev, unsigned short f); | 175 | unsigned short i, unsigned short ev, unsigned short f); |
176 | 176 | ||
177 | #endif | 177 | #endif |