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/sc | |
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/sc')
-rw-r--r-- | drivers/isdn/sc/card.h | 2 | ||||
-rw-r--r-- | drivers/isdn/sc/command.c | 132 | ||||
-rw-r--r-- | drivers/isdn/sc/event.c | 24 | ||||
-rw-r--r-- | drivers/isdn/sc/hardware.h | 2 | ||||
-rw-r--r-- | drivers/isdn/sc/init.c | 122 | ||||
-rw-r--r-- | drivers/isdn/sc/interrupt.c | 144 | ||||
-rw-r--r-- | drivers/isdn/sc/ioctl.c | 220 | ||||
-rw-r--r-- | drivers/isdn/sc/message.c | 126 | ||||
-rw-r--r-- | drivers/isdn/sc/message.h | 18 | ||||
-rw-r--r-- | drivers/isdn/sc/packet.c | 129 | ||||
-rw-r--r-- | drivers/isdn/sc/scioc.h | 5 | ||||
-rw-r--r-- | drivers/isdn/sc/shmem.c | 52 | ||||
-rw-r--r-- | drivers/isdn/sc/timer.c | 25 |
13 files changed, 499 insertions, 502 deletions
diff --git a/drivers/isdn/sc/card.h b/drivers/isdn/sc/card.h index 0120bcf88311..3da69ee43da7 100644 --- a/drivers/isdn/sc/card.h +++ b/drivers/isdn/sc/card.h | |||
@@ -118,7 +118,7 @@ int send_and_receive(int card, unsigned int procid, unsigned char type, | |||
118 | unsigned char class, unsigned char code, | 118 | unsigned char class, unsigned char code, |
119 | unsigned char link, unsigned char data_len, | 119 | unsigned char link, unsigned char data_len, |
120 | unsigned char *data, RspMessage *mesgdata, int timeout); | 120 | unsigned char *data, RspMessage *mesgdata, int timeout); |
121 | void flushreadfifo (int card); | 121 | void flushreadfifo(int card); |
122 | int sendmessage(int card, unsigned int procid, unsigned int type, | 122 | int sendmessage(int card, unsigned int procid, unsigned int type, |
123 | unsigned int class, unsigned int code, unsigned int link, | 123 | unsigned int class, unsigned int code, unsigned int link, |
124 | unsigned int data_len, unsigned int *data); | 124 | unsigned int data_len, unsigned int *data); |
diff --git a/drivers/isdn/sc/command.c b/drivers/isdn/sc/command.c index 0e4969c2ef95..4a4e66152ce7 100644 --- a/drivers/isdn/sc/command.c +++ b/drivers/isdn/sc/command.c | |||
@@ -69,14 +69,14 @@ int get_card_from_id(int driver) | |||
69 | { | 69 | { |
70 | int i; | 70 | int i; |
71 | 71 | ||
72 | for(i = 0 ; i < cinst ; i++) { | 72 | for (i = 0; i < cinst; i++) { |
73 | if(sc_adapter[i]->driverId == driver) | 73 | if (sc_adapter[i]->driverId == driver) |
74 | return i; | 74 | return i; |
75 | } | 75 | } |
76 | return -ENODEV; | 76 | return -ENODEV; |
77 | } | 77 | } |
78 | 78 | ||
79 | /* | 79 | /* |
80 | * command | 80 | * command |
81 | */ | 81 | */ |
82 | 82 | ||
@@ -85,7 +85,7 @@ int command(isdn_ctrl *cmd) | |||
85 | int card; | 85 | int card; |
86 | 86 | ||
87 | card = get_card_from_id(cmd->driver); | 87 | card = get_card_from_id(cmd->driver); |
88 | if(!IS_VALID_CARD(card)) { | 88 | if (!IS_VALID_CARD(card)) { |
89 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 89 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
90 | return -ENODEV; | 90 | return -ENODEV; |
91 | } | 91 | } |
@@ -93,17 +93,17 @@ int command(isdn_ctrl *cmd) | |||
93 | /* | 93 | /* |
94 | * Dispatch the command | 94 | * Dispatch the command |
95 | */ | 95 | */ |
96 | switch(cmd->command) { | 96 | switch (cmd->command) { |
97 | case ISDN_CMD_IOCTL: | 97 | case ISDN_CMD_IOCTL: |
98 | { | 98 | { |
99 | unsigned long cmdptr; | 99 | unsigned long cmdptr; |
100 | scs_ioctl ioc; | 100 | scs_ioctl ioc; |
101 | 101 | ||
102 | memcpy(&cmdptr, cmd->parm.num, sizeof(unsigned long)); | 102 | memcpy(&cmdptr, cmd->parm.num, sizeof(unsigned long)); |
103 | if (copy_from_user(&ioc, (scs_ioctl __user *)cmdptr, | 103 | if (copy_from_user(&ioc, (scs_ioctl __user *)cmdptr, |
104 | sizeof(scs_ioctl))) { | 104 | sizeof(scs_ioctl))) { |
105 | pr_debug("%s: Failed to verify user space 0x%lx\n", | 105 | pr_debug("%s: Failed to verify user space 0x%lx\n", |
106 | sc_adapter[card]->devicename, cmdptr); | 106 | sc_adapter[card]->devicename, cmdptr); |
107 | return -EFAULT; | 107 | return -EFAULT; |
108 | } | 108 | } |
109 | return sc_ioctl(card, &ioc); | 109 | return sc_ioctl(card, &ioc); |
@@ -133,76 +133,76 @@ int command(isdn_ctrl *cmd) | |||
133 | /* | 133 | /* |
134 | * start the onboard firmware | 134 | * start the onboard firmware |
135 | */ | 135 | */ |
136 | int startproc(int card) | 136 | int startproc(int card) |
137 | { | 137 | { |
138 | int status; | 138 | int status; |
139 | 139 | ||
140 | if(!IS_VALID_CARD(card)) { | 140 | if (!IS_VALID_CARD(card)) { |
141 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 141 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
142 | return -ENODEV; | 142 | return -ENODEV; |
143 | } | 143 | } |
144 | 144 | ||
145 | /* | 145 | /* |
146 | * send start msg | 146 | * send start msg |
147 | */ | 147 | */ |
148 | status = sendmessage(card, CMPID,cmReqType2, | 148 | status = sendmessage(card, CMPID, cmReqType2, |
149 | cmReqClass0, | 149 | cmReqClass0, |
150 | cmReqStartProc, | 150 | cmReqStartProc, |
151 | 0,0,NULL); | 151 | 0, 0, NULL); |
152 | pr_debug("%s: Sent startProc\n", sc_adapter[card]->devicename); | 152 | pr_debug("%s: Sent startProc\n", sc_adapter[card]->devicename); |
153 | 153 | ||
154 | return status; | 154 | return status; |
155 | } | 155 | } |
156 | 156 | ||
157 | 157 | ||
158 | /* | 158 | /* |
159 | * Dials the number passed in | 159 | * Dials the number passed in |
160 | */ | 160 | */ |
161 | static int dial(int card, unsigned long channel, setup_parm setup) | 161 | static int dial(int card, unsigned long channel, setup_parm setup) |
162 | { | 162 | { |
163 | int status; | 163 | int status; |
164 | char Phone[48]; | 164 | char Phone[48]; |
165 | 165 | ||
166 | if(!IS_VALID_CARD(card)) { | 166 | if (!IS_VALID_CARD(card)) { |
167 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 167 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
168 | return -ENODEV; | 168 | return -ENODEV; |
169 | } | 169 | } |
170 | 170 | ||
171 | /*extract ISDN number to dial from eaz/msn string*/ | 171 | /*extract ISDN number to dial from eaz/msn string*/ |
172 | strcpy(Phone,setup.phone); | 172 | strcpy(Phone, setup.phone); |
173 | 173 | ||
174 | /*send the connection message*/ | 174 | /*send the connection message*/ |
175 | status = sendmessage(card, CEPID,ceReqTypePhy, | 175 | status = sendmessage(card, CEPID, ceReqTypePhy, |
176 | ceReqClass1, | 176 | ceReqClass1, |
177 | ceReqPhyConnect, | 177 | ceReqPhyConnect, |
178 | (unsigned char) channel+1, | 178 | (unsigned char)channel + 1, |
179 | strlen(Phone), | 179 | strlen(Phone), |
180 | (unsigned int *) Phone); | 180 | (unsigned int *)Phone); |
181 | 181 | ||
182 | pr_debug("%s: Dialing %s on channel %lu\n", | 182 | pr_debug("%s: Dialing %s on channel %lu\n", |
183 | sc_adapter[card]->devicename, Phone, channel+1); | 183 | sc_adapter[card]->devicename, Phone, channel + 1); |
184 | 184 | ||
185 | return status; | 185 | return status; |
186 | } | 186 | } |
187 | 187 | ||
188 | /* | 188 | /* |
189 | * Answer an incoming call | 189 | * Answer an incoming call |
190 | */ | 190 | */ |
191 | static int answer(int card, unsigned long channel) | 191 | static int answer(int card, unsigned long channel) |
192 | { | 192 | { |
193 | if(!IS_VALID_CARD(card)) { | 193 | if (!IS_VALID_CARD(card)) { |
194 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 194 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
195 | return -ENODEV; | 195 | return -ENODEV; |
196 | } | 196 | } |
197 | 197 | ||
198 | if(setup_buffers(card, channel+1)) { | 198 | if (setup_buffers(card, channel + 1)) { |
199 | hangup(card, channel+1); | 199 | hangup(card, channel + 1); |
200 | return -ENOBUFS; | 200 | return -ENOBUFS; |
201 | } | 201 | } |
202 | 202 | ||
203 | indicate_status(card, ISDN_STAT_BCONN,channel,NULL); | 203 | indicate_status(card, ISDN_STAT_BCONN, channel, NULL); |
204 | pr_debug("%s: Answered incoming call on channel %lu\n", | 204 | pr_debug("%s: Answered incoming call on channel %lu\n", |
205 | sc_adapter[card]->devicename, channel+1); | 205 | sc_adapter[card]->devicename, channel + 1); |
206 | return 0; | 206 | return 0; |
207 | } | 207 | } |
208 | 208 | ||
@@ -213,19 +213,19 @@ static int hangup(int card, unsigned long channel) | |||
213 | { | 213 | { |
214 | int status; | 214 | int status; |
215 | 215 | ||
216 | if(!IS_VALID_CARD(card)) { | 216 | if (!IS_VALID_CARD(card)) { |
217 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 217 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
218 | return -ENODEV; | 218 | return -ENODEV; |
219 | } | 219 | } |
220 | 220 | ||
221 | status = sendmessage(card, CEPID, ceReqTypePhy, | 221 | status = sendmessage(card, CEPID, ceReqTypePhy, |
222 | ceReqClass1, | 222 | ceReqClass1, |
223 | ceReqPhyDisconnect, | 223 | ceReqPhyDisconnect, |
224 | (unsigned char) channel+1, | 224 | (unsigned char)channel + 1, |
225 | 0, | 225 | 0, |
226 | NULL); | 226 | NULL); |
227 | pr_debug("%s: Sent HANGUP message to channel %lu\n", | 227 | pr_debug("%s: Sent HANGUP message to channel %lu\n", |
228 | sc_adapter[card]->devicename, channel+1); | 228 | sc_adapter[card]->devicename, channel + 1); |
229 | return status; | 229 | return status; |
230 | } | 230 | } |
231 | 231 | ||
@@ -234,10 +234,10 @@ static int hangup(int card, unsigned long channel) | |||
234 | */ | 234 | */ |
235 | static int setl2(int card, unsigned long arg) | 235 | static int setl2(int card, unsigned long arg) |
236 | { | 236 | { |
237 | int status =0; | 237 | int status = 0; |
238 | int protocol,channel; | 238 | int protocol, channel; |
239 | 239 | ||
240 | if(!IS_VALID_CARD(card)) { | 240 | if (!IS_VALID_CARD(card)) { |
241 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 241 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
242 | return -ENODEV; | 242 | return -ENODEV; |
243 | } | 243 | } |
@@ -249,14 +249,14 @@ static int setl2(int card, unsigned long arg) | |||
249 | * check that the adapter is also set to the correct protocol | 249 | * check that the adapter is also set to the correct protocol |
250 | */ | 250 | */ |
251 | pr_debug("%s: Sending GetFrameFormat for channel %d\n", | 251 | pr_debug("%s: Sending GetFrameFormat for channel %d\n", |
252 | sc_adapter[card]->devicename, channel+1); | 252 | sc_adapter[card]->devicename, channel + 1); |
253 | status = sendmessage(card, CEPID, ceReqTypeCall, | 253 | status = sendmessage(card, CEPID, ceReqTypeCall, |
254 | ceReqClass0, | 254 | ceReqClass0, |
255 | ceReqCallGetFrameFormat, | 255 | ceReqCallGetFrameFormat, |
256 | (unsigned char)channel+1, | 256 | (unsigned char)channel + 1, |
257 | 1, | 257 | 1, |
258 | (unsigned int *) protocol); | 258 | (unsigned int *)protocol); |
259 | if(status) | 259 | if (status) |
260 | return status; | 260 | return status; |
261 | return 0; | 261 | return 0; |
262 | } | 262 | } |
@@ -268,7 +268,7 @@ static int setl3(int card, unsigned long channel) | |||
268 | { | 268 | { |
269 | int protocol = channel >> 8; | 269 | int protocol = channel >> 8; |
270 | 270 | ||
271 | if(!IS_VALID_CARD(card)) { | 271 | if (!IS_VALID_CARD(card)) { |
272 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 272 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
273 | return -ENODEV; | 273 | return -ENODEV; |
274 | } | 274 | } |
@@ -279,26 +279,26 @@ static int setl3(int card, unsigned long channel) | |||
279 | 279 | ||
280 | static int acceptb(int card, unsigned long channel) | 280 | static int acceptb(int card, unsigned long channel) |
281 | { | 281 | { |
282 | if(!IS_VALID_CARD(card)) { | 282 | if (!IS_VALID_CARD(card)) { |
283 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 283 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
284 | return -ENODEV; | 284 | return -ENODEV; |
285 | } | 285 | } |
286 | 286 | ||
287 | if(setup_buffers(card, channel+1)) | 287 | if (setup_buffers(card, channel + 1)) |
288 | { | 288 | { |
289 | hangup(card, channel+1); | 289 | hangup(card, channel + 1); |
290 | return -ENOBUFS; | 290 | return -ENOBUFS; |
291 | } | 291 | } |
292 | 292 | ||
293 | pr_debug("%s: B-Channel connection accepted on channel %lu\n", | 293 | pr_debug("%s: B-Channel connection accepted on channel %lu\n", |
294 | sc_adapter[card]->devicename, channel+1); | 294 | sc_adapter[card]->devicename, channel + 1); |
295 | indicate_status(card, ISDN_STAT_BCONN, channel, NULL); | 295 | indicate_status(card, ISDN_STAT_BCONN, channel, NULL); |
296 | return 0; | 296 | return 0; |
297 | } | 297 | } |
298 | 298 | ||
299 | static int clreaz(int card, unsigned long arg) | 299 | static int clreaz(int card, unsigned long arg) |
300 | { | 300 | { |
301 | if(!IS_VALID_CARD(card)) { | 301 | if (!IS_VALID_CARD(card)) { |
302 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 302 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
303 | return -ENODEV; | 303 | return -ENODEV; |
304 | } | 304 | } |
@@ -306,13 +306,13 @@ static int clreaz(int card, unsigned long arg) | |||
306 | strcpy(sc_adapter[card]->channel[arg].eazlist, ""); | 306 | strcpy(sc_adapter[card]->channel[arg].eazlist, ""); |
307 | sc_adapter[card]->channel[arg].eazclear = 1; | 307 | sc_adapter[card]->channel[arg].eazclear = 1; |
308 | pr_debug("%s: EAZ List cleared for channel %lu\n", | 308 | pr_debug("%s: EAZ List cleared for channel %lu\n", |
309 | sc_adapter[card]->devicename, arg+1); | 309 | sc_adapter[card]->devicename, arg + 1); |
310 | return 0; | 310 | return 0; |
311 | } | 311 | } |
312 | 312 | ||
313 | static int seteaz(int card, unsigned long arg, char *num) | 313 | static int seteaz(int card, unsigned long arg, char *num) |
314 | { | 314 | { |
315 | if(!IS_VALID_CARD(card)) { | 315 | if (!IS_VALID_CARD(card)) { |
316 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 316 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
317 | return -ENODEV; | 317 | return -ENODEV; |
318 | } | 318 | } |
@@ -320,8 +320,8 @@ static int seteaz(int card, unsigned long arg, char *num) | |||
320 | strcpy(sc_adapter[card]->channel[arg].eazlist, num); | 320 | strcpy(sc_adapter[card]->channel[arg].eazlist, num); |
321 | sc_adapter[card]->channel[arg].eazclear = 0; | 321 | sc_adapter[card]->channel[arg].eazclear = 0; |
322 | pr_debug("%s: EAZ list for channel %lu set to: %s\n", | 322 | pr_debug("%s: EAZ list for channel %lu set to: %s\n", |
323 | sc_adapter[card]->devicename, arg+1, | 323 | sc_adapter[card]->devicename, arg + 1, |
324 | sc_adapter[card]->channel[arg].eazlist); | 324 | sc_adapter[card]->channel[arg].eazlist); |
325 | return 0; | 325 | return 0; |
326 | } | 326 | } |
327 | 327 | ||
@@ -329,14 +329,14 @@ int reset(int card) | |||
329 | { | 329 | { |
330 | unsigned long flags; | 330 | unsigned long flags; |
331 | 331 | ||
332 | if(!IS_VALID_CARD(card)) { | 332 | if (!IS_VALID_CARD(card)) { |
333 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 333 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
334 | return -ENODEV; | 334 | return -ENODEV; |
335 | } | 335 | } |
336 | 336 | ||
337 | indicate_status(card, ISDN_STAT_STOP, 0, NULL); | 337 | indicate_status(card, ISDN_STAT_STOP, 0, NULL); |
338 | 338 | ||
339 | if(sc_adapter[card]->EngineUp) { | 339 | if (sc_adapter[card]->EngineUp) { |
340 | del_timer(&sc_adapter[card]->stat_timer); | 340 | del_timer(&sc_adapter[card]->stat_timer); |
341 | } | 341 | } |
342 | 342 | ||
@@ -350,14 +350,14 @@ int reset(int card) | |||
350 | add_timer(&sc_adapter[card]->reset_timer); | 350 | add_timer(&sc_adapter[card]->reset_timer); |
351 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | 351 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); |
352 | 352 | ||
353 | outb(0x1,sc_adapter[card]->ioport[SFT_RESET]); | 353 | outb(0x1, sc_adapter[card]->ioport[SFT_RESET]); |
354 | 354 | ||
355 | pr_debug("%s: Adapter Reset\n", sc_adapter[card]->devicename); | 355 | pr_debug("%s: Adapter Reset\n", sc_adapter[card]->devicename); |
356 | return 0; | 356 | return 0; |
357 | } | 357 | } |
358 | 358 | ||
359 | void flushreadfifo (int card) | 359 | void flushreadfifo(int card) |
360 | { | 360 | { |
361 | while(inb(sc_adapter[card]->ioport[FIFO_STATUS]) & RF_HAS_DATA) | 361 | while (inb(sc_adapter[card]->ioport[FIFO_STATUS]) & RF_HAS_DATA) |
362 | inb(sc_adapter[card]->ioport[FIFO_READ]); | 362 | inb(sc_adapter[card]->ioport[FIFO_READ]); |
363 | } | 363 | } |
diff --git a/drivers/isdn/sc/event.c b/drivers/isdn/sc/event.c index 498f4039ece2..717003a3bdf4 100644 --- a/drivers/isdn/sc/event.c +++ b/drivers/isdn/sc/event.c | |||
@@ -38,26 +38,26 @@ static char *events[] = { "ISDN_STAT_STAVAIL", | |||
38 | "ISDN_STAT_CAUSE" }; | 38 | "ISDN_STAT_CAUSE" }; |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | int indicate_status(int card, int event,ulong Channel,char *Data) | 41 | int indicate_status(int card, int event, ulong Channel, char *Data) |
42 | { | 42 | { |
43 | isdn_ctrl cmd; | 43 | isdn_ctrl cmd; |
44 | 44 | ||
45 | #ifdef DEBUG | 45 | #ifdef DEBUG |
46 | pr_debug("%s: Indicating event %s on Channel %d\n", | 46 | pr_debug("%s: Indicating event %s on Channel %d\n", |
47 | sc_adapter[card]->devicename, events[event-256], Channel); | 47 | sc_adapter[card]->devicename, events[event - 256], Channel); |
48 | #endif | 48 | #endif |
49 | if (Data != NULL){ | 49 | if (Data != NULL) { |
50 | pr_debug("%s: Event data: %s\n", sc_adapter[card]->devicename, | 50 | pr_debug("%s: Event data: %s\n", sc_adapter[card]->devicename, |
51 | Data); | 51 | Data); |
52 | switch (event) { | 52 | switch (event) { |
53 | case ISDN_STAT_BSENT: | 53 | case ISDN_STAT_BSENT: |
54 | memcpy(&cmd.parm.length, Data, sizeof(cmd.parm.length)); | 54 | memcpy(&cmd.parm.length, Data, sizeof(cmd.parm.length)); |
55 | break; | 55 | break; |
56 | case ISDN_STAT_ICALL: | 56 | case ISDN_STAT_ICALL: |
57 | memcpy(&cmd.parm.setup, Data, sizeof(cmd.parm.setup)); | 57 | memcpy(&cmd.parm.setup, Data, sizeof(cmd.parm.setup)); |
58 | break; | 58 | break; |
59 | default: | 59 | default: |
60 | strcpy(cmd.parm.num, Data); | 60 | strcpy(cmd.parm.num, Data); |
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
diff --git a/drivers/isdn/sc/hardware.h b/drivers/isdn/sc/hardware.h index 627324856ead..81fbe78701f0 100644 --- a/drivers/isdn/sc/hardware.h +++ b/drivers/isdn/sc/hardware.h | |||
@@ -105,6 +105,6 @@ | |||
105 | */ | 105 | */ |
106 | 106 | ||
107 | /* Determine if a channel number is valid for the adapter */ | 107 | /* Determine if a channel number is valid for the adapter */ |
108 | #define IS_VALID_CHANNEL(y,x) ((x>0) && (x <= sc_adapter[y]->channels)) | 108 | #define IS_VALID_CHANNEL(y, x) ((x > 0) && (x <= sc_adapter[y]->channels)) |
109 | 109 | ||
110 | #endif | 110 | #endif |
diff --git a/drivers/isdn/sc/init.c b/drivers/isdn/sc/init.c index 023de789f250..6b580b2c717f 100644 --- a/drivers/isdn/sc/init.c +++ b/drivers/isdn/sc/init.c | |||
@@ -27,9 +27,9 @@ static const char version[] = "2.0b1"; | |||
27 | static const char *boardname[] = { "DataCommute/BRI", "DataCommute/PRI", "TeleCommute/BRI" }; | 27 | static const char *boardname[] = { "DataCommute/BRI", "DataCommute/PRI", "TeleCommute/BRI" }; |
28 | 28 | ||
29 | /* insmod set parameters */ | 29 | /* insmod set parameters */ |
30 | static unsigned int io[] = {0,0,0,0}; | 30 | static unsigned int io[] = {0, 0, 0, 0}; |
31 | static unsigned char irq[] = {0,0,0,0}; | 31 | static unsigned char irq[] = {0, 0, 0, 0}; |
32 | static unsigned long ram[] = {0,0,0,0}; | 32 | static unsigned long ram[] = {0, 0, 0, 0}; |
33 | static bool do_reset = 0; | 33 | static bool do_reset = 0; |
34 | 34 | ||
35 | module_param_array(io, int, NULL, 0); | 35 | module_param_array(io, int, NULL, 0); |
@@ -62,7 +62,7 @@ static int __init sc_init(void) | |||
62 | #endif | 62 | #endif |
63 | pr_info("Copyright (C) 1996 SpellCaster Telecommunications Inc.\n"); | 63 | pr_info("Copyright (C) 1996 SpellCaster Telecommunications Inc.\n"); |
64 | 64 | ||
65 | while(b++ < MAX_CARDS - 1) { | 65 | while (b++ < MAX_CARDS - 1) { |
66 | pr_debug("Probing for adapter #%d\n", b); | 66 | pr_debug("Probing for adapter #%d\n", b); |
67 | /* | 67 | /* |
68 | * Initialize reusable variables | 68 | * Initialize reusable variables |
@@ -72,17 +72,17 @@ static int __init sc_init(void) | |||
72 | channels = 0; | 72 | channels = 0; |
73 | pgport = 0; | 73 | pgport = 0; |
74 | 74 | ||
75 | /* | 75 | /* |
76 | * See if we should probe for IO base | 76 | * See if we should probe for IO base |
77 | */ | 77 | */ |
78 | pr_debug("I/O Base for board %d is 0x%x, %s probe\n", b, io[b], | 78 | pr_debug("I/O Base for board %d is 0x%x, %s probe\n", b, io[b], |
79 | io[b] == 0 ? "will" : "won't"); | 79 | io[b] == 0 ? "will" : "won't"); |
80 | if(io[b]) { | 80 | if (io[b]) { |
81 | /* | 81 | /* |
82 | * No, I/O Base has been provided | 82 | * No, I/O Base has been provided |
83 | */ | 83 | */ |
84 | for (i = 0 ; i < MAX_IO_REGS - 1 ; i++) { | 84 | for (i = 0; i < MAX_IO_REGS - 1; i++) { |
85 | if(!request_region(io[b] + i * 0x400, 1, "sc test")) { | 85 | if (!request_region(io[b] + i * 0x400, 1, "sc test")) { |
86 | pr_debug("request_region for 0x%x failed\n", io[b] + i * 0x400); | 86 | pr_debug("request_region for 0x%x failed\n", io[b] + i * 0x400); |
87 | io[b] = 0; | 87 | io[b] = 0; |
88 | break; | 88 | break; |
@@ -93,13 +93,13 @@ static int __init sc_init(void) | |||
93 | /* | 93 | /* |
94 | * Confirm the I/O Address with a test | 94 | * Confirm the I/O Address with a test |
95 | */ | 95 | */ |
96 | if(io[b] == 0) { | 96 | if (io[b] == 0) { |
97 | pr_debug("I/O Address invalid.\n"); | 97 | pr_debug("I/O Address invalid.\n"); |
98 | continue; | 98 | continue; |
99 | } | 99 | } |
100 | 100 | ||
101 | outb(0x18, io[b] + 0x400 * EXP_PAGE0); | 101 | outb(0x18, io[b] + 0x400 * EXP_PAGE0); |
102 | if(inb(io[b] + 0x400 * EXP_PAGE0) != 0x18) { | 102 | if (inb(io[b] + 0x400 * EXP_PAGE0) != 0x18) { |
103 | pr_debug("I/O Base 0x%x fails test\n", | 103 | pr_debug("I/O Base 0x%x fails test\n", |
104 | io[b] + 0x400 * EXP_PAGE0); | 104 | io[b] + 0x400 * EXP_PAGE0); |
105 | continue; | 105 | continue; |
@@ -109,12 +109,12 @@ static int __init sc_init(void) | |||
109 | /* | 109 | /* |
110 | * Yes, probe for I/O Base | 110 | * Yes, probe for I/O Base |
111 | */ | 111 | */ |
112 | if(probe_exhasted) { | 112 | if (probe_exhasted) { |
113 | pr_debug("All probe addresses exhasted, skipping\n"); | 113 | pr_debug("All probe addresses exhasted, skipping\n"); |
114 | continue; | 114 | continue; |
115 | } | 115 | } |
116 | pr_debug("Probing for I/O...\n"); | 116 | pr_debug("Probing for I/O...\n"); |
117 | for (i = last_base ; i <= IOBASE_MAX ; i += IOBASE_OFFSET) { | 117 | for (i = last_base; i <= IOBASE_MAX; i += IOBASE_OFFSET) { |
118 | int found_io = 1; | 118 | int found_io = 1; |
119 | if (i == IOBASE_MAX) { | 119 | if (i == IOBASE_MAX) { |
120 | probe_exhasted = 1; /* No more addresses to probe */ | 120 | probe_exhasted = 1; /* No more addresses to probe */ |
@@ -122,19 +122,19 @@ static int __init sc_init(void) | |||
122 | } | 122 | } |
123 | last_base = i + IOBASE_OFFSET; | 123 | last_base = i + IOBASE_OFFSET; |
124 | pr_debug(" checking 0x%x...", i); | 124 | pr_debug(" checking 0x%x...", i); |
125 | for ( j = 0 ; j < MAX_IO_REGS - 1 ; j++) { | 125 | for (j = 0; j < MAX_IO_REGS - 1; j++) { |
126 | if(!request_region(i + j * 0x400, 1, "sc test")) { | 126 | if (!request_region(i + j * 0x400, 1, "sc test")) { |
127 | pr_debug("Failed\n"); | 127 | pr_debug("Failed\n"); |
128 | found_io = 0; | 128 | found_io = 0; |
129 | break; | 129 | break; |
130 | } else | 130 | } else |
131 | release_region(i + j * 0x400, 1); | 131 | release_region(i + j * 0x400, 1); |
132 | } | 132 | } |
133 | 133 | ||
134 | if(found_io) { | 134 | if (found_io) { |
135 | io[b] = i; | 135 | io[b] = i; |
136 | outb(0x18, io[b] + 0x400 * EXP_PAGE0); | 136 | outb(0x18, io[b] + 0x400 * EXP_PAGE0); |
137 | if(inb(io[b] + 0x400 * EXP_PAGE0) != 0x18) { | 137 | if (inb(io[b] + 0x400 * EXP_PAGE0) != 0x18) { |
138 | pr_debug("Failed by test\n"); | 138 | pr_debug("Failed by test\n"); |
139 | continue; | 139 | continue; |
140 | } | 140 | } |
@@ -142,7 +142,7 @@ static int __init sc_init(void) | |||
142 | break; | 142 | break; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | if(probe_exhasted) { | 145 | if (probe_exhasted) { |
146 | continue; | 146 | continue; |
147 | } | 147 | } |
148 | } | 148 | } |
@@ -150,23 +150,23 @@ static int __init sc_init(void) | |||
150 | /* | 150 | /* |
151 | * See if we should probe for shared RAM | 151 | * See if we should probe for shared RAM |
152 | */ | 152 | */ |
153 | if(do_reset) { | 153 | if (do_reset) { |
154 | pr_debug("Doing a SAFE probe reset\n"); | 154 | pr_debug("Doing a SAFE probe reset\n"); |
155 | outb(0xFF, io[b] + RESET_OFFSET); | 155 | outb(0xFF, io[b] + RESET_OFFSET); |
156 | msleep_interruptible(10000); | 156 | msleep_interruptible(10000); |
157 | } | 157 | } |
158 | pr_debug("RAM Base for board %d is 0x%lx, %s probe\n", b, | 158 | pr_debug("RAM Base for board %d is 0x%lx, %s probe\n", b, |
159 | ram[b], ram[b] == 0 ? "will" : "won't"); | 159 | ram[b], ram[b] == 0 ? "will" : "won't"); |
160 | 160 | ||
161 | if(ram[b]) { | 161 | if (ram[b]) { |
162 | /* | 162 | /* |
163 | * No, the RAM base has been provided | 163 | * No, the RAM base has been provided |
164 | * Just look for a signature and ID the | 164 | * Just look for a signature and ID the |
165 | * board model | 165 | * board model |
166 | */ | 166 | */ |
167 | if(request_region(ram[b], SRAM_PAGESIZE, "sc test")) { | 167 | if (request_region(ram[b], SRAM_PAGESIZE, "sc test")) { |
168 | pr_debug("request_region for RAM base 0x%lx succeeded\n", ram[b]); | 168 | pr_debug("request_region for RAM base 0x%lx succeeded\n", ram[b]); |
169 | model = identify_board(ram[b], io[b]); | 169 | model = identify_board(ram[b], io[b]); |
170 | release_region(ram[b], SRAM_PAGESIZE); | 170 | release_region(ram[b], SRAM_PAGESIZE); |
171 | } | 171 | } |
172 | } | 172 | } |
@@ -175,15 +175,15 @@ static int __init sc_init(void) | |||
175 | * Yes, probe for free RAM and look for | 175 | * Yes, probe for free RAM and look for |
176 | * a signature and id the board model | 176 | * a signature and id the board model |
177 | */ | 177 | */ |
178 | for (i = SRAM_MIN ; i < SRAM_MAX ; i += SRAM_PAGESIZE) { | 178 | for (i = SRAM_MIN; i < SRAM_MAX; i += SRAM_PAGESIZE) { |
179 | pr_debug("Checking RAM address 0x%x...\n", i); | 179 | pr_debug("Checking RAM address 0x%x...\n", i); |
180 | if(request_region(i, SRAM_PAGESIZE, "sc test")) { | 180 | if (request_region(i, SRAM_PAGESIZE, "sc test")) { |
181 | pr_debug(" request_region succeeded\n"); | 181 | pr_debug(" request_region succeeded\n"); |
182 | model = identify_board(i, io[b]); | 182 | model = identify_board(i, io[b]); |
183 | release_region(i, SRAM_PAGESIZE); | 183 | release_region(i, SRAM_PAGESIZE); |
184 | if (model >= 0) { | 184 | if (model >= 0) { |
185 | pr_debug(" Identified a %s\n", | 185 | pr_debug(" Identified a %s\n", |
186 | boardname[model]); | 186 | boardname[model]); |
187 | ram[b] = i; | 187 | ram[b] = i; |
188 | break; | 188 | break; |
189 | } | 189 | } |
@@ -196,19 +196,19 @@ static int __init sc_init(void) | |||
196 | /* | 196 | /* |
197 | * See if we found free RAM and the board model | 197 | * See if we found free RAM and the board model |
198 | */ | 198 | */ |
199 | if(!ram[b] || model < 0) { | 199 | if (!ram[b] || model < 0) { |
200 | /* | 200 | /* |
201 | * Nope, there was no place in RAM for the | 201 | * Nope, there was no place in RAM for the |
202 | * board, or it couldn't be identified | 202 | * board, or it couldn't be identified |
203 | */ | 203 | */ |
204 | pr_debug("Failed to find an adapter at 0x%lx\n", ram[b]); | 204 | pr_debug("Failed to find an adapter at 0x%lx\n", ram[b]); |
205 | continue; | 205 | continue; |
206 | } | 206 | } |
207 | 207 | ||
208 | /* | 208 | /* |
209 | * Set the board's magic number, memory size and page register | 209 | * Set the board's magic number, memory size and page register |
210 | */ | 210 | */ |
211 | switch(model) { | 211 | switch (model) { |
212 | case PRI_BOARD: | 212 | case PRI_BOARD: |
213 | channels = 23; | 213 | channels = 23; |
214 | magic = 0x20000; | 214 | magic = 0x20000; |
@@ -224,7 +224,7 @@ static int __init sc_init(void) | |||
224 | features = BRI_FEATURES; | 224 | features = BRI_FEATURES; |
225 | break; | 225 | break; |
226 | } | 226 | } |
227 | switch(ram[b] >> 12 & 0x0F) { | 227 | switch (ram[b] >> 12 & 0x0F) { |
228 | case 0x0: | 228 | case 0x0: |
229 | pr_debug("RAM Page register set to EXP_PAGE0\n"); | 229 | pr_debug("RAM Page register set to EXP_PAGE0\n"); |
230 | pgport = EXP_PAGE0; | 230 | pgport = EXP_PAGE0; |
@@ -250,12 +250,12 @@ static int __init sc_init(void) | |||
250 | continue; | 250 | continue; |
251 | } | 251 | } |
252 | 252 | ||
253 | pr_debug("current IRQ: %d b: %d\n",irq[b],b); | 253 | pr_debug("current IRQ: %d b: %d\n", irq[b], b); |
254 | 254 | ||
255 | /* | 255 | /* |
256 | * Make sure we got an IRQ | 256 | * Make sure we got an IRQ |
257 | */ | 257 | */ |
258 | if(!irq[b]) { | 258 | if (!irq[b]) { |
259 | /* | 259 | /* |
260 | * No interrupt could be used | 260 | * No interrupt could be used |
261 | */ | 261 | */ |
@@ -299,7 +299,7 @@ static int __init sc_init(void) | |||
299 | } | 299 | } |
300 | spin_lock_init(&sc_adapter[cinst]->lock); | 300 | spin_lock_init(&sc_adapter[cinst]->lock); |
301 | 301 | ||
302 | if(!register_isdn(interface)) { | 302 | if (!register_isdn(interface)) { |
303 | /* | 303 | /* |
304 | * Oops, couldn't register for some reason | 304 | * Oops, couldn't register for some reason |
305 | */ | 305 | */ |
@@ -344,30 +344,30 @@ static int __init sc_init(void) | |||
344 | kfree(interface); | 344 | kfree(interface); |
345 | kfree(sc_adapter[cinst]); | 345 | kfree(sc_adapter[cinst]); |
346 | continue; | 346 | continue; |
347 | 347 | ||
348 | } | 348 | } |
349 | sc_adapter[cinst]->iobase = io[b]; | 349 | sc_adapter[cinst]->iobase = io[b]; |
350 | for(i = 0 ; i < MAX_IO_REGS - 1 ; i++) { | 350 | for (i = 0; i < MAX_IO_REGS - 1; i++) { |
351 | sc_adapter[cinst]->ioport[i] = io[b] + i * 0x400; | 351 | sc_adapter[cinst]->ioport[i] = io[b] + i * 0x400; |
352 | request_region(sc_adapter[cinst]->ioport[i], 1, | 352 | request_region(sc_adapter[cinst]->ioport[i], 1, |
353 | interface->id); | 353 | interface->id); |
354 | pr_debug("Requesting I/O Port %#x\n", | 354 | pr_debug("Requesting I/O Port %#x\n", |
355 | sc_adapter[cinst]->ioport[i]); | 355 | sc_adapter[cinst]->ioport[i]); |
356 | } | 356 | } |
357 | sc_adapter[cinst]->ioport[IRQ_SELECT] = io[b] + 0x2; | 357 | sc_adapter[cinst]->ioport[IRQ_SELECT] = io[b] + 0x2; |
358 | request_region(sc_adapter[cinst]->ioport[IRQ_SELECT], 1, | 358 | request_region(sc_adapter[cinst]->ioport[IRQ_SELECT], 1, |
359 | interface->id); | 359 | interface->id); |
360 | pr_debug("Requesting I/O Port %#x\n", | 360 | pr_debug("Requesting I/O Port %#x\n", |
361 | sc_adapter[cinst]->ioport[IRQ_SELECT]); | 361 | sc_adapter[cinst]->ioport[IRQ_SELECT]); |
362 | sc_adapter[cinst]->rambase = ram[b]; | 362 | sc_adapter[cinst]->rambase = ram[b]; |
363 | request_region(sc_adapter[cinst]->rambase, SRAM_PAGESIZE, | 363 | request_region(sc_adapter[cinst]->rambase, SRAM_PAGESIZE, |
364 | interface->id); | 364 | interface->id); |
365 | 365 | ||
366 | pr_info(" %s (%d) - %s %d channels IRQ %d, I/O Base 0x%x, RAM Base 0x%lx\n", | 366 | pr_info(" %s (%d) - %s %d channels IRQ %d, I/O Base 0x%x, RAM Base 0x%lx\n", |
367 | sc_adapter[cinst]->devicename, | 367 | sc_adapter[cinst]->devicename, |
368 | sc_adapter[cinst]->driverId, | 368 | sc_adapter[cinst]->driverId, |
369 | boardname[model], channels, irq[b], io[b], ram[b]); | 369 | boardname[model], channels, irq[b], io[b], ram[b]); |
370 | 370 | ||
371 | /* | 371 | /* |
372 | * reset the adapter to put things in motion | 372 | * reset the adapter to put things in motion |
373 | */ | 373 | */ |
@@ -376,7 +376,7 @@ static int __init sc_init(void) | |||
376 | cinst++; | 376 | cinst++; |
377 | status = 0; | 377 | status = 0; |
378 | } | 378 | } |
379 | if (status) | 379 | if (status) |
380 | pr_info("Failed to find any adapters, driver unloaded\n"); | 380 | pr_info("Failed to find any adapters, driver unloaded\n"); |
381 | return status; | 381 | return status; |
382 | } | 382 | } |
@@ -385,7 +385,7 @@ static void __exit sc_exit(void) | |||
385 | { | 385 | { |
386 | int i, j; | 386 | int i, j; |
387 | 387 | ||
388 | for(i = 0 ; i < cinst ; i++) { | 388 | for (i = 0; i < cinst; i++) { |
389 | pr_debug("Cleaning up after adapter %d\n", i); | 389 | pr_debug("Cleaning up after adapter %d\n", i); |
390 | /* | 390 | /* |
391 | * kill the timers | 391 | * kill the timers |
@@ -417,14 +417,14 @@ static void __exit sc_exit(void) | |||
417 | /* | 417 | /* |
418 | * Release the I/O Port regions | 418 | * Release the I/O Port regions |
419 | */ | 419 | */ |
420 | for(j = 0 ; j < MAX_IO_REGS - 1; j++) { | 420 | for (j = 0; j < MAX_IO_REGS - 1; j++) { |
421 | release_region(sc_adapter[i]->ioport[j], 1); | 421 | release_region(sc_adapter[i]->ioport[j], 1); |
422 | pr_debug("Releasing I/O Port %#x\n", | 422 | pr_debug("Releasing I/O Port %#x\n", |
423 | sc_adapter[i]->ioport[j]); | 423 | sc_adapter[i]->ioport[j]); |
424 | } | 424 | } |
425 | release_region(sc_adapter[i]->ioport[IRQ_SELECT], 1); | 425 | release_region(sc_adapter[i]->ioport[IRQ_SELECT], 1); |
426 | pr_debug("Releasing I/O Port %#x\n", | 426 | pr_debug("Releasing I/O Port %#x\n", |
427 | sc_adapter[i]->ioport[IRQ_SELECT]); | 427 | sc_adapter[i]->ioport[IRQ_SELECT]); |
428 | 428 | ||
429 | /* | 429 | /* |
430 | * Release any memory we alloced | 430 | * Release any memory we alloced |
@@ -447,19 +447,19 @@ static int identify_board(unsigned long rambase, unsigned int iobase) | |||
447 | int x; | 447 | int x; |
448 | 448 | ||
449 | pr_debug("Attempting to identify adapter @ 0x%lx io 0x%x\n", | 449 | pr_debug("Attempting to identify adapter @ 0x%lx io 0x%x\n", |
450 | rambase, iobase); | 450 | rambase, iobase); |
451 | 451 | ||
452 | /* | 452 | /* |
453 | * Enable the base pointer | 453 | * Enable the base pointer |
454 | */ | 454 | */ |
455 | outb(rambase >> 12, iobase + 0x2c00); | 455 | outb(rambase >> 12, iobase + 0x2c00); |
456 | 456 | ||
457 | switch(rambase >> 12 & 0x0F) { | 457 | switch (rambase >> 12 & 0x0F) { |
458 | case 0x0: | 458 | case 0x0: |
459 | pgport = iobase + PG0_OFFSET; | 459 | pgport = iobase + PG0_OFFSET; |
460 | pr_debug("Page Register offset is 0x%x\n", PG0_OFFSET); | 460 | pr_debug("Page Register offset is 0x%x\n", PG0_OFFSET); |
461 | break; | 461 | break; |
462 | 462 | ||
463 | case 0x4: | 463 | case 0x4: |
464 | pgport = iobase + PG1_OFFSET; | 464 | pgport = iobase + PG1_OFFSET; |
465 | pr_debug("Page Register offset is 0x%x\n", PG1_OFFSET); | 465 | pr_debug("Page Register offset is 0x%x\n", PG1_OFFSET); |
@@ -486,7 +486,7 @@ static int identify_board(unsigned long rambase, unsigned int iobase) | |||
486 | msleep_interruptible(1000); | 486 | msleep_interruptible(1000); |
487 | sig = readl(rambase + SIG_OFFSET); | 487 | sig = readl(rambase + SIG_OFFSET); |
488 | pr_debug("Looking for a signature, got 0x%lx\n", sig); | 488 | pr_debug("Looking for a signature, got 0x%lx\n", sig); |
489 | if(sig == SIGNATURE) | 489 | if (sig == SIGNATURE) |
490 | return PRI_BOARD; | 490 | return PRI_BOARD; |
491 | 491 | ||
492 | /* | 492 | /* |
@@ -496,7 +496,7 @@ static int identify_board(unsigned long rambase, unsigned int iobase) | |||
496 | msleep_interruptible(1000); | 496 | msleep_interruptible(1000); |
497 | sig = readl(rambase + SIG_OFFSET); | 497 | sig = readl(rambase + SIG_OFFSET); |
498 | pr_debug("Looking for a signature, got 0x%lx\n", sig); | 498 | pr_debug("Looking for a signature, got 0x%lx\n", sig); |
499 | if(sig == SIGNATURE) | 499 | if (sig == SIGNATURE) |
500 | return BRI_BOARD; | 500 | return BRI_BOARD; |
501 | 501 | ||
502 | return -1; | 502 | return -1; |
@@ -506,7 +506,7 @@ static int identify_board(unsigned long rambase, unsigned int iobase) | |||
506 | */ | 506 | */ |
507 | sig = readl(rambase + SIG_OFFSET); | 507 | sig = readl(rambase + SIG_OFFSET); |
508 | pr_debug("Looking for a signature, got 0x%lx\n", sig); | 508 | pr_debug("Looking for a signature, got 0x%lx\n", sig); |
509 | if(sig != SIGNATURE) | 509 | if (sig != SIGNATURE) |
510 | return -1; | 510 | return -1; |
511 | 511 | ||
512 | dpm = (DualPortMemory *) rambase; | 512 | dpm = (DualPortMemory *) rambase; |
@@ -523,11 +523,11 @@ static int identify_board(unsigned long rambase, unsigned int iobase) | |||
523 | * Wait for the response | 523 | * Wait for the response |
524 | */ | 524 | */ |
525 | x = 0; | 525 | x = 0; |
526 | while((inb(iobase + FIFOSTAT_OFFSET) & RF_HAS_DATA) && x < 100) { | 526 | while ((inb(iobase + FIFOSTAT_OFFSET) & RF_HAS_DATA) && x < 100) { |
527 | schedule_timeout_interruptible(1); | 527 | schedule_timeout_interruptible(1); |
528 | x++; | 528 | x++; |
529 | } | 529 | } |
530 | if(x == 100) { | 530 | if (x == 100) { |
531 | pr_debug("Timeout waiting for response\n"); | 531 | pr_debug("Timeout waiting for response\n"); |
532 | return -1; | 532 | return -1; |
533 | } | 533 | } |
@@ -540,11 +540,11 @@ static int identify_board(unsigned long rambase, unsigned int iobase) | |||
540 | hwci.st_u_sense ? "S/T" : "U", hwci.ram_size, | 540 | hwci.st_u_sense ? "S/T" : "U", hwci.ram_size, |
541 | hwci.serial_no, hwci.part_no, hwci.rev_no); | 541 | hwci.serial_no, hwci.part_no, hwci.rev_no); |
542 | 542 | ||
543 | if(!strncmp(PRI_PARTNO, hwci.part_no, 6)) | 543 | if (!strncmp(PRI_PARTNO, hwci.part_no, 6)) |
544 | return PRI_BOARD; | 544 | return PRI_BOARD; |
545 | if(!strncmp(BRI_PARTNO, hwci.part_no, 6)) | 545 | if (!strncmp(BRI_PARTNO, hwci.part_no, 6)) |
546 | return BRI_BOARD; | 546 | return BRI_BOARD; |
547 | 547 | ||
548 | return -1; | 548 | return -1; |
549 | } | 549 | } |
550 | 550 | ||
diff --git a/drivers/isdn/sc/interrupt.c b/drivers/isdn/sc/interrupt.c index f0225bc0f267..e80cc76bc314 100644 --- a/drivers/isdn/sc/interrupt.c +++ b/drivers/isdn/sc/interrupt.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | irqreturn_t interrupt_handler(int dummy, void *card_inst) | 27 | irqreturn_t interrupt_handler(int dummy, void *card_inst) |
28 | { | 28 | { |
@@ -31,15 +31,15 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) | |||
31 | int channel; | 31 | int channel; |
32 | int card = (int)(unsigned long) card_inst; | 32 | int card = (int)(unsigned long) card_inst; |
33 | 33 | ||
34 | if(!IS_VALID_CARD(card)) { | 34 | if (!IS_VALID_CARD(card)) { |
35 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 35 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
36 | return IRQ_NONE; | 36 | return IRQ_NONE; |
37 | } | 37 | } |
38 | 38 | ||
39 | pr_debug("%s: Entered Interrupt handler\n", | 39 | pr_debug("%s: Entered Interrupt handler\n", |
40 | sc_adapter[card]->devicename); | 40 | sc_adapter[card]->devicename); |
41 | 41 | ||
42 | /* | 42 | /* |
43 | * Pull all of the waiting messages off the response queue | 43 | * Pull all of the waiting messages off the response queue |
44 | */ | 44 | */ |
45 | while (!receivemessage(card, &rcvmsg)) { | 45 | while (!receivemessage(card, &rcvmsg)) { |
@@ -47,31 +47,31 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) | |||
47 | * Push the message to the adapter structure for | 47 | * Push the message to the adapter structure for |
48 | * send_and_receive to snoop | 48 | * send_and_receive to snoop |
49 | */ | 49 | */ |
50 | if(sc_adapter[card]->want_async_messages) | 50 | if (sc_adapter[card]->want_async_messages) |
51 | memcpy(&(sc_adapter[card]->async_msg), | 51 | memcpy(&(sc_adapter[card]->async_msg), |
52 | &rcvmsg, sizeof(RspMessage)); | 52 | &rcvmsg, sizeof(RspMessage)); |
53 | 53 | ||
54 | channel = (unsigned int) rcvmsg.phy_link_no; | 54 | channel = (unsigned int) rcvmsg.phy_link_no; |
55 | 55 | ||
56 | /* | 56 | /* |
57 | * Trap Invalid request messages | 57 | * Trap Invalid request messages |
58 | */ | 58 | */ |
59 | if(IS_CM_MESSAGE(rcvmsg, 0, 0, Invalid)) { | 59 | if (IS_CM_MESSAGE(rcvmsg, 0, 0, Invalid)) { |
60 | pr_debug("%s: Invalid request Message, rsp_status = %d\n", | 60 | pr_debug("%s: Invalid request Message, rsp_status = %d\n", |
61 | sc_adapter[card]->devicename, | 61 | sc_adapter[card]->devicename, |
62 | rcvmsg.rsp_status); | 62 | rcvmsg.rsp_status); |
63 | break; | 63 | break; |
64 | } | 64 | } |
65 | 65 | ||
66 | /* | 66 | /* |
67 | * Check for a linkRead message | 67 | * Check for a linkRead message |
68 | */ | 68 | */ |
69 | if (IS_CE_MESSAGE(rcvmsg, Lnk, 1, Read)) | 69 | if (IS_CE_MESSAGE(rcvmsg, Lnk, 1, Read)) |
70 | { | 70 | { |
71 | pr_debug("%s: Received packet 0x%x bytes long at 0x%lx\n", | 71 | pr_debug("%s: Received packet 0x%x bytes long at 0x%lx\n", |
72 | sc_adapter[card]->devicename, | 72 | sc_adapter[card]->devicename, |
73 | rcvmsg.msg_data.response.msg_len, | 73 | rcvmsg.msg_data.response.msg_len, |
74 | rcvmsg.msg_data.response.buff_offset); | 74 | rcvmsg.msg_data.response.buff_offset); |
75 | rcvpkt(card, &rcvmsg); | 75 | rcvpkt(card, &rcvmsg); |
76 | continue; | 76 | continue; |
77 | 77 | ||
@@ -80,49 +80,49 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) | |||
80 | /* | 80 | /* |
81 | * Handle a write acknoledgement | 81 | * Handle a write acknoledgement |
82 | */ | 82 | */ |
83 | if(IS_CE_MESSAGE(rcvmsg, Lnk, 1, Write)) { | 83 | if (IS_CE_MESSAGE(rcvmsg, Lnk, 1, Write)) { |
84 | pr_debug("%s: Packet Send ACK on channel %d\n", | 84 | pr_debug("%s: Packet Send ACK on channel %d\n", |
85 | sc_adapter[card]->devicename, | 85 | sc_adapter[card]->devicename, |
86 | rcvmsg.phy_link_no); | 86 | rcvmsg.phy_link_no); |
87 | sc_adapter[card]->channel[rcvmsg.phy_link_no-1].free_sendbufs++; | 87 | sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].free_sendbufs++; |
88 | continue; | 88 | continue; |
89 | } | 89 | } |
90 | 90 | ||
91 | /* | 91 | /* |
92 | * Handle a connection message | 92 | * Handle a connection message |
93 | */ | 93 | */ |
94 | if (IS_CE_MESSAGE(rcvmsg, Phy, 1, Connect)) | 94 | if (IS_CE_MESSAGE(rcvmsg, Phy, 1, Connect)) |
95 | { | 95 | { |
96 | unsigned int callid; | 96 | unsigned int callid; |
97 | setup_parm setup; | 97 | setup_parm setup; |
98 | pr_debug("%s: Connect message: line %d: status %d: cause 0x%x\n", | 98 | pr_debug("%s: Connect message: line %d: status %d: cause 0x%x\n", |
99 | sc_adapter[card]->devicename, | 99 | sc_adapter[card]->devicename, |
100 | rcvmsg.phy_link_no, | 100 | rcvmsg.phy_link_no, |
101 | rcvmsg.rsp_status, | 101 | rcvmsg.rsp_status, |
102 | rcvmsg.msg_data.byte_array[2]); | 102 | rcvmsg.msg_data.byte_array[2]); |
103 | 103 | ||
104 | memcpy(&callid,rcvmsg.msg_data.byte_array,sizeof(int)); | 104 | memcpy(&callid, rcvmsg.msg_data.byte_array, sizeof(int)); |
105 | if(callid>=0x8000 && callid<=0xFFFF) | 105 | if (callid >= 0x8000 && callid <= 0xFFFF) |
106 | { | 106 | { |
107 | pr_debug("%s: Got Dial-Out Rsp\n", | 107 | pr_debug("%s: Got Dial-Out Rsp\n", |
108 | sc_adapter[card]->devicename); | 108 | sc_adapter[card]->devicename); |
109 | indicate_status(card, ISDN_STAT_DCONN, | 109 | indicate_status(card, ISDN_STAT_DCONN, |
110 | (unsigned long)rcvmsg.phy_link_no-1,NULL); | 110 | (unsigned long)rcvmsg.phy_link_no - 1, NULL); |
111 | 111 | ||
112 | } | 112 | } |
113 | else if(callid>=0x0000 && callid<=0x7FFF) | 113 | else if (callid >= 0x0000 && callid <= 0x7FFF) |
114 | { | 114 | { |
115 | int len; | 115 | int len; |
116 | 116 | ||
117 | pr_debug("%s: Got Incoming Call\n", | 117 | pr_debug("%s: Got Incoming Call\n", |
118 | sc_adapter[card]->devicename); | 118 | sc_adapter[card]->devicename); |
119 | len = strlcpy(setup.phone, &(rcvmsg.msg_data.byte_array[4]), | 119 | len = strlcpy(setup.phone, &(rcvmsg.msg_data.byte_array[4]), |
120 | sizeof(setup.phone)); | 120 | sizeof(setup.phone)); |
121 | if (len >= sizeof(setup.phone)) | 121 | if (len >= sizeof(setup.phone)) |
122 | continue; | 122 | continue; |
123 | len = strlcpy(setup.eazmsn, | 123 | len = strlcpy(setup.eazmsn, |
124 | sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].dn, | 124 | sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].dn, |
125 | sizeof(setup.eazmsn)); | 125 | sizeof(setup.eazmsn)); |
126 | if (len >= sizeof(setup.eazmsn)) | 126 | if (len >= sizeof(setup.eazmsn)) |
127 | continue; | 127 | continue; |
128 | setup.si1 = 7; | 128 | setup.si1 = 7; |
@@ -130,8 +130,8 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) | |||
130 | setup.plan = 0; | 130 | setup.plan = 0; |
131 | setup.screen = 0; | 131 | setup.screen = 0; |
132 | 132 | ||
133 | indicate_status(card, ISDN_STAT_ICALL,(unsigned long)rcvmsg.phy_link_no-1,(char *)&setup); | 133 | indicate_status(card, ISDN_STAT_ICALL, (unsigned long)rcvmsg.phy_link_no - 1, (char *)&setup); |
134 | indicate_status(card, ISDN_STAT_DCONN,(unsigned long)rcvmsg.phy_link_no-1,NULL); | 134 | indicate_status(card, ISDN_STAT_DCONN, (unsigned long)rcvmsg.phy_link_no - 1, NULL); |
135 | } | 135 | } |
136 | continue; | 136 | continue; |
137 | } | 137 | } |
@@ -139,16 +139,16 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) | |||
139 | /* | 139 | /* |
140 | * Handle a disconnection message | 140 | * Handle a disconnection message |
141 | */ | 141 | */ |
142 | if (IS_CE_MESSAGE(rcvmsg, Phy, 1, Disconnect)) | 142 | if (IS_CE_MESSAGE(rcvmsg, Phy, 1, Disconnect)) |
143 | { | 143 | { |
144 | pr_debug("%s: disconnect message: line %d: status %d: cause 0x%x\n", | 144 | pr_debug("%s: disconnect message: line %d: status %d: cause 0x%x\n", |
145 | sc_adapter[card]->devicename, | 145 | sc_adapter[card]->devicename, |
146 | rcvmsg.phy_link_no, | 146 | rcvmsg.phy_link_no, |
147 | rcvmsg.rsp_status, | 147 | rcvmsg.rsp_status, |
148 | rcvmsg.msg_data.byte_array[2]); | 148 | rcvmsg.msg_data.byte_array[2]); |
149 | 149 | ||
150 | indicate_status(card, ISDN_STAT_BHUP,(unsigned long)rcvmsg.phy_link_no-1,NULL); | 150 | indicate_status(card, ISDN_STAT_BHUP, (unsigned long)rcvmsg.phy_link_no - 1, NULL); |
151 | indicate_status(card, ISDN_STAT_DHUP,(unsigned long)rcvmsg.phy_link_no-1,NULL); | 151 | indicate_status(card, ISDN_STAT_DHUP, (unsigned long)rcvmsg.phy_link_no - 1, NULL); |
152 | continue; | 152 | continue; |
153 | 153 | ||
154 | } | 154 | } |
@@ -158,10 +158,10 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) | |||
158 | */ | 158 | */ |
159 | if (IS_CM_MESSAGE(rcvmsg, 5, 0, MiscEngineUp)) { | 159 | if (IS_CM_MESSAGE(rcvmsg, 5, 0, MiscEngineUp)) { |
160 | pr_debug("%s: Received EngineUp message\n", | 160 | pr_debug("%s: Received EngineUp message\n", |
161 | sc_adapter[card]->devicename); | 161 | sc_adapter[card]->devicename); |
162 | sc_adapter[card]->EngineUp = 1; | 162 | sc_adapter[card]->EngineUp = 1; |
163 | sendmessage(card, CEPID,ceReqTypeCall,ceReqClass0,ceReqCallGetMyNumber,1,0,NULL); | 163 | sendmessage(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallGetMyNumber, 1, 0, NULL); |
164 | sendmessage(card, CEPID,ceReqTypeCall,ceReqClass0,ceReqCallGetMyNumber,2,0,NULL); | 164 | sendmessage(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallGetMyNumber, 2, 0, NULL); |
165 | init_timer(&sc_adapter[card]->stat_timer); | 165 | init_timer(&sc_adapter[card]->stat_timer); |
166 | sc_adapter[card]->stat_timer.function = check_phystat; | 166 | sc_adapter[card]->stat_timer.function = check_phystat; |
167 | sc_adapter[card]->stat_timer.data = card; | 167 | sc_adapter[card]->stat_timer.data = card; |
@@ -175,25 +175,25 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) | |||
175 | */ | 175 | */ |
176 | if (IS_CM_MESSAGE(rcvmsg, 2, 0, StartProc)) { | 176 | if (IS_CM_MESSAGE(rcvmsg, 2, 0, StartProc)) { |
177 | pr_debug("%s: StartProc Response Status %d\n", | 177 | pr_debug("%s: StartProc Response Status %d\n", |
178 | sc_adapter[card]->devicename, | 178 | sc_adapter[card]->devicename, |
179 | rcvmsg.rsp_status); | 179 | rcvmsg.rsp_status); |
180 | continue; | 180 | continue; |
181 | } | 181 | } |
182 | 182 | ||
183 | /* | 183 | /* |
184 | * Handle a GetMyNumber Rsp | 184 | * Handle a GetMyNumber Rsp |
185 | */ | 185 | */ |
186 | if (IS_CE_MESSAGE(rcvmsg,Call,0,GetMyNumber)){ | 186 | if (IS_CE_MESSAGE(rcvmsg, Call, 0, GetMyNumber)) { |
187 | strlcpy(sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].dn, | 187 | strlcpy(sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].dn, |
188 | rcvmsg.msg_data.byte_array, | 188 | rcvmsg.msg_data.byte_array, |
189 | sizeof(rcvmsg.msg_data.byte_array)); | 189 | sizeof(rcvmsg.msg_data.byte_array)); |
190 | continue; | 190 | continue; |
191 | } | 191 | } |
192 | 192 | ||
193 | /* | 193 | /* |
194 | * PhyStatus response | 194 | * PhyStatus response |
195 | */ | 195 | */ |
196 | if(IS_CE_MESSAGE(rcvmsg, Phy, 2, Status)) { | 196 | if (IS_CE_MESSAGE(rcvmsg, Phy, 2, Status)) { |
197 | unsigned int b1stat, b2stat; | 197 | unsigned int b1stat, b2stat; |
198 | 198 | ||
199 | /* | 199 | /* |
@@ -204,30 +204,30 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) | |||
204 | 204 | ||
205 | sc_adapter[card]->nphystat = (b2stat >> 8) | b1stat; /* endian?? */ | 205 | sc_adapter[card]->nphystat = (b2stat >> 8) | b1stat; /* endian?? */ |
206 | pr_debug("%s: PhyStat is 0x%2x\n", | 206 | pr_debug("%s: PhyStat is 0x%2x\n", |
207 | sc_adapter[card]->devicename, | 207 | sc_adapter[card]->devicename, |
208 | sc_adapter[card]->nphystat); | 208 | sc_adapter[card]->nphystat); |
209 | continue; | 209 | continue; |
210 | } | 210 | } |
211 | 211 | ||
212 | 212 | ||
213 | /* | 213 | /* |
214 | * Handle a GetFramFormat | 214 | * Handle a GetFramFormat |
215 | */ | 215 | */ |
216 | if(IS_CE_MESSAGE(rcvmsg, Call, 0, GetFrameFormat)) { | 216 | if (IS_CE_MESSAGE(rcvmsg, Call, 0, GetFrameFormat)) { |
217 | if(rcvmsg.msg_data.byte_array[0] != HDLC_PROTO) { | 217 | if (rcvmsg.msg_data.byte_array[0] != HDLC_PROTO) { |
218 | unsigned int proto = HDLC_PROTO; | 218 | unsigned int proto = HDLC_PROTO; |
219 | /* | 219 | /* |
220 | * Set board format to HDLC if it wasn't already | 220 | * Set board format to HDLC if it wasn't already |
221 | */ | 221 | */ |
222 | pr_debug("%s: current frame format: 0x%x, will change to HDLC\n", | 222 | pr_debug("%s: current frame format: 0x%x, will change to HDLC\n", |
223 | sc_adapter[card]->devicename, | 223 | sc_adapter[card]->devicename, |
224 | rcvmsg.msg_data.byte_array[0]); | 224 | rcvmsg.msg_data.byte_array[0]); |
225 | sendmessage(card, CEPID, ceReqTypeCall, | 225 | sendmessage(card, CEPID, ceReqTypeCall, |
226 | ceReqClass0, | 226 | ceReqClass0, |
227 | ceReqCallSetFrameFormat, | 227 | ceReqCallSetFrameFormat, |
228 | (unsigned char) channel +1, | 228 | (unsigned char)channel + 1, |
229 | 1,&proto); | 229 | 1, &proto); |
230 | } | 230 | } |
231 | continue; | 231 | continue; |
232 | } | 232 | } |
233 | 233 | ||
@@ -235,13 +235,13 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) | |||
235 | * Hmm... | 235 | * Hmm... |
236 | */ | 236 | */ |
237 | pr_debug("%s: Received unhandled message (%d,%d,%d) link %d\n", | 237 | pr_debug("%s: Received unhandled message (%d,%d,%d) link %d\n", |
238 | sc_adapter[card]->devicename, | 238 | sc_adapter[card]->devicename, |
239 | rcvmsg.type, rcvmsg.class, rcvmsg.code, | 239 | rcvmsg.type, rcvmsg.class, rcvmsg.code, |
240 | rcvmsg.phy_link_no); | 240 | rcvmsg.phy_link_no); |
241 | 241 | ||
242 | } /* while */ | 242 | } /* while */ |
243 | 243 | ||
244 | pr_debug("%s: Exiting Interrupt Handler\n", | 244 | pr_debug("%s: Exiting Interrupt Handler\n", |
245 | sc_adapter[card]->devicename); | 245 | sc_adapter[card]->devicename); |
246 | return IRQ_HANDLED; | 246 | return IRQ_HANDLED; |
247 | } | 247 | } |
diff --git a/drivers/isdn/sc/ioctl.c b/drivers/isdn/sc/ioctl.c index 4cfdbe08ffd1..e63983aa1d27 100644 --- a/drivers/isdn/sc/ioctl.c +++ b/drivers/isdn/sc/ioctl.c | |||
@@ -30,11 +30,11 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
30 | if (!rcvmsg) | 30 | if (!rcvmsg) |
31 | return -ENOMEM; | 31 | return -ENOMEM; |
32 | 32 | ||
33 | switch(data->command) { | 33 | switch (data->command) { |
34 | case SCIOCRESET: /* Perform a hard reset of the adapter */ | 34 | case SCIOCRESET: /* Perform a hard reset of the adapter */ |
35 | { | 35 | { |
36 | pr_debug("%s: SCIOCRESET: ioctl received\n", | 36 | pr_debug("%s: SCIOCRESET: ioctl received\n", |
37 | sc_adapter[card]->devicename); | 37 | sc_adapter[card]->devicename); |
38 | sc_adapter[card]->StartOnReset = 0; | 38 | sc_adapter[card]->StartOnReset = 0; |
39 | kfree(rcvmsg); | 39 | kfree(rcvmsg); |
40 | return reset(card); | 40 | return reset(card); |
@@ -50,10 +50,10 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
50 | return -ENOMEM; | 50 | return -ENOMEM; |
51 | } | 51 | } |
52 | pr_debug("%s: SCIOLOAD: ioctl received\n", | 52 | pr_debug("%s: SCIOLOAD: ioctl received\n", |
53 | sc_adapter[card]->devicename); | 53 | sc_adapter[card]->devicename); |
54 | if(sc_adapter[card]->EngineUp) { | 54 | if (sc_adapter[card]->EngineUp) { |
55 | pr_debug("%s: SCIOCLOAD: command failed, LoadProc while engine running.\n", | 55 | pr_debug("%s: SCIOCLOAD: command failed, LoadProc while engine running.\n", |
56 | sc_adapter[card]->devicename); | 56 | sc_adapter[card]->devicename); |
57 | kfree(rcvmsg); | 57 | kfree(rcvmsg); |
58 | kfree(srec); | 58 | kfree(srec); |
59 | return -1; | 59 | return -1; |
@@ -69,18 +69,18 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
69 | } | 69 | } |
70 | 70 | ||
71 | status = send_and_receive(card, CMPID, cmReqType2, cmReqClass0, cmReqLoadProc, | 71 | status = send_and_receive(card, CMPID, cmReqType2, cmReqClass0, cmReqLoadProc, |
72 | 0, SCIOC_SRECSIZE, srec, rcvmsg, SAR_TIMEOUT); | 72 | 0, SCIOC_SRECSIZE, srec, rcvmsg, SAR_TIMEOUT); |
73 | kfree(rcvmsg); | 73 | kfree(rcvmsg); |
74 | kfree(srec); | 74 | kfree(srec); |
75 | 75 | ||
76 | if(status) { | 76 | if (status) { |
77 | pr_debug("%s: SCIOCLOAD: command failed, status = %d\n", | 77 | pr_debug("%s: SCIOCLOAD: command failed, status = %d\n", |
78 | sc_adapter[card]->devicename, status); | 78 | sc_adapter[card]->devicename, status); |
79 | return -1; | 79 | return -1; |
80 | } | 80 | } |
81 | else { | 81 | else { |
82 | pr_debug("%s: SCIOCLOAD: command successful\n", | 82 | pr_debug("%s: SCIOCLOAD: command successful\n", |
83 | sc_adapter[card]->devicename); | 83 | sc_adapter[card]->devicename); |
84 | return 0; | 84 | return 0; |
85 | } | 85 | } |
86 | } | 86 | } |
@@ -89,10 +89,10 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
89 | { | 89 | { |
90 | kfree(rcvmsg); | 90 | kfree(rcvmsg); |
91 | pr_debug("%s: SCIOSTART: ioctl received\n", | 91 | pr_debug("%s: SCIOSTART: ioctl received\n", |
92 | sc_adapter[card]->devicename); | 92 | sc_adapter[card]->devicename); |
93 | if(sc_adapter[card]->EngineUp) { | 93 | if (sc_adapter[card]->EngineUp) { |
94 | pr_debug("%s: SCIOCSTART: command failed, engine already running.\n", | 94 | pr_debug("%s: SCIOCSTART: command failed, engine already running.\n", |
95 | sc_adapter[card]->devicename); | 95 | sc_adapter[card]->devicename); |
96 | return -1; | 96 | return -1; |
97 | } | 97 | } |
98 | 98 | ||
@@ -104,7 +104,7 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
104 | case SCIOCSETSWITCH: | 104 | case SCIOCSETSWITCH: |
105 | { | 105 | { |
106 | pr_debug("%s: SCIOSETSWITCH: ioctl received\n", | 106 | pr_debug("%s: SCIOSETSWITCH: ioctl received\n", |
107 | sc_adapter[card]->devicename); | 107 | sc_adapter[card]->devicename); |
108 | 108 | ||
109 | /* | 109 | /* |
110 | * Get the switch type from user space | 110 | * Get the switch type from user space |
@@ -115,41 +115,41 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
115 | } | 115 | } |
116 | 116 | ||
117 | pr_debug("%s: SCIOCSETSWITCH: setting switch type to %d\n", | 117 | pr_debug("%s: SCIOCSETSWITCH: setting switch type to %d\n", |
118 | sc_adapter[card]->devicename, | 118 | sc_adapter[card]->devicename, |
119 | switchtype); | 119 | switchtype); |
120 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallSetSwitchType, | 120 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallSetSwitchType, |
121 | 0, sizeof(char),&switchtype, rcvmsg, SAR_TIMEOUT); | 121 | 0, sizeof(char), &switchtype, rcvmsg, SAR_TIMEOUT); |
122 | if(!status && !(rcvmsg->rsp_status)) { | 122 | if (!status && !(rcvmsg->rsp_status)) { |
123 | pr_debug("%s: SCIOCSETSWITCH: command successful\n", | 123 | pr_debug("%s: SCIOCSETSWITCH: command successful\n", |
124 | sc_adapter[card]->devicename); | 124 | sc_adapter[card]->devicename); |
125 | kfree(rcvmsg); | 125 | kfree(rcvmsg); |
126 | return 0; | 126 | return 0; |
127 | } | 127 | } |
128 | else { | 128 | else { |
129 | pr_debug("%s: SCIOCSETSWITCH: command failed (status = %d)\n", | 129 | pr_debug("%s: SCIOCSETSWITCH: command failed (status = %d)\n", |
130 | sc_adapter[card]->devicename, status); | 130 | sc_adapter[card]->devicename, status); |
131 | kfree(rcvmsg); | 131 | kfree(rcvmsg); |
132 | return status; | 132 | return status; |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | ||
136 | case SCIOCGETSWITCH: | 136 | case SCIOCGETSWITCH: |
137 | { | 137 | { |
138 | pr_debug("%s: SCIOGETSWITCH: ioctl received\n", | 138 | pr_debug("%s: SCIOGETSWITCH: ioctl received\n", |
139 | sc_adapter[card]->devicename); | 139 | sc_adapter[card]->devicename); |
140 | 140 | ||
141 | /* | 141 | /* |
142 | * Get the switch type from the board | 142 | * Get the switch type from the board |
143 | */ | 143 | */ |
144 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, | 144 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, |
145 | ceReqCallGetSwitchType, 0, 0, NULL, rcvmsg, SAR_TIMEOUT); | 145 | ceReqCallGetSwitchType, 0, 0, NULL, rcvmsg, SAR_TIMEOUT); |
146 | if (!status && !(rcvmsg->rsp_status)) { | 146 | if (!status && !(rcvmsg->rsp_status)) { |
147 | pr_debug("%s: SCIOCGETSWITCH: command successful\n", | 147 | pr_debug("%s: SCIOCGETSWITCH: command successful\n", |
148 | sc_adapter[card]->devicename); | 148 | sc_adapter[card]->devicename); |
149 | } | 149 | } |
150 | else { | 150 | else { |
151 | pr_debug("%s: SCIOCGETSWITCH: command failed (status = %d)\n", | 151 | pr_debug("%s: SCIOCGETSWITCH: command failed (status = %d)\n", |
152 | sc_adapter[card]->devicename, status); | 152 | sc_adapter[card]->devicename, status); |
153 | kfree(rcvmsg); | 153 | kfree(rcvmsg); |
154 | return status; | 154 | return status; |
155 | } | 155 | } |
@@ -172,7 +172,7 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
172 | case SCIOCGETSPID: | 172 | case SCIOCGETSPID: |
173 | { | 173 | { |
174 | pr_debug("%s: SCIOGETSPID: ioctl received\n", | 174 | pr_debug("%s: SCIOGETSPID: ioctl received\n", |
175 | sc_adapter[card]->devicename); | 175 | sc_adapter[card]->devicename); |
176 | 176 | ||
177 | spid = kzalloc(SCIOC_SPIDSIZE, GFP_KERNEL); | 177 | spid = kzalloc(SCIOC_SPIDSIZE, GFP_KERNEL); |
178 | if (!spid) { | 178 | if (!spid) { |
@@ -183,13 +183,13 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
183 | * Get the spid from the board | 183 | * Get the spid from the board |
184 | */ | 184 | */ |
185 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallGetSPID, | 185 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallGetSPID, |
186 | data->channel, 0, NULL, rcvmsg, SAR_TIMEOUT); | 186 | data->channel, 0, NULL, rcvmsg, SAR_TIMEOUT); |
187 | if (!status) { | 187 | if (!status) { |
188 | pr_debug("%s: SCIOCGETSPID: command successful\n", | 188 | pr_debug("%s: SCIOCGETSPID: command successful\n", |
189 | sc_adapter[card]->devicename); | 189 | sc_adapter[card]->devicename); |
190 | } else { | 190 | } else { |
191 | pr_debug("%s: SCIOCGETSPID: command failed (status = %d)\n", | 191 | pr_debug("%s: SCIOCGETSPID: command failed (status = %d)\n", |
192 | sc_adapter[card]->devicename, status); | 192 | sc_adapter[card]->devicename, status); |
193 | kfree(spid); | 193 | kfree(spid); |
194 | kfree(rcvmsg); | 194 | kfree(rcvmsg); |
195 | return status; | 195 | return status; |
@@ -208,12 +208,12 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
208 | kfree(spid); | 208 | kfree(spid); |
209 | kfree(rcvmsg); | 209 | kfree(rcvmsg); |
210 | return 0; | 210 | return 0; |
211 | } | 211 | } |
212 | 212 | ||
213 | case SCIOCSETSPID: | 213 | case SCIOCSETSPID: |
214 | { | 214 | { |
215 | pr_debug("%s: DCBIOSETSPID: ioctl received\n", | 215 | pr_debug("%s: DCBIOSETSPID: ioctl received\n", |
216 | sc_adapter[card]->devicename); | 216 | sc_adapter[card]->devicename); |
217 | 217 | ||
218 | /* | 218 | /* |
219 | * Get the spid from user space | 219 | * Get the spid from user space |
@@ -224,21 +224,21 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
224 | return PTR_ERR(spid); | 224 | return PTR_ERR(spid); |
225 | } | 225 | } |
226 | 226 | ||
227 | pr_debug("%s: SCIOCSETSPID: setting channel %d spid to %s\n", | 227 | pr_debug("%s: SCIOCSETSPID: setting channel %d spid to %s\n", |
228 | sc_adapter[card]->devicename, data->channel, spid); | 228 | sc_adapter[card]->devicename, data->channel, spid); |
229 | status = send_and_receive(card, CEPID, ceReqTypeCall, | 229 | status = send_and_receive(card, CEPID, ceReqTypeCall, |
230 | ceReqClass0, ceReqCallSetSPID, data->channel, | 230 | ceReqClass0, ceReqCallSetSPID, data->channel, |
231 | strlen(spid), spid, rcvmsg, SAR_TIMEOUT); | 231 | strlen(spid), spid, rcvmsg, SAR_TIMEOUT); |
232 | if(!status && !(rcvmsg->rsp_status)) { | 232 | if (!status && !(rcvmsg->rsp_status)) { |
233 | pr_debug("%s: SCIOCSETSPID: command successful\n", | 233 | pr_debug("%s: SCIOCSETSPID: command successful\n", |
234 | sc_adapter[card]->devicename); | 234 | sc_adapter[card]->devicename); |
235 | kfree(rcvmsg); | 235 | kfree(rcvmsg); |
236 | kfree(spid); | 236 | kfree(spid); |
237 | return 0; | 237 | return 0; |
238 | } | 238 | } |
239 | else { | 239 | else { |
240 | pr_debug("%s: SCIOCSETSPID: command failed (status = %d)\n", | 240 | pr_debug("%s: SCIOCSETSPID: command failed (status = %d)\n", |
241 | sc_adapter[card]->devicename, status); | 241 | sc_adapter[card]->devicename, status); |
242 | kfree(rcvmsg); | 242 | kfree(rcvmsg); |
243 | kfree(spid); | 243 | kfree(spid); |
244 | return status; | 244 | return status; |
@@ -248,20 +248,20 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
248 | case SCIOCGETDN: | 248 | case SCIOCGETDN: |
249 | { | 249 | { |
250 | pr_debug("%s: SCIOGETDN: ioctl received\n", | 250 | pr_debug("%s: SCIOGETDN: ioctl received\n", |
251 | sc_adapter[card]->devicename); | 251 | sc_adapter[card]->devicename); |
252 | 252 | ||
253 | /* | 253 | /* |
254 | * Get the dn from the board | 254 | * Get the dn from the board |
255 | */ | 255 | */ |
256 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallGetMyNumber, | 256 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallGetMyNumber, |
257 | data->channel, 0, NULL, rcvmsg, SAR_TIMEOUT); | 257 | data->channel, 0, NULL, rcvmsg, SAR_TIMEOUT); |
258 | if (!status) { | 258 | if (!status) { |
259 | pr_debug("%s: SCIOCGETDN: command successful\n", | 259 | pr_debug("%s: SCIOCGETDN: command successful\n", |
260 | sc_adapter[card]->devicename); | 260 | sc_adapter[card]->devicename); |
261 | } | 261 | } |
262 | else { | 262 | else { |
263 | pr_debug("%s: SCIOCGETDN: command failed (status = %d)\n", | 263 | pr_debug("%s: SCIOCGETDN: command failed (status = %d)\n", |
264 | sc_adapter[card]->devicename, status); | 264 | sc_adapter[card]->devicename, status); |
265 | kfree(rcvmsg); | 265 | kfree(rcvmsg); |
266 | return status; | 266 | return status; |
267 | } | 267 | } |
@@ -283,12 +283,12 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
283 | } | 283 | } |
284 | kfree(dn); | 284 | kfree(dn); |
285 | return 0; | 285 | return 0; |
286 | } | 286 | } |
287 | 287 | ||
288 | case SCIOCSETDN: | 288 | case SCIOCSETDN: |
289 | { | 289 | { |
290 | pr_debug("%s: SCIOSETDN: ioctl received\n", | 290 | pr_debug("%s: SCIOSETDN: ioctl received\n", |
291 | sc_adapter[card]->devicename); | 291 | sc_adapter[card]->devicename); |
292 | 292 | ||
293 | /* | 293 | /* |
294 | * Get the spid from user space | 294 | * Get the spid from user space |
@@ -299,21 +299,21 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
299 | return PTR_ERR(dn); | 299 | return PTR_ERR(dn); |
300 | } | 300 | } |
301 | 301 | ||
302 | pr_debug("%s: SCIOCSETDN: setting channel %d dn to %s\n", | 302 | pr_debug("%s: SCIOCSETDN: setting channel %d dn to %s\n", |
303 | sc_adapter[card]->devicename, data->channel, dn); | 303 | sc_adapter[card]->devicename, data->channel, dn); |
304 | status = send_and_receive(card, CEPID, ceReqTypeCall, | 304 | status = send_and_receive(card, CEPID, ceReqTypeCall, |
305 | ceReqClass0, ceReqCallSetMyNumber, data->channel, | 305 | ceReqClass0, ceReqCallSetMyNumber, data->channel, |
306 | strlen(dn),dn,rcvmsg, SAR_TIMEOUT); | 306 | strlen(dn), dn, rcvmsg, SAR_TIMEOUT); |
307 | if(!status && !(rcvmsg->rsp_status)) { | 307 | if (!status && !(rcvmsg->rsp_status)) { |
308 | pr_debug("%s: SCIOCSETDN: command successful\n", | 308 | pr_debug("%s: SCIOCSETDN: command successful\n", |
309 | sc_adapter[card]->devicename); | 309 | sc_adapter[card]->devicename); |
310 | kfree(rcvmsg); | 310 | kfree(rcvmsg); |
311 | kfree(dn); | 311 | kfree(dn); |
312 | return 0; | 312 | return 0; |
313 | } | 313 | } |
314 | else { | 314 | else { |
315 | pr_debug("%s: SCIOCSETDN: command failed (status = %d)\n", | 315 | pr_debug("%s: SCIOCSETDN: command failed (status = %d)\n", |
316 | sc_adapter[card]->devicename, status); | 316 | sc_adapter[card]->devicename, status); |
317 | kfree(rcvmsg); | 317 | kfree(rcvmsg); |
318 | kfree(dn); | 318 | kfree(dn); |
319 | return status; | 319 | return status; |
@@ -323,11 +323,11 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
323 | case SCIOCTRACE: | 323 | case SCIOCTRACE: |
324 | 324 | ||
325 | pr_debug("%s: SCIOTRACE: ioctl received\n", | 325 | pr_debug("%s: SCIOTRACE: ioctl received\n", |
326 | sc_adapter[card]->devicename); | 326 | sc_adapter[card]->devicename); |
327 | /* sc_adapter[card]->trace = !sc_adapter[card]->trace; | 327 | /* sc_adapter[card]->trace = !sc_adapter[card]->trace; |
328 | pr_debug("%s: SCIOCTRACE: tracing turned %s\n", | 328 | pr_debug("%s: SCIOCTRACE: tracing turned %s\n", |
329 | sc_adapter[card]->devicename, | 329 | sc_adapter[card]->devicename, |
330 | sc_adapter[card]->trace ? "ON" : "OFF"); */ | 330 | sc_adapter[card]->trace ? "ON" : "OFF"); */ |
331 | break; | 331 | break; |
332 | 332 | ||
333 | case SCIOCSTAT: | 333 | case SCIOCSTAT: |
@@ -335,7 +335,7 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
335 | boardInfo *bi; | 335 | boardInfo *bi; |
336 | 336 | ||
337 | pr_debug("%s: SCIOSTAT: ioctl received\n", | 337 | pr_debug("%s: SCIOSTAT: ioctl received\n", |
338 | sc_adapter[card]->devicename); | 338 | sc_adapter[card]->devicename); |
339 | 339 | ||
340 | bi = kzalloc(sizeof(boardInfo), GFP_KERNEL); | 340 | bi = kzalloc(sizeof(boardInfo), GFP_KERNEL); |
341 | if (!bi) { | 341 | if (!bi) { |
@@ -358,20 +358,20 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
358 | case SCIOCGETSPEED: | 358 | case SCIOCGETSPEED: |
359 | { | 359 | { |
360 | pr_debug("%s: SCIOGETSPEED: ioctl received\n", | 360 | pr_debug("%s: SCIOGETSPEED: ioctl received\n", |
361 | sc_adapter[card]->devicename); | 361 | sc_adapter[card]->devicename); |
362 | 362 | ||
363 | /* | 363 | /* |
364 | * Get the speed from the board | 364 | * Get the speed from the board |
365 | */ | 365 | */ |
366 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, | 366 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, |
367 | ceReqCallGetCallType, data->channel, 0, NULL, rcvmsg, SAR_TIMEOUT); | 367 | ceReqCallGetCallType, data->channel, 0, NULL, rcvmsg, SAR_TIMEOUT); |
368 | if (!status && !(rcvmsg->rsp_status)) { | 368 | if (!status && !(rcvmsg->rsp_status)) { |
369 | pr_debug("%s: SCIOCGETSPEED: command successful\n", | 369 | pr_debug("%s: SCIOCGETSPEED: command successful\n", |
370 | sc_adapter[card]->devicename); | 370 | sc_adapter[card]->devicename); |
371 | } | 371 | } |
372 | else { | 372 | else { |
373 | pr_debug("%s: SCIOCGETSPEED: command failed (status = %d)\n", | 373 | pr_debug("%s: SCIOCGETSPEED: command failed (status = %d)\n", |
374 | sc_adapter[card]->devicename, status); | 374 | sc_adapter[card]->devicename, status); |
375 | kfree(rcvmsg); | 375 | kfree(rcvmsg); |
376 | return status; | 376 | return status; |
377 | } | 377 | } |
@@ -392,12 +392,12 @@ int sc_ioctl(int card, scs_ioctl *data) | |||
392 | 392 | ||
393 | case SCIOCSETSPEED: | 393 | case SCIOCSETSPEED: |
394 | pr_debug("%s: SCIOCSETSPEED: ioctl received\n", | 394 | pr_debug("%s: SCIOCSETSPEED: ioctl received\n", |
395 | sc_adapter[card]->devicename); | 395 | sc_adapter[card]->devicename); |
396 | break; | 396 | break; |
397 | 397 | ||
398 | case SCIOCLOOPTST: | 398 | case SCIOCLOOPTST: |
399 | pr_debug("%s: SCIOCLOOPTST: ioctl received\n", | 399 | pr_debug("%s: SCIOCLOOPTST: ioctl received\n", |
400 | sc_adapter[card]->devicename); | 400 | sc_adapter[card]->devicename); |
401 | break; | 401 | break; |
402 | 402 | ||
403 | default: | 403 | default: |
@@ -432,32 +432,32 @@ static int GetStatus(int card, boardInfo *bi) | |||
432 | * Get the current PhyStats and LnkStats | 432 | * Get the current PhyStats and LnkStats |
433 | */ | 433 | */ |
434 | status = send_and_receive(card, CEPID, ceReqTypePhy, ceReqClass2, | 434 | status = send_and_receive(card, CEPID, ceReqTypePhy, ceReqClass2, |
435 | ceReqPhyStatus, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); | 435 | ceReqPhyStatus, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); |
436 | if(!status) { | 436 | if (!status) { |
437 | if(sc_adapter[card]->model < PRI_BOARD) { | 437 | if (sc_adapter[card]->model < PRI_BOARD) { |
438 | bi->l1_status = rcvmsg.msg_data.byte_array[2]; | 438 | bi->l1_status = rcvmsg.msg_data.byte_array[2]; |
439 | for(i = 0 ; i < BRI_CHANNELS ; i++) | 439 | for (i = 0; i < BRI_CHANNELS; i++) |
440 | bi->status.bristats[i].phy_stat = | 440 | bi->status.bristats[i].phy_stat = |
441 | rcvmsg.msg_data.byte_array[i]; | 441 | rcvmsg.msg_data.byte_array[i]; |
442 | } | 442 | } |
443 | else { | 443 | else { |
444 | bi->l1_status = rcvmsg.msg_data.byte_array[0]; | 444 | bi->l1_status = rcvmsg.msg_data.byte_array[0]; |
445 | bi->l2_status = rcvmsg.msg_data.byte_array[1]; | 445 | bi->l2_status = rcvmsg.msg_data.byte_array[1]; |
446 | for(i = 0 ; i < PRI_CHANNELS ; i++) | 446 | for (i = 0; i < PRI_CHANNELS; i++) |
447 | bi->status.pristats[i].phy_stat = | 447 | bi->status.pristats[i].phy_stat = |
448 | rcvmsg.msg_data.byte_array[i+2]; | 448 | rcvmsg.msg_data.byte_array[i + 2]; |
449 | } | 449 | } |
450 | } | 450 | } |
451 | 451 | ||
452 | /* | 452 | /* |
453 | * Get the call types for each channel | 453 | * Get the call types for each channel |
454 | */ | 454 | */ |
455 | for (i = 0 ; i < sc_adapter[card]->nChannels ; i++) { | 455 | for (i = 0; i < sc_adapter[card]->nChannels; i++) { |
456 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, | 456 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, |
457 | ceReqCallGetCallType, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); | 457 | ceReqCallGetCallType, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); |
458 | if(!status) { | 458 | if (!status) { |
459 | if (sc_adapter[card]->model == PRI_BOARD) { | 459 | if (sc_adapter[card]->model == PRI_BOARD) { |
460 | bi->status.pristats[i].call_type = | 460 | bi->status.pristats[i].call_type = |
461 | rcvmsg.msg_data.byte_array[0]; | 461 | rcvmsg.msg_data.byte_array[0]; |
462 | } | 462 | } |
463 | else { | 463 | else { |
@@ -466,7 +466,7 @@ static int GetStatus(int card, boardInfo *bi) | |||
466 | } | 466 | } |
467 | } | 467 | } |
468 | } | 468 | } |
469 | 469 | ||
470 | /* | 470 | /* |
471 | * If PRI, get the call states and service states for each channel | 471 | * If PRI, get the call states and service states for each channel |
472 | */ | 472 | */ |
@@ -475,10 +475,10 @@ static int GetStatus(int card, boardInfo *bi) | |||
475 | * Get the call states | 475 | * Get the call states |
476 | */ | 476 | */ |
477 | status = send_and_receive(card, CEPID, ceReqTypeStat, ceReqClass2, | 477 | status = send_and_receive(card, CEPID, ceReqTypeStat, ceReqClass2, |
478 | ceReqPhyChCallState, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); | 478 | ceReqPhyChCallState, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); |
479 | if(!status) { | 479 | if (!status) { |
480 | for( i = 0 ; i < PRI_CHANNELS ; i++ ) | 480 | for (i = 0; i < PRI_CHANNELS; i++) |
481 | bi->status.pristats[i].call_state = | 481 | bi->status.pristats[i].call_state = |
482 | rcvmsg.msg_data.byte_array[i]; | 482 | rcvmsg.msg_data.byte_array[i]; |
483 | } | 483 | } |
484 | 484 | ||
@@ -486,27 +486,27 @@ static int GetStatus(int card, boardInfo *bi) | |||
486 | * Get the service states | 486 | * Get the service states |
487 | */ | 487 | */ |
488 | status = send_and_receive(card, CEPID, ceReqTypeStat, ceReqClass2, | 488 | status = send_and_receive(card, CEPID, ceReqTypeStat, ceReqClass2, |
489 | ceReqPhyChServState, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); | 489 | ceReqPhyChServState, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); |
490 | if(!status) { | 490 | if (!status) { |
491 | for( i = 0 ; i < PRI_CHANNELS ; i++ ) | 491 | for (i = 0; i < PRI_CHANNELS; i++) |
492 | bi->status.pristats[i].serv_state = | 492 | bi->status.pristats[i].serv_state = |
493 | rcvmsg.msg_data.byte_array[i]; | 493 | rcvmsg.msg_data.byte_array[i]; |
494 | } | 494 | } |
495 | 495 | ||
496 | /* | 496 | /* |
497 | * Get the link stats for the channels | 497 | * Get the link stats for the channels |
498 | */ | 498 | */ |
499 | for (i = 1 ; i <= PRI_CHANNELS ; i++) { | 499 | for (i = 1; i <= PRI_CHANNELS; i++) { |
500 | status = send_and_receive(card, CEPID, ceReqTypeLnk, ceReqClass0, | 500 | status = send_and_receive(card, CEPID, ceReqTypeLnk, ceReqClass0, |
501 | ceReqLnkGetStats, i, 0, NULL, &rcvmsg, SAR_TIMEOUT); | 501 | ceReqLnkGetStats, i, 0, NULL, &rcvmsg, SAR_TIMEOUT); |
502 | if (!status) { | 502 | if (!status) { |
503 | bi->status.pristats[i-1].link_stats.tx_good = | 503 | bi->status.pristats[i - 1].link_stats.tx_good = |
504 | (unsigned long)rcvmsg.msg_data.byte_array[0]; | 504 | (unsigned long)rcvmsg.msg_data.byte_array[0]; |
505 | bi->status.pristats[i-1].link_stats.tx_bad = | 505 | bi->status.pristats[i - 1].link_stats.tx_bad = |
506 | (unsigned long)rcvmsg.msg_data.byte_array[4]; | 506 | (unsigned long)rcvmsg.msg_data.byte_array[4]; |
507 | bi->status.pristats[i-1].link_stats.rx_good = | 507 | bi->status.pristats[i - 1].link_stats.rx_good = |
508 | (unsigned long)rcvmsg.msg_data.byte_array[8]; | 508 | (unsigned long)rcvmsg.msg_data.byte_array[8]; |
509 | bi->status.pristats[i-1].link_stats.rx_bad = | 509 | bi->status.pristats[i - 1].link_stats.rx_bad = |
510 | (unsigned long)rcvmsg.msg_data.byte_array[12]; | 510 | (unsigned long)rcvmsg.msg_data.byte_array[12]; |
511 | } | 511 | } |
512 | } | 512 | } |
@@ -515,7 +515,7 @@ static int GetStatus(int card, boardInfo *bi) | |||
515 | * Link stats for the D channel | 515 | * Link stats for the D channel |
516 | */ | 516 | */ |
517 | status = send_and_receive(card, CEPID, ceReqTypeLnk, ceReqClass0, | 517 | status = send_and_receive(card, CEPID, ceReqTypeLnk, ceReqClass0, |
518 | ceReqLnkGetStats, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); | 518 | ceReqLnkGetStats, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); |
519 | if (!status) { | 519 | if (!status) { |
520 | bi->dch_stats.tx_good = (unsigned long)rcvmsg.msg_data.byte_array[0]; | 520 | bi->dch_stats.tx_good = (unsigned long)rcvmsg.msg_data.byte_array[0]; |
521 | bi->dch_stats.tx_bad = (unsigned long)rcvmsg.msg_data.byte_array[4]; | 521 | bi->dch_stats.tx_bad = (unsigned long)rcvmsg.msg_data.byte_array[4]; |
@@ -534,49 +534,49 @@ static int GetStatus(int card, boardInfo *bi) | |||
534 | * Get the link stats for the channels | 534 | * Get the link stats for the channels |
535 | */ | 535 | */ |
536 | status = send_and_receive(card, CEPID, ceReqTypeLnk, ceReqClass0, | 536 | status = send_and_receive(card, CEPID, ceReqTypeLnk, ceReqClass0, |
537 | ceReqLnkGetStats, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); | 537 | ceReqLnkGetStats, 0, 0, NULL, &rcvmsg, SAR_TIMEOUT); |
538 | if (!status) { | 538 | if (!status) { |
539 | bi->dch_stats.tx_good = (unsigned long)rcvmsg.msg_data.byte_array[0]; | 539 | bi->dch_stats.tx_good = (unsigned long)rcvmsg.msg_data.byte_array[0]; |
540 | bi->dch_stats.tx_bad = (unsigned long)rcvmsg.msg_data.byte_array[4]; | 540 | bi->dch_stats.tx_bad = (unsigned long)rcvmsg.msg_data.byte_array[4]; |
541 | bi->dch_stats.rx_good = (unsigned long)rcvmsg.msg_data.byte_array[8]; | 541 | bi->dch_stats.rx_good = (unsigned long)rcvmsg.msg_data.byte_array[8]; |
542 | bi->dch_stats.rx_bad = (unsigned long)rcvmsg.msg_data.byte_array[12]; | 542 | bi->dch_stats.rx_bad = (unsigned long)rcvmsg.msg_data.byte_array[12]; |
543 | bi->status.bristats[0].link_stats.tx_good = | 543 | bi->status.bristats[0].link_stats.tx_good = |
544 | (unsigned long)rcvmsg.msg_data.byte_array[16]; | 544 | (unsigned long)rcvmsg.msg_data.byte_array[16]; |
545 | bi->status.bristats[0].link_stats.tx_bad = | 545 | bi->status.bristats[0].link_stats.tx_bad = |
546 | (unsigned long)rcvmsg.msg_data.byte_array[20]; | 546 | (unsigned long)rcvmsg.msg_data.byte_array[20]; |
547 | bi->status.bristats[0].link_stats.rx_good = | 547 | bi->status.bristats[0].link_stats.rx_good = |
548 | (unsigned long)rcvmsg.msg_data.byte_array[24]; | 548 | (unsigned long)rcvmsg.msg_data.byte_array[24]; |
549 | bi->status.bristats[0].link_stats.rx_bad = | 549 | bi->status.bristats[0].link_stats.rx_bad = |
550 | (unsigned long)rcvmsg.msg_data.byte_array[28]; | 550 | (unsigned long)rcvmsg.msg_data.byte_array[28]; |
551 | bi->status.bristats[1].link_stats.tx_good = | 551 | bi->status.bristats[1].link_stats.tx_good = |
552 | (unsigned long)rcvmsg.msg_data.byte_array[32]; | 552 | (unsigned long)rcvmsg.msg_data.byte_array[32]; |
553 | bi->status.bristats[1].link_stats.tx_bad = | 553 | bi->status.bristats[1].link_stats.tx_bad = |
554 | (unsigned long)rcvmsg.msg_data.byte_array[36]; | 554 | (unsigned long)rcvmsg.msg_data.byte_array[36]; |
555 | bi->status.bristats[1].link_stats.rx_good = | 555 | bi->status.bristats[1].link_stats.rx_good = |
556 | (unsigned long)rcvmsg.msg_data.byte_array[40]; | 556 | (unsigned long)rcvmsg.msg_data.byte_array[40]; |
557 | bi->status.bristats[1].link_stats.rx_bad = | 557 | bi->status.bristats[1].link_stats.rx_bad = |
558 | (unsigned long)rcvmsg.msg_data.byte_array[44]; | 558 | (unsigned long)rcvmsg.msg_data.byte_array[44]; |
559 | } | 559 | } |
560 | 560 | ||
561 | /* | 561 | /* |
562 | * Get the SPIDs | 562 | * Get the SPIDs |
563 | */ | 563 | */ |
564 | for (i = 0 ; i < BRI_CHANNELS ; i++) { | 564 | for (i = 0; i < BRI_CHANNELS; i++) { |
565 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, | 565 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, |
566 | ceReqCallGetSPID, i+1, 0, NULL, &rcvmsg, SAR_TIMEOUT); | 566 | ceReqCallGetSPID, i + 1, 0, NULL, &rcvmsg, SAR_TIMEOUT); |
567 | if (!status) | 567 | if (!status) |
568 | strcpy(bi->status.bristats[i].spid, rcvmsg.msg_data.byte_array); | 568 | strcpy(bi->status.bristats[i].spid, rcvmsg.msg_data.byte_array); |
569 | } | 569 | } |
570 | 570 | ||
571 | /* | 571 | /* |
572 | * Get the DNs | 572 | * Get the DNs |
573 | */ | 573 | */ |
574 | for (i = 0 ; i < BRI_CHANNELS ; i++) { | 574 | for (i = 0; i < BRI_CHANNELS; i++) { |
575 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, | 575 | status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, |
576 | ceReqCallGetMyNumber, i+1, 0, NULL, &rcvmsg, SAR_TIMEOUT); | 576 | ceReqCallGetMyNumber, i + 1, 0, NULL, &rcvmsg, SAR_TIMEOUT); |
577 | if (!status) | 577 | if (!status) |
578 | strcpy(bi->status.bristats[i].dn, rcvmsg.msg_data.byte_array); | 578 | strcpy(bi->status.bristats[i].dn, rcvmsg.msg_data.byte_array); |
579 | } | 579 | } |
580 | 580 | ||
581 | return 0; | 581 | return 0; |
582 | } | 582 | } |
diff --git a/drivers/isdn/sc/message.c b/drivers/isdn/sc/message.c index 0b4c4f15abdd..9679a1902b32 100644 --- a/drivers/isdn/sc/message.c +++ b/drivers/isdn/sc/message.c | |||
@@ -25,7 +25,7 @@ | |||
25 | /* | 25 | /* |
26 | * receive a message from the board | 26 | * receive a message from the board |
27 | */ | 27 | */ |
28 | int receivemessage(int card, RspMessage *rspmsg) | 28 | int receivemessage(int card, RspMessage *rspmsg) |
29 | { | 29 | { |
30 | DualPortMemory *dpm; | 30 | DualPortMemory *dpm; |
31 | unsigned long flags; | 31 | unsigned long flags; |
@@ -34,9 +34,9 @@ int receivemessage(int card, RspMessage *rspmsg) | |||
34 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 34 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
35 | return -EINVAL; | 35 | return -EINVAL; |
36 | } | 36 | } |
37 | 37 | ||
38 | pr_debug("%s: Entered receivemessage\n", | 38 | pr_debug("%s: Entered receivemessage\n", |
39 | sc_adapter[card]->devicename); | 39 | sc_adapter[card]->devicename); |
40 | 40 | ||
41 | /* | 41 | /* |
42 | * See if there are messages waiting | 42 | * See if there are messages waiting |
@@ -47,47 +47,47 @@ int receivemessage(int card, RspMessage *rspmsg) | |||
47 | */ | 47 | */ |
48 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); | 48 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); |
49 | outb((sc_adapter[card]->shmem_magic >> 14) | 0x80, | 49 | outb((sc_adapter[card]->shmem_magic >> 14) | 0x80, |
50 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); | 50 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); |
51 | dpm = (DualPortMemory *) sc_adapter[card]->rambase; | 51 | dpm = (DualPortMemory *) sc_adapter[card]->rambase; |
52 | memcpy_fromio(rspmsg, &(dpm->rsp_queue[dpm->rsp_tail]), | 52 | memcpy_fromio(rspmsg, &(dpm->rsp_queue[dpm->rsp_tail]), |
53 | MSG_LEN); | 53 | MSG_LEN); |
54 | dpm->rsp_tail = (dpm->rsp_tail+1) % MAX_MESSAGES; | 54 | dpm->rsp_tail = (dpm->rsp_tail + 1) % MAX_MESSAGES; |
55 | inb(sc_adapter[card]->ioport[FIFO_READ]); | 55 | inb(sc_adapter[card]->ioport[FIFO_READ]); |
56 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | 56 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); |
57 | /* | 57 | /* |
58 | * Tell the board that the message is received | 58 | * Tell the board that the message is received |
59 | */ | 59 | */ |
60 | pr_debug("%s: Received Message seq:%d pid:%d time:%d cmd:%d " | 60 | pr_debug("%s: Received Message seq:%d pid:%d time:%d cmd:%d " |
61 | "cnt:%d (type,class,code):(%d,%d,%d) " | 61 | "cnt:%d (type,class,code):(%d,%d,%d) " |
62 | "link:%d stat:0x%x\n", | 62 | "link:%d stat:0x%x\n", |
63 | sc_adapter[card]->devicename, | 63 | sc_adapter[card]->devicename, |
64 | rspmsg->sequence_no, | 64 | rspmsg->sequence_no, |
65 | rspmsg->process_id, | 65 | rspmsg->process_id, |
66 | rspmsg->time_stamp, | 66 | rspmsg->time_stamp, |
67 | rspmsg->cmd_sequence_no, | 67 | rspmsg->cmd_sequence_no, |
68 | rspmsg->msg_byte_cnt, | 68 | rspmsg->msg_byte_cnt, |
69 | rspmsg->type, | 69 | rspmsg->type, |
70 | rspmsg->class, | 70 | rspmsg->class, |
71 | rspmsg->code, | 71 | rspmsg->code, |
72 | rspmsg->phy_link_no, | 72 | rspmsg->phy_link_no, |
73 | rspmsg->rsp_status); | 73 | rspmsg->rsp_status); |
74 | 74 | ||
75 | return 0; | 75 | return 0; |
76 | } | 76 | } |
77 | return -ENOMSG; | 77 | return -ENOMSG; |
78 | } | 78 | } |
79 | 79 | ||
80 | /* | 80 | /* |
81 | * send a message to the board | 81 | * send a message to the board |
82 | */ | 82 | */ |
83 | int sendmessage(int card, | 83 | int sendmessage(int card, |
84 | unsigned int procid, | 84 | unsigned int procid, |
85 | unsigned int type, | 85 | unsigned int type, |
86 | unsigned int class, | 86 | unsigned int class, |
87 | unsigned int code, | 87 | unsigned int code, |
88 | unsigned int link, | 88 | unsigned int link, |
89 | unsigned int data_len, | 89 | unsigned int data_len, |
90 | unsigned int *data) | 90 | unsigned int *data) |
91 | { | 91 | { |
92 | DualPortMemory *dpm; | 92 | DualPortMemory *dpm; |
93 | ReqMessage sndmsg; | 93 | ReqMessage sndmsg; |
@@ -102,15 +102,15 @@ int sendmessage(int card, | |||
102 | * Make sure we only send CEPID messages when the engine is up | 102 | * Make sure we only send CEPID messages when the engine is up |
103 | * and CMPID messages when it is down | 103 | * and CMPID messages when it is down |
104 | */ | 104 | */ |
105 | if(sc_adapter[card]->EngineUp && procid == CMPID) { | 105 | if (sc_adapter[card]->EngineUp && procid == CMPID) { |
106 | pr_debug("%s: Attempt to send CM message with engine up\n", | 106 | pr_debug("%s: Attempt to send CM message with engine up\n", |
107 | sc_adapter[card]->devicename); | 107 | sc_adapter[card]->devicename); |
108 | return -ESRCH; | 108 | return -ESRCH; |
109 | } | 109 | } |
110 | 110 | ||
111 | if(!sc_adapter[card]->EngineUp && procid == CEPID) { | 111 | if (!sc_adapter[card]->EngineUp && procid == CEPID) { |
112 | pr_debug("%s: Attempt to send CE message with engine down\n", | 112 | pr_debug("%s: Attempt to send CE message with engine down\n", |
113 | sc_adapter[card]->devicename); | 113 | sc_adapter[card]->devicename); |
114 | return -ESRCH; | 114 | return -ESRCH; |
115 | } | 115 | } |
116 | 116 | ||
@@ -142,39 +142,39 @@ int sendmessage(int card, | |||
142 | */ | 142 | */ |
143 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); | 143 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); |
144 | outb((sc_adapter[card]->shmem_magic >> 14) | 0x80, | 144 | outb((sc_adapter[card]->shmem_magic >> 14) | 0x80, |
145 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); | 145 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); |
146 | dpm = (DualPortMemory *) sc_adapter[card]->rambase; /* Fix me */ | 146 | dpm = (DualPortMemory *) sc_adapter[card]->rambase; /* Fix me */ |
147 | memcpy_toio(&(dpm->req_queue[dpm->req_head]),&sndmsg,MSG_LEN); | 147 | memcpy_toio(&(dpm->req_queue[dpm->req_head]), &sndmsg, MSG_LEN); |
148 | dpm->req_head = (dpm->req_head+1) % MAX_MESSAGES; | 148 | dpm->req_head = (dpm->req_head + 1) % MAX_MESSAGES; |
149 | outb(sndmsg.sequence_no, sc_adapter[card]->ioport[FIFO_WRITE]); | 149 | outb(sndmsg.sequence_no, sc_adapter[card]->ioport[FIFO_WRITE]); |
150 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | 150 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); |
151 | 151 | ||
152 | pr_debug("%s: Sent Message seq:%d pid:%d time:%d " | 152 | pr_debug("%s: Sent Message seq:%d pid:%d time:%d " |
153 | "cnt:%d (type,class,code):(%d,%d,%d) " | 153 | "cnt:%d (type,class,code):(%d,%d,%d) " |
154 | "link:%d\n ", | 154 | "link:%d\n ", |
155 | sc_adapter[card]->devicename, | 155 | sc_adapter[card]->devicename, |
156 | sndmsg.sequence_no, | 156 | sndmsg.sequence_no, |
157 | sndmsg.process_id, | 157 | sndmsg.process_id, |
158 | sndmsg.time_stamp, | 158 | sndmsg.time_stamp, |
159 | sndmsg.msg_byte_cnt, | 159 | sndmsg.msg_byte_cnt, |
160 | sndmsg.type, | 160 | sndmsg.type, |
161 | sndmsg.class, | 161 | sndmsg.class, |
162 | sndmsg.code, | 162 | sndmsg.code, |
163 | sndmsg.phy_link_no); | 163 | sndmsg.phy_link_no); |
164 | 164 | ||
165 | return 0; | 165 | return 0; |
166 | } | 166 | } |
167 | 167 | ||
168 | int send_and_receive(int card, | 168 | int send_and_receive(int card, |
169 | unsigned int procid, | 169 | unsigned int procid, |
170 | unsigned char type, | 170 | unsigned char type, |
171 | unsigned char class, | 171 | unsigned char class, |
172 | unsigned char code, | 172 | unsigned char code, |
173 | unsigned char link, | 173 | unsigned char link, |
174 | unsigned char data_len, | 174 | unsigned char data_len, |
175 | unsigned char *data, | 175 | unsigned char *data, |
176 | RspMessage *mesgdata, | 176 | RspMessage *mesgdata, |
177 | int timeout) | 177 | int timeout) |
178 | { | 178 | { |
179 | int retval; | 179 | int retval; |
180 | int tries; | 180 | int tries; |
@@ -185,12 +185,12 @@ int send_and_receive(int card, | |||
185 | } | 185 | } |
186 | 186 | ||
187 | sc_adapter[card]->want_async_messages = 1; | 187 | sc_adapter[card]->want_async_messages = 1; |
188 | retval = sendmessage(card, procid, type, class, code, link, | 188 | retval = sendmessage(card, procid, type, class, code, link, |
189 | data_len, (unsigned int *) data); | 189 | data_len, (unsigned int *) data); |
190 | 190 | ||
191 | if (retval) { | 191 | if (retval) { |
192 | pr_debug("%s: SendMessage failed in SAR\n", | 192 | pr_debug("%s: SendMessage failed in SAR\n", |
193 | sc_adapter[card]->devicename); | 193 | sc_adapter[card]->devicename); |
194 | sc_adapter[card]->want_async_messages = 0; | 194 | sc_adapter[card]->want_async_messages = 0; |
195 | return -EIO; | 195 | return -EIO; |
196 | } | 196 | } |
@@ -199,7 +199,7 @@ int send_and_receive(int card, | |||
199 | /* wait for the response */ | 199 | /* wait for the response */ |
200 | while (tries < timeout) { | 200 | while (tries < timeout) { |
201 | schedule_timeout_interruptible(1); | 201 | schedule_timeout_interruptible(1); |
202 | 202 | ||
203 | pr_debug("SAR waiting..\n"); | 203 | pr_debug("SAR waiting..\n"); |
204 | 204 | ||
205 | /* | 205 | /* |
@@ -214,14 +214,14 @@ int send_and_receive(int card, | |||
214 | * Got it! | 214 | * Got it! |
215 | */ | 215 | */ |
216 | pr_debug("%s: Got ASYNC message\n", | 216 | pr_debug("%s: Got ASYNC message\n", |
217 | sc_adapter[card]->devicename); | 217 | sc_adapter[card]->devicename); |
218 | memcpy(mesgdata, &(sc_adapter[card]->async_msg), | 218 | memcpy(mesgdata, &(sc_adapter[card]->async_msg), |
219 | sizeof(RspMessage)); | 219 | sizeof(RspMessage)); |
220 | sc_adapter[card]->want_async_messages = 0; | 220 | sc_adapter[card]->want_async_messages = 0; |
221 | return 0; | 221 | return 0; |
222 | } | 222 | } |
223 | 223 | ||
224 | tries++; | 224 | tries++; |
225 | } | 225 | } |
226 | 226 | ||
227 | pr_debug("%s: SAR message timeout\n", sc_adapter[card]->devicename); | 227 | pr_debug("%s: SAR message timeout\n", sc_adapter[card]->devicename); |
diff --git a/drivers/isdn/sc/message.h b/drivers/isdn/sc/message.h index 8eb15e7306b2..5e6f4a5c15f8 100644 --- a/drivers/isdn/sc/message.h +++ b/drivers/isdn/sc/message.h | |||
@@ -21,7 +21,7 @@ | |||
21 | /* | 21 | /* |
22 | * Board message macros, defines and structures | 22 | * Board message macros, defines and structures |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #ifndef MESSAGE_H | 25 | #ifndef MESSAGE_H |
26 | #define MESSAGE_H | 26 | #define MESSAGE_H |
27 | 27 | ||
@@ -36,19 +36,19 @@ | |||
36 | * Macro to determine if a message is a loader message | 36 | * Macro to determine if a message is a loader message |
37 | */ | 37 | */ |
38 | #define IS_CM_MESSAGE(mesg, tx, cx, dx) \ | 38 | #define IS_CM_MESSAGE(mesg, tx, cx, dx) \ |
39 | ((mesg.type == cmRspType##tx) \ | 39 | ((mesg.type == cmRspType##tx) \ |
40 | &&(mesg.class == cmRspClass##cx) \ | 40 | && (mesg.class == cmRspClass##cx) \ |
41 | &&(mesg.code == cmRsp##dx)) | 41 | && (mesg.code == cmRsp##dx)) |
42 | 42 | ||
43 | /* | 43 | /* |
44 | * Macro to determine if a message is a firmware message | 44 | * Macro to determine if a message is a firmware message |
45 | */ | 45 | */ |
46 | #define IS_CE_MESSAGE(mesg, tx, cx, dx) \ | 46 | #define IS_CE_MESSAGE(mesg, tx, cx, dx) \ |
47 | ((mesg.type == ceRspType##tx) \ | 47 | ((mesg.type == ceRspType##tx) \ |
48 | &&(mesg.class == ceRspClass##cx) \ | 48 | && (mesg.class == ceRspClass##cx) \ |
49 | &&(mesg.code == ceRsp##tx##dx)) | 49 | && (mesg.code == ceRsp##tx##dx)) |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * Loader Request and Response Messages | 52 | * Loader Request and Response Messages |
53 | */ | 53 | */ |
54 | 54 | ||
@@ -186,7 +186,7 @@ typedef struct { | |||
186 | } LLData; | 186 | } LLData; |
187 | 187 | ||
188 | 188 | ||
189 | /* | 189 | /* |
190 | * Message payload template for an HWConfig message | 190 | * Message payload template for an HWConfig message |
191 | */ | 191 | */ |
192 | typedef struct { | 192 | typedef struct { |
diff --git a/drivers/isdn/sc/packet.c b/drivers/isdn/sc/packet.c index 5ff6ae868440..2446957085e0 100644 --- a/drivers/isdn/sc/packet.c +++ b/drivers/isdn/sc/packet.c | |||
@@ -29,27 +29,27 @@ int sndpkt(int devId, int channel, int ack, struct sk_buff *data) | |||
29 | 29 | ||
30 | card = get_card_from_id(devId); | 30 | card = get_card_from_id(devId); |
31 | 31 | ||
32 | if(!IS_VALID_CARD(card)) { | 32 | if (!IS_VALID_CARD(card)) { |
33 | pr_debug("invalid param: %d is not a valid card id\n", card); | 33 | pr_debug("invalid param: %d is not a valid card id\n", card); |
34 | return -ENODEV; | 34 | return -ENODEV; |
35 | } | 35 | } |
36 | 36 | ||
37 | pr_debug("%s: sndpkt: frst = 0x%lx nxt = %d f = %d n = %d\n", | 37 | pr_debug("%s: sndpkt: frst = 0x%lx nxt = %d f = %d n = %d\n", |
38 | sc_adapter[card]->devicename, | 38 | sc_adapter[card]->devicename, |
39 | sc_adapter[card]->channel[channel].first_sendbuf, | 39 | sc_adapter[card]->channel[channel].first_sendbuf, |
40 | sc_adapter[card]->channel[channel].next_sendbuf, | 40 | sc_adapter[card]->channel[channel].next_sendbuf, |
41 | sc_adapter[card]->channel[channel].free_sendbufs, | 41 | sc_adapter[card]->channel[channel].free_sendbufs, |
42 | sc_adapter[card]->channel[channel].num_sendbufs); | 42 | sc_adapter[card]->channel[channel].num_sendbufs); |
43 | 43 | ||
44 | if(!sc_adapter[card]->channel[channel].free_sendbufs) { | 44 | if (!sc_adapter[card]->channel[channel].free_sendbufs) { |
45 | pr_debug("%s: out of TX buffers\n", | 45 | pr_debug("%s: out of TX buffers\n", |
46 | sc_adapter[card]->devicename); | 46 | sc_adapter[card]->devicename); |
47 | return -EINVAL; | 47 | return -EINVAL; |
48 | } | 48 | } |
49 | 49 | ||
50 | if(data->len > BUFFER_SIZE) { | 50 | if (data->len > BUFFER_SIZE) { |
51 | pr_debug("%s: data overflows buffer size (data > buffer)\n", | 51 | pr_debug("%s: data overflows buffer size (data > buffer)\n", |
52 | sc_adapter[card]->devicename); | 52 | sc_adapter[card]->devicename); |
53 | return -EINVAL; | 53 | return -EINVAL; |
54 | } | 54 | } |
55 | 55 | ||
@@ -57,24 +57,24 @@ int sndpkt(int devId, int channel, int ack, struct sk_buff *data) | |||
57 | BUFFER_SIZE + sc_adapter[card]->channel[channel].first_sendbuf; | 57 | BUFFER_SIZE + sc_adapter[card]->channel[channel].first_sendbuf; |
58 | ReqLnkWrite.msg_len = data->len; /* sk_buff size */ | 58 | ReqLnkWrite.msg_len = data->len; /* sk_buff size */ |
59 | pr_debug("%s: writing %d bytes to buffer offset 0x%lx\n", | 59 | pr_debug("%s: writing %d bytes to buffer offset 0x%lx\n", |
60 | sc_adapter[card]->devicename, | 60 | sc_adapter[card]->devicename, |
61 | ReqLnkWrite.msg_len, ReqLnkWrite.buff_offset); | 61 | ReqLnkWrite.msg_len, ReqLnkWrite.buff_offset); |
62 | memcpy_toshmem(card, (char *)ReqLnkWrite.buff_offset, data->data, ReqLnkWrite.msg_len); | 62 | memcpy_toshmem(card, (char *)ReqLnkWrite.buff_offset, data->data, ReqLnkWrite.msg_len); |
63 | 63 | ||
64 | /* | 64 | /* |
65 | * sendmessage | 65 | * sendmessage |
66 | */ | 66 | */ |
67 | pr_debug("%s: sndpkt size=%d, buf_offset=0x%lx buf_indx=%d\n", | 67 | pr_debug("%s: sndpkt size=%d, buf_offset=0x%lx buf_indx=%d\n", |
68 | sc_adapter[card]->devicename, | 68 | sc_adapter[card]->devicename, |
69 | ReqLnkWrite.msg_len, ReqLnkWrite.buff_offset, | 69 | ReqLnkWrite.msg_len, ReqLnkWrite.buff_offset, |
70 | sc_adapter[card]->channel[channel].next_sendbuf); | 70 | sc_adapter[card]->channel[channel].next_sendbuf); |
71 | 71 | ||
72 | status = sendmessage(card, CEPID, ceReqTypeLnk, ceReqClass1, ceReqLnkWrite, | 72 | status = sendmessage(card, CEPID, ceReqTypeLnk, ceReqClass1, ceReqLnkWrite, |
73 | channel+1, sizeof(LLData), (unsigned int*)&ReqLnkWrite); | 73 | channel + 1, sizeof(LLData), (unsigned int *)&ReqLnkWrite); |
74 | len = data->len; | 74 | len = data->len; |
75 | if(status) { | 75 | if (status) { |
76 | pr_debug("%s: failed to send packet, status = %d\n", | 76 | pr_debug("%s: failed to send packet, status = %d\n", |
77 | sc_adapter[card]->devicename, status); | 77 | sc_adapter[card]->devicename, status); |
78 | return -1; | 78 | return -1; |
79 | } | 79 | } |
80 | else { | 80 | else { |
@@ -83,9 +83,9 @@ int sndpkt(int devId, int channel, int ack, struct sk_buff *data) | |||
83 | ++sc_adapter[card]->channel[channel].next_sendbuf == | 83 | ++sc_adapter[card]->channel[channel].next_sendbuf == |
84 | sc_adapter[card]->channel[channel].num_sendbufs ? 0 : | 84 | sc_adapter[card]->channel[channel].num_sendbufs ? 0 : |
85 | sc_adapter[card]->channel[channel].next_sendbuf; | 85 | sc_adapter[card]->channel[channel].next_sendbuf; |
86 | pr_debug("%s: packet sent successfully\n", sc_adapter[card]->devicename); | 86 | pr_debug("%s: packet sent successfully\n", sc_adapter[card]->devicename); |
87 | dev_kfree_skb(data); | 87 | dev_kfree_skb(data); |
88 | indicate_status(card,ISDN_STAT_BSENT,channel, (char *)&len); | 88 | indicate_status(card, ISDN_STAT_BSENT, channel, (char *)&len); |
89 | } | 89 | } |
90 | return len; | 90 | return len; |
91 | } | 91 | } |
@@ -95,49 +95,49 @@ void rcvpkt(int card, RspMessage *rcvmsg) | |||
95 | LLData newll; | 95 | LLData newll; |
96 | struct sk_buff *skb; | 96 | struct sk_buff *skb; |
97 | 97 | ||
98 | if(!IS_VALID_CARD(card)) { | 98 | if (!IS_VALID_CARD(card)) { |
99 | pr_debug("invalid param: %d is not a valid card id\n", card); | 99 | pr_debug("invalid param: %d is not a valid card id\n", card); |
100 | return; | 100 | return; |
101 | } | 101 | } |
102 | 102 | ||
103 | switch(rcvmsg->rsp_status){ | 103 | switch (rcvmsg->rsp_status) { |
104 | case 0x01: | 104 | case 0x01: |
105 | case 0x02: | 105 | case 0x02: |
106 | case 0x70: | 106 | case 0x70: |
107 | pr_debug("%s: error status code: 0x%x\n", | 107 | pr_debug("%s: error status code: 0x%x\n", |
108 | sc_adapter[card]->devicename, rcvmsg->rsp_status); | 108 | sc_adapter[card]->devicename, rcvmsg->rsp_status); |
109 | return; | 109 | return; |
110 | case 0x00: | 110 | case 0x00: |
111 | if (!(skb = dev_alloc_skb(rcvmsg->msg_data.response.msg_len))) { | 111 | if (!(skb = dev_alloc_skb(rcvmsg->msg_data.response.msg_len))) { |
112 | printk(KERN_WARNING "%s: rcvpkt out of memory, dropping packet\n", | 112 | printk(KERN_WARNING "%s: rcvpkt out of memory, dropping packet\n", |
113 | sc_adapter[card]->devicename); | 113 | sc_adapter[card]->devicename); |
114 | return; | 114 | return; |
115 | } | 115 | } |
116 | skb_put(skb, rcvmsg->msg_data.response.msg_len); | 116 | skb_put(skb, rcvmsg->msg_data.response.msg_len); |
117 | pr_debug("%s: getting data from offset: 0x%lx\n", | 117 | pr_debug("%s: getting data from offset: 0x%lx\n", |
118 | sc_adapter[card]->devicename, | 118 | sc_adapter[card]->devicename, |
119 | rcvmsg->msg_data.response.buff_offset); | 119 | rcvmsg->msg_data.response.buff_offset); |
120 | memcpy_fromshmem(card, | 120 | memcpy_fromshmem(card, |
121 | skb_put(skb, rcvmsg->msg_data.response.msg_len), | 121 | skb_put(skb, rcvmsg->msg_data.response.msg_len), |
122 | (char *)rcvmsg->msg_data.response.buff_offset, | 122 | (char *)rcvmsg->msg_data.response.buff_offset, |
123 | rcvmsg->msg_data.response.msg_len); | 123 | rcvmsg->msg_data.response.msg_len); |
124 | sc_adapter[card]->card->rcvcallb_skb(sc_adapter[card]->driverId, | 124 | sc_adapter[card]->card->rcvcallb_skb(sc_adapter[card]->driverId, |
125 | rcvmsg->phy_link_no-1, skb); | 125 | rcvmsg->phy_link_no - 1, skb); |
126 | 126 | ||
127 | case 0x03: | 127 | case 0x03: |
128 | /* | 128 | /* |
129 | * Recycle the buffer | 129 | * Recycle the buffer |
130 | */ | 130 | */ |
131 | pr_debug("%s: buffer size : %d\n", | 131 | pr_debug("%s: buffer size : %d\n", |
132 | sc_adapter[card]->devicename, BUFFER_SIZE); | 132 | sc_adapter[card]->devicename, BUFFER_SIZE); |
133 | /* memset_shmem(card, rcvmsg->msg_data.response.buff_offset, 0, BUFFER_SIZE); */ | 133 | /* memset_shmem(card, rcvmsg->msg_data.response.buff_offset, 0, BUFFER_SIZE); */ |
134 | newll.buff_offset = rcvmsg->msg_data.response.buff_offset; | 134 | newll.buff_offset = rcvmsg->msg_data.response.buff_offset; |
135 | newll.msg_len = BUFFER_SIZE; | 135 | newll.msg_len = BUFFER_SIZE; |
136 | pr_debug("%s: recycled buffer at offset 0x%lx size %d\n", | 136 | pr_debug("%s: recycled buffer at offset 0x%lx size %d\n", |
137 | sc_adapter[card]->devicename, | 137 | sc_adapter[card]->devicename, |
138 | newll.buff_offset, newll.msg_len); | 138 | newll.buff_offset, newll.msg_len); |
139 | sendmessage(card, CEPID, ceReqTypeLnk, ceReqClass1, ceReqLnkRead, | 139 | sendmessage(card, CEPID, ceReqTypeLnk, ceReqClass1, ceReqLnkRead, |
140 | rcvmsg->phy_link_no, sizeof(LLData), (unsigned int *)&newll); | 140 | rcvmsg->phy_link_no, sizeof(LLData), (unsigned int *)&newll); |
141 | } | 141 | } |
142 | 142 | ||
143 | } | 143 | } |
@@ -148,7 +148,7 @@ int setup_buffers(int card, int c) | |||
148 | unsigned int buffer_size; | 148 | unsigned int buffer_size; |
149 | LLData RcvBuffOffset; | 149 | LLData RcvBuffOffset; |
150 | 150 | ||
151 | if(!IS_VALID_CARD(card)) { | 151 | if (!IS_VALID_CARD(card)) { |
152 | pr_debug("invalid param: %d is not a valid card id\n", card); | 152 | pr_debug("invalid param: %d is not a valid card id\n", card); |
153 | return -ENODEV; | 153 | return -ENODEV; |
154 | } | 154 | } |
@@ -157,49 +157,48 @@ int setup_buffers(int card, int c) | |||
157 | * Calculate the buffer offsets (send/recv/send/recv) | 157 | * Calculate the buffer offsets (send/recv/send/recv) |
158 | */ | 158 | */ |
159 | pr_debug("%s: setting up channel buffer space in shared RAM\n", | 159 | pr_debug("%s: setting up channel buffer space in shared RAM\n", |
160 | sc_adapter[card]->devicename); | 160 | sc_adapter[card]->devicename); |
161 | buffer_size = BUFFER_SIZE; | 161 | buffer_size = BUFFER_SIZE; |
162 | nBuffers = ((sc_adapter[card]->ramsize - BUFFER_BASE) / buffer_size) / 2; | 162 | nBuffers = ((sc_adapter[card]->ramsize - BUFFER_BASE) / buffer_size) / 2; |
163 | nBuffers = nBuffers > BUFFERS_MAX ? BUFFERS_MAX : nBuffers; | 163 | nBuffers = nBuffers > BUFFERS_MAX ? BUFFERS_MAX : nBuffers; |
164 | pr_debug("%s: calculating buffer space: %d buffers, %d big\n", | 164 | pr_debug("%s: calculating buffer space: %d buffers, %d big\n", |
165 | sc_adapter[card]->devicename, | 165 | sc_adapter[card]->devicename, |
166 | nBuffers, buffer_size); | 166 | nBuffers, buffer_size); |
167 | if(nBuffers < 2) { | 167 | if (nBuffers < 2) { |
168 | pr_debug("%s: not enough buffer space\n", | 168 | pr_debug("%s: not enough buffer space\n", |
169 | sc_adapter[card]->devicename); | 169 | sc_adapter[card]->devicename); |
170 | return -1; | 170 | return -1; |
171 | } | 171 | } |
172 | cBase = (nBuffers * buffer_size) * (c - 1); | 172 | cBase = (nBuffers * buffer_size) * (c - 1); |
173 | pr_debug("%s: channel buffer offset from shared RAM: 0x%x\n", | 173 | pr_debug("%s: channel buffer offset from shared RAM: 0x%x\n", |
174 | sc_adapter[card]->devicename, cBase); | 174 | sc_adapter[card]->devicename, cBase); |
175 | sc_adapter[card]->channel[c-1].first_sendbuf = BUFFER_BASE + cBase; | 175 | sc_adapter[card]->channel[c - 1].first_sendbuf = BUFFER_BASE + cBase; |
176 | sc_adapter[card]->channel[c-1].num_sendbufs = nBuffers / 2; | 176 | sc_adapter[card]->channel[c - 1].num_sendbufs = nBuffers / 2; |
177 | sc_adapter[card]->channel[c-1].free_sendbufs = nBuffers / 2; | 177 | sc_adapter[card]->channel[c - 1].free_sendbufs = nBuffers / 2; |
178 | sc_adapter[card]->channel[c-1].next_sendbuf = 0; | 178 | sc_adapter[card]->channel[c - 1].next_sendbuf = 0; |
179 | pr_debug("%s: send buffer setup complete: first=0x%lx n=%d f=%d, nxt=%d\n", | 179 | pr_debug("%s: send buffer setup complete: first=0x%lx n=%d f=%d, nxt=%d\n", |
180 | sc_adapter[card]->devicename, | 180 | sc_adapter[card]->devicename, |
181 | sc_adapter[card]->channel[c-1].first_sendbuf, | 181 | sc_adapter[card]->channel[c - 1].first_sendbuf, |
182 | sc_adapter[card]->channel[c-1].num_sendbufs, | 182 | sc_adapter[card]->channel[c - 1].num_sendbufs, |
183 | sc_adapter[card]->channel[c-1].free_sendbufs, | 183 | sc_adapter[card]->channel[c - 1].free_sendbufs, |
184 | sc_adapter[card]->channel[c-1].next_sendbuf); | 184 | sc_adapter[card]->channel[c - 1].next_sendbuf); |
185 | 185 | ||
186 | /* | 186 | /* |
187 | * Prep the receive buffers | 187 | * Prep the receive buffers |
188 | */ | 188 | */ |
189 | pr_debug("%s: adding %d RecvBuffers:\n", | 189 | pr_debug("%s: adding %d RecvBuffers:\n", |
190 | sc_adapter[card]->devicename, nBuffers /2); | 190 | sc_adapter[card]->devicename, nBuffers / 2); |
191 | for (i = 0 ; i < nBuffers / 2; i++) { | 191 | for (i = 0; i < nBuffers / 2; i++) { |
192 | RcvBuffOffset.buff_offset = | 192 | RcvBuffOffset.buff_offset = |
193 | ((sc_adapter[card]->channel[c-1].first_sendbuf + | 193 | ((sc_adapter[card]->channel[c - 1].first_sendbuf + |
194 | (nBuffers / 2) * buffer_size) + (buffer_size * i)); | 194 | (nBuffers / 2) * buffer_size) + (buffer_size * i)); |
195 | RcvBuffOffset.msg_len = buffer_size; | 195 | RcvBuffOffset.msg_len = buffer_size; |
196 | pr_debug("%s: adding RcvBuffer #%d offset=0x%lx sz=%d bufsz:%d\n", | 196 | pr_debug("%s: adding RcvBuffer #%d offset=0x%lx sz=%d bufsz:%d\n", |
197 | sc_adapter[card]->devicename, | 197 | sc_adapter[card]->devicename, |
198 | i + 1, RcvBuffOffset.buff_offset, | 198 | i + 1, RcvBuffOffset.buff_offset, |
199 | RcvBuffOffset.msg_len,buffer_size); | 199 | RcvBuffOffset.msg_len, buffer_size); |
200 | sendmessage(card, CEPID, ceReqTypeLnk, ceReqClass1, ceReqLnkRead, | 200 | sendmessage(card, CEPID, ceReqTypeLnk, ceReqClass1, ceReqLnkRead, |
201 | c, sizeof(LLData), (unsigned int *)&RcvBuffOffset); | 201 | c, sizeof(LLData), (unsigned int *)&RcvBuffOffset); |
202 | } | 202 | } |
203 | return 0; | 203 | return 0; |
204 | } | 204 | } |
205 | |||
diff --git a/drivers/isdn/sc/scioc.h b/drivers/isdn/sc/scioc.h index dfb107a6de44..a50e143779e7 100644 --- a/drivers/isdn/sc/scioc.h +++ b/drivers/isdn/sc/scioc.h | |||
@@ -17,9 +17,9 @@ | |||
17 | #define SCIOCGETSWITCH 0x06 /* Get switch type */ | 17 | #define SCIOCGETSWITCH 0x06 /* Get switch type */ |
18 | #define SCIOCSETSWITCH 0x07 /* Set switch type */ | 18 | #define SCIOCSETSWITCH 0x07 /* Set switch type */ |
19 | #define SCIOCGETSPID 0x08 /* Get channel SPID */ | 19 | #define SCIOCGETSPID 0x08 /* Get channel SPID */ |
20 | #define SCIOCSETSPID 0x09 /* Set channel SPID */ | 20 | #define SCIOCSETSPID 0x09 /* Set channel SPID */ |
21 | #define SCIOCGETDN 0x0A /* Get channel DN */ | 21 | #define SCIOCGETDN 0x0A /* Get channel DN */ |
22 | #define SCIOCSETDN 0x0B /* Set channel DN */ | 22 | #define SCIOCSETDN 0x0B /* Set channel DN */ |
23 | #define SCIOCTRACE 0x0C /* Toggle trace mode */ | 23 | #define SCIOCTRACE 0x0C /* Toggle trace mode */ |
24 | #define SCIOCSTAT 0x0D /* Get line status */ | 24 | #define SCIOCSTAT 0x0D /* Get line status */ |
25 | #define SCIOCGETSPEED 0x0E /* Set channel speed */ | 25 | #define SCIOCGETSPEED 0x0E /* Set channel speed */ |
@@ -108,4 +108,3 @@ typedef struct { | |||
108 | } boardInfo; | 108 | } boardInfo; |
109 | 109 | ||
110 | #endif /* __ISDN_SC_SCIOC_H__ */ | 110 | #endif /* __ISDN_SC_SCIOC_H__ */ |
111 | |||
diff --git a/drivers/isdn/sc/shmem.c b/drivers/isdn/sc/shmem.c index 7f16d75d2d89..d24506ceb6e8 100644 --- a/drivers/isdn/sc/shmem.c +++ b/drivers/isdn/sc/shmem.c | |||
@@ -42,22 +42,22 @@ void memcpy_toshmem(int card, void *dest, const void *src, size_t n) | |||
42 | * determine the page to load from the address | 42 | * determine the page to load from the address |
43 | */ | 43 | */ |
44 | ch = (unsigned long) dest / SRAM_PAGESIZE; | 44 | ch = (unsigned long) dest / SRAM_PAGESIZE; |
45 | pr_debug("%s: loaded page %d\n", sc_adapter[card]->devicename,ch); | 45 | pr_debug("%s: loaded page %d\n", sc_adapter[card]->devicename, ch); |
46 | /* | 46 | /* |
47 | * Block interrupts and load the page | 47 | * Block interrupts and load the page |
48 | */ | 48 | */ |
49 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); | 49 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); |
50 | 50 | ||
51 | outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80, | 51 | outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80, |
52 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); | 52 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); |
53 | memcpy_toio((void __iomem *)(sc_adapter[card]->rambase + dest_rem), src, n); | 53 | memcpy_toio((void __iomem *)(sc_adapter[card]->rambase + dest_rem), src, n); |
54 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | 54 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); |
55 | pr_debug("%s: set page to %#x\n",sc_adapter[card]->devicename, | 55 | pr_debug("%s: set page to %#x\n", sc_adapter[card]->devicename, |
56 | ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80); | 56 | ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80); |
57 | pr_debug("%s: copying %zu bytes from %#lx to %#lx\n", | 57 | pr_debug("%s: copying %zu bytes from %#lx to %#lx\n", |
58 | sc_adapter[card]->devicename, n, | 58 | sc_adapter[card]->devicename, n, |
59 | (unsigned long) src, | 59 | (unsigned long) src, |
60 | sc_adapter[card]->rambase + ((unsigned long) dest %0x4000)); | 60 | sc_adapter[card]->rambase + ((unsigned long) dest % 0x4000)); |
61 | } | 61 | } |
62 | 62 | ||
63 | /* | 63 | /* |
@@ -68,12 +68,12 @@ void memcpy_fromshmem(int card, void *dest, const void *src, size_t n) | |||
68 | unsigned long flags; | 68 | unsigned long flags; |
69 | unsigned char ch; | 69 | unsigned char ch; |
70 | 70 | ||
71 | if(!IS_VALID_CARD(card)) { | 71 | if (!IS_VALID_CARD(card)) { |
72 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 72 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
73 | return; | 73 | return; |
74 | } | 74 | } |
75 | 75 | ||
76 | if(n > SRAM_PAGESIZE) { | 76 | if (n > SRAM_PAGESIZE) { |
77 | return; | 77 | return; |
78 | } | 78 | } |
79 | 79 | ||
@@ -81,24 +81,24 @@ void memcpy_fromshmem(int card, void *dest, const void *src, size_t n) | |||
81 | * determine the page to load from the address | 81 | * determine the page to load from the address |
82 | */ | 82 | */ |
83 | ch = (unsigned long) src / SRAM_PAGESIZE; | 83 | ch = (unsigned long) src / SRAM_PAGESIZE; |
84 | pr_debug("%s: loaded page %d\n", sc_adapter[card]->devicename,ch); | 84 | pr_debug("%s: loaded page %d\n", sc_adapter[card]->devicename, ch); |
85 | 85 | ||
86 | 86 | ||
87 | /* | 87 | /* |
88 | * Block interrupts and load the page | 88 | * Block interrupts and load the page |
89 | */ | 89 | */ |
90 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); | 90 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); |
91 | 91 | ||
92 | outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80, | 92 | outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80, |
93 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); | 93 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); |
94 | memcpy_fromio(dest,(void *)(sc_adapter[card]->rambase + | 94 | memcpy_fromio(dest, (void *)(sc_adapter[card]->rambase + |
95 | ((unsigned long) src % 0x4000)), n); | 95 | ((unsigned long) src % 0x4000)), n); |
96 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | 96 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); |
97 | pr_debug("%s: set page to %#x\n",sc_adapter[card]->devicename, | 97 | pr_debug("%s: set page to %#x\n", sc_adapter[card]->devicename, |
98 | ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80); | 98 | ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80); |
99 | /* pr_debug("%s: copying %d bytes from %#x to %#x\n", | 99 | /* pr_debug("%s: copying %d bytes from %#x to %#x\n", |
100 | sc_adapter[card]->devicename, n, | 100 | sc_adapter[card]->devicename, n, |
101 | sc_adapter[card]->rambase + ((unsigned long) src %0x4000), (unsigned long) dest); */ | 101 | sc_adapter[card]->rambase + ((unsigned long) src %0x4000), (unsigned long) dest); */ |
102 | } | 102 | } |
103 | 103 | ||
104 | #if 0 | 104 | #if 0 |
@@ -107,12 +107,12 @@ void memset_shmem(int card, void *dest, int c, size_t n) | |||
107 | unsigned long flags; | 107 | unsigned long flags; |
108 | unsigned char ch; | 108 | unsigned char ch; |
109 | 109 | ||
110 | if(!IS_VALID_CARD(card)) { | 110 | if (!IS_VALID_CARD(card)) { |
111 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 111 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
112 | return; | 112 | return; |
113 | } | 113 | } |
114 | 114 | ||
115 | if(n > SRAM_PAGESIZE) { | 115 | if (n > SRAM_PAGESIZE) { |
116 | return; | 116 | return; |
117 | } | 117 | } |
118 | 118 | ||
@@ -120,7 +120,7 @@ void memset_shmem(int card, void *dest, int c, size_t n) | |||
120 | * determine the page to load from the address | 120 | * determine the page to load from the address |
121 | */ | 121 | */ |
122 | ch = (unsigned long) dest / SRAM_PAGESIZE; | 122 | ch = (unsigned long) dest / SRAM_PAGESIZE; |
123 | pr_debug("%s: loaded page %d\n",sc_adapter[card]->devicename,ch); | 123 | pr_debug("%s: loaded page %d\n", sc_adapter[card]->devicename, ch); |
124 | 124 | ||
125 | /* | 125 | /* |
126 | * Block interrupts and load the page | 126 | * Block interrupts and load the page |
@@ -128,11 +128,11 @@ void memset_shmem(int card, void *dest, int c, size_t n) | |||
128 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); | 128 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); |
129 | 129 | ||
130 | outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80, | 130 | outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80, |
131 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); | 131 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); |
132 | memset_io(sc_adapter[card]->rambase + | 132 | memset_io(sc_adapter[card]->rambase + |
133 | ((unsigned long) dest % 0x4000), c, n); | 133 | ((unsigned long) dest % 0x4000), c, n); |
134 | pr_debug("%s: set page to %#x\n",sc_adapter[card]->devicename, | 134 | pr_debug("%s: set page to %#x\n", sc_adapter[card]->devicename, |
135 | ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80); | 135 | ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80); |
136 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | 136 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); |
137 | } | 137 | } |
138 | #endif /* 0 */ | 138 | #endif /* 0 */ |
diff --git a/drivers/isdn/sc/timer.c b/drivers/isdn/sc/timer.c index 91fbe0dc28ec..6fbac2230d7e 100644 --- a/drivers/isdn/sc/timer.c +++ b/drivers/isdn/sc/timer.c | |||
@@ -31,7 +31,7 @@ static void setup_ports(int card) | |||
31 | 31 | ||
32 | /* And the IRQ */ | 32 | /* And the IRQ */ |
33 | outb((sc_adapter[card]->interrupt | 0x80), | 33 | outb((sc_adapter[card]->interrupt | 0x80), |
34 | sc_adapter[card]->ioport[IRQ_SELECT]); | 34 | sc_adapter[card]->ioport[IRQ_SELECT]); |
35 | } | 35 | } |
36 | 36 | ||
37 | /* | 37 | /* |
@@ -50,18 +50,18 @@ void sc_check_reset(unsigned long data) | |||
50 | int card = (unsigned int) data; | 50 | int card = (unsigned int) data; |
51 | 51 | ||
52 | pr_debug("%s: check_timer timer called\n", | 52 | pr_debug("%s: check_timer timer called\n", |
53 | sc_adapter[card]->devicename); | 53 | sc_adapter[card]->devicename); |
54 | 54 | ||
55 | /* Setup the io ports */ | 55 | /* Setup the io ports */ |
56 | setup_ports(card); | 56 | setup_ports(card); |
57 | 57 | ||
58 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); | 58 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); |
59 | outb(sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport], | 59 | outb(sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport], |
60 | (sc_adapter[card]->shmem_magic>>14) | 0x80); | 60 | (sc_adapter[card]->shmem_magic >> 14) | 0x80); |
61 | sig = (unsigned long) *((unsigned long *)(sc_adapter[card]->rambase + SIG_OFFSET)); | 61 | sig = (unsigned long) *((unsigned long *)(sc_adapter[card]->rambase + SIG_OFFSET)); |
62 | 62 | ||
63 | /* check the signature */ | 63 | /* check the signature */ |
64 | if(sig == SIGNATURE) { | 64 | if (sig == SIGNATURE) { |
65 | flushreadfifo(card); | 65 | flushreadfifo(card); |
66 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | 66 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); |
67 | /* See if we need to do a startproc */ | 67 | /* See if we need to do a startproc */ |
@@ -69,8 +69,8 @@ void sc_check_reset(unsigned long data) | |||
69 | startproc(card); | 69 | startproc(card); |
70 | } else { | 70 | } else { |
71 | pr_debug("%s: No signature yet, waiting another %lu jiffies.\n", | 71 | pr_debug("%s: No signature yet, waiting another %lu jiffies.\n", |
72 | sc_adapter[card]->devicename, CHECKRESET_TIME); | 72 | sc_adapter[card]->devicename, CHECKRESET_TIME); |
73 | mod_timer(&sc_adapter[card]->reset_timer, jiffies+CHECKRESET_TIME); | 73 | mod_timer(&sc_adapter[card]->reset_timer, jiffies + CHECKRESET_TIME); |
74 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | 74 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); |
75 | } | 75 | } |
76 | } | 76 | } |
@@ -91,19 +91,19 @@ void check_phystat(unsigned long data) | |||
91 | int card = (unsigned int) data; | 91 | int card = (unsigned int) data; |
92 | 92 | ||
93 | pr_debug("%s: Checking status...\n", sc_adapter[card]->devicename); | 93 | pr_debug("%s: Checking status...\n", sc_adapter[card]->devicename); |
94 | /* | 94 | /* |
95 | * check the results of the last PhyStat and change only if | 95 | * check the results of the last PhyStat and change only if |
96 | * has changed drastically | 96 | * has changed drastically |
97 | */ | 97 | */ |
98 | if (sc_adapter[card]->nphystat && !sc_adapter[card]->phystat) { /* All is well */ | 98 | if (sc_adapter[card]->nphystat && !sc_adapter[card]->phystat) { /* All is well */ |
99 | pr_debug("PhyStat transition to RUN\n"); | 99 | pr_debug("PhyStat transition to RUN\n"); |
100 | pr_info("%s: Switch contacted, transmitter enabled\n", | 100 | pr_info("%s: Switch contacted, transmitter enabled\n", |
101 | sc_adapter[card]->devicename); | 101 | sc_adapter[card]->devicename); |
102 | indicate_status(card, ISDN_STAT_RUN, 0, NULL); | 102 | indicate_status(card, ISDN_STAT_RUN, 0, NULL); |
103 | } | 103 | } |
104 | else if (!sc_adapter[card]->nphystat && sc_adapter[card]->phystat) { /* All is not well */ | 104 | else if (!sc_adapter[card]->nphystat && sc_adapter[card]->phystat) { /* All is not well */ |
105 | pr_debug("PhyStat transition to STOP\n"); | 105 | pr_debug("PhyStat transition to STOP\n"); |
106 | pr_info("%s: Switch connection lost, transmitter disabled\n", | 106 | pr_info("%s: Switch connection lost, transmitter disabled\n", |
107 | sc_adapter[card]->devicename); | 107 | sc_adapter[card]->devicename); |
108 | 108 | ||
109 | indicate_status(card, ISDN_STAT_STOP, 0, NULL); | 109 | indicate_status(card, ISDN_STAT_STOP, 0, NULL); |
@@ -113,11 +113,10 @@ void check_phystat(unsigned long data) | |||
113 | 113 | ||
114 | /* Reinitialize the timer */ | 114 | /* Reinitialize the timer */ |
115 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); | 115 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); |
116 | mod_timer(&sc_adapter[card]->stat_timer, jiffies+CHECKSTAT_TIME); | 116 | mod_timer(&sc_adapter[card]->stat_timer, jiffies + CHECKSTAT_TIME); |
117 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | 117 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); |
118 | 118 | ||
119 | /* Send a new cePhyStatus message */ | 119 | /* Send a new cePhyStatus message */ |
120 | sendmessage(card, CEPID,ceReqTypePhy,ceReqClass2, | 120 | sendmessage(card, CEPID, ceReqTypePhy, ceReqClass2, |
121 | ceReqPhyStatus,0,0,NULL); | 121 | ceReqPhyStatus, 0, 0, NULL); |
122 | } | 122 | } |
123 | |||