]> git.ipfire.org Git - people/arne_f/kernel.git/blob - drivers/isdn/gigaset/i4l.c
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[people/arne_f/kernel.git] / drivers / isdn / gigaset / i4l.c
1 /*
2 * Stuff used by all variants of the driver
3 *
4 * Copyright (c) 2001 by Stefan Eilers,
5 * Hansjoerg Lipp <hjlipp@web.de>,
6 * Tilman Schmidt <tilman@imap.cc>.
7 *
8 * =====================================================================
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
13 * =====================================================================
14 */
15
16 #include "gigaset.h"
17 #include <linux/isdnif.h>
18 #include <linux/slab.h>
19
20 #define HW_HDR_LEN 2 /* Header size used to store ack info */
21
22 /* == Handling of I4L IO =====================================================*/
23
24 /* writebuf_from_LL
25 * called by LL to transmit data on an open channel
26 * inserts the buffer data into the send queue and starts the transmission
27 * Note that this operation must not sleep!
28 * When the buffer is processed completely, gigaset_skb_sent() should be called.
29 * parameters:
30 * driverID driver ID as assigned by LL
31 * channel channel number
32 * ack if != 0 LL wants to be notified on completion via
33 * statcallb(ISDN_STAT_BSENT)
34 * skb skb containing data to send
35 * return value:
36 * number of accepted bytes
37 * 0 if temporarily unable to accept data (out of buffer space)
38 * <0 on error (eg. -EINVAL)
39 */
40 static int writebuf_from_LL(int driverID, int channel, int ack,
41 struct sk_buff *skb)
42 {
43 struct cardstate *cs = gigaset_get_cs_by_id(driverID);
44 struct bc_state *bcs;
45 unsigned char *ack_header;
46 unsigned len;
47
48 if (!cs) {
49 pr_err("%s: invalid driver ID (%d)\n", __func__, driverID);
50 return -ENODEV;
51 }
52 if (channel < 0 || channel >= cs->channels) {
53 dev_err(cs->dev, "%s: invalid channel ID (%d)\n",
54 __func__, channel);
55 return -ENODEV;
56 }
57 bcs = &cs->bcs[channel];
58
59 /* can only handle linear sk_buffs */
60 if (skb_linearize(skb) < 0) {
61 dev_err(cs->dev, "%s: skb_linearize failed\n", __func__);
62 return -ENOMEM;
63 }
64 len = skb->len;
65
66 gig_dbg(DEBUG_LLDATA,
67 "Receiving data from LL (id: %d, ch: %d, ack: %d, sz: %d)",
68 driverID, channel, ack, len);
69
70 if (!len) {
71 if (ack)
72 dev_notice(cs->dev, "%s: not ACKing empty packet\n",
73 __func__);
74 return 0;
75 }
76 if (len > MAX_BUF_SIZE) {
77 dev_err(cs->dev, "%s: packet too large (%d bytes)\n",
78 __func__, len);
79 return -EINVAL;
80 }
81
82 /* set up acknowledgement header */
83 if (skb_headroom(skb) < HW_HDR_LEN) {
84 /* should never happen */
85 dev_err(cs->dev, "%s: insufficient skb headroom\n", __func__);
86 return -ENOMEM;
87 }
88 skb_set_mac_header(skb, -HW_HDR_LEN);
89 skb->mac_len = HW_HDR_LEN;
90 ack_header = skb_mac_header(skb);
91 if (ack) {
92 ack_header[0] = len & 0xff;
93 ack_header[1] = len >> 8;
94 } else {
95 ack_header[0] = ack_header[1] = 0;
96 }
97 gig_dbg(DEBUG_MCMD, "skb: len=%u, ack=%d: %02x %02x",
98 len, ack, ack_header[0], ack_header[1]);
99
100 /* pass to device-specific module */
101 return cs->ops->send_skb(bcs, skb);
102 }
103
104 /**
105 * gigaset_skb_sent() - acknowledge sending an skb
106 * @bcs: B channel descriptor structure.
107 * @skb: sent data.
108 *
109 * Called by hardware module {bas,ser,usb}_gigaset when the data in a
110 * skb has been successfully sent, for signalling completion to the LL.
111 */
112 void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb)
113 {
114 isdn_if *iif = bcs->cs->iif;
115 unsigned char *ack_header = skb_mac_header(skb);
116 unsigned len;
117 isdn_ctrl response;
118
119 ++bcs->trans_up;
120
121 if (skb->len)
122 dev_warn(bcs->cs->dev, "%s: skb->len==%d\n",
123 __func__, skb->len);
124
125 len = ack_header[0] + ((unsigned) ack_header[1] << 8);
126 if (len) {
127 gig_dbg(DEBUG_MCMD, "ACKing to LL (id: %d, ch: %d, sz: %u)",
128 bcs->cs->myid, bcs->channel, len);
129
130 response.driver = bcs->cs->myid;
131 response.command = ISDN_STAT_BSENT;
132 response.arg = bcs->channel;
133 response.parm.length = len;
134 iif->statcallb(&response);
135 }
136 }
137 EXPORT_SYMBOL_GPL(gigaset_skb_sent);
138
139 /**
140 * gigaset_skb_rcvd() - pass received skb to LL
141 * @bcs: B channel descriptor structure.
142 * @skb: received data.
143 *
144 * Called by hardware module {bas,ser,usb}_gigaset when user data has
145 * been successfully received, for passing to the LL.
146 * Warning: skb must not be accessed anymore!
147 */
148 void gigaset_skb_rcvd(struct bc_state *bcs, struct sk_buff *skb)
149 {
150 isdn_if *iif = bcs->cs->iif;
151
152 iif->rcvcallb_skb(bcs->cs->myid, bcs->channel, skb);
153 bcs->trans_down++;
154 }
155 EXPORT_SYMBOL_GPL(gigaset_skb_rcvd);
156
157 /**
158 * gigaset_isdn_rcv_err() - signal receive error
159 * @bcs: B channel descriptor structure.
160 *
161 * Called by hardware module {bas,ser,usb}_gigaset when a receive error
162 * has occurred, for signalling to the LL.
163 */
164 void gigaset_isdn_rcv_err(struct bc_state *bcs)
165 {
166 isdn_if *iif = bcs->cs->iif;
167 isdn_ctrl response;
168
169 /* if currently ignoring packets, just count down */
170 if (bcs->ignore) {
171 bcs->ignore--;
172 return;
173 }
174
175 /* update statistics */
176 bcs->corrupted++;
177
178 /* error -> LL */
179 gig_dbg(DEBUG_CMD, "sending L1ERR");
180 response.driver = bcs->cs->myid;
181 response.command = ISDN_STAT_L1ERR;
182 response.arg = bcs->channel;
183 response.parm.errcode = ISDN_STAT_L1ERR_RECV;
184 iif->statcallb(&response);
185 }
186 EXPORT_SYMBOL_GPL(gigaset_isdn_rcv_err);
187
188 /* This function will be called by LL to send commands
189 * NOTE: LL ignores the returned value, for commands other than ISDN_CMD_IOCTL,
190 * so don't put too much effort into it.
191 */
192 static int command_from_LL(isdn_ctrl *cntrl)
193 {
194 struct cardstate *cs;
195 struct bc_state *bcs;
196 int retval = 0;
197 char **commands;
198 int ch;
199 int i;
200 size_t l;
201
202 gigaset_debugdrivers();
203
204 gig_dbg(DEBUG_CMD, "driver: %d, command: %d, arg: 0x%lx",
205 cntrl->driver, cntrl->command, cntrl->arg);
206
207 cs = gigaset_get_cs_by_id(cntrl->driver);
208 if (cs == NULL) {
209 pr_err("%s: invalid driver ID (%d)\n", __func__, cntrl->driver);
210 return -ENODEV;
211 }
212 ch = cntrl->arg & 0xff;
213
214 switch (cntrl->command) {
215 case ISDN_CMD_IOCTL:
216 dev_warn(cs->dev, "ISDN_CMD_IOCTL not supported\n");
217 return -EINVAL;
218
219 case ISDN_CMD_DIAL:
220 gig_dbg(DEBUG_CMD,
221 "ISDN_CMD_DIAL (phone: %s, msn: %s, si1: %d, si2: %d)",
222 cntrl->parm.setup.phone, cntrl->parm.setup.eazmsn,
223 cntrl->parm.setup.si1, cntrl->parm.setup.si2);
224
225 if (ch >= cs->channels) {
226 dev_err(cs->dev,
227 "ISDN_CMD_DIAL: invalid channel (%d)\n", ch);
228 return -EINVAL;
229 }
230 bcs = cs->bcs + ch;
231 if (!gigaset_get_channel(bcs)) {
232 dev_err(cs->dev, "ISDN_CMD_DIAL: channel not free\n");
233 return -EBUSY;
234 }
235
236 commands = kzalloc(AT_NUM*(sizeof *commands), GFP_ATOMIC);
237 if (!commands) {
238 gigaset_free_channel(bcs);
239 dev_err(cs->dev, "ISDN_CMD_DIAL: out of memory\n");
240 return -ENOMEM;
241 }
242
243 l = 3 + strlen(cntrl->parm.setup.phone);
244 commands[AT_DIAL] = kmalloc(l, GFP_ATOMIC);
245 if (!commands[AT_DIAL])
246 goto oom;
247 if (cntrl->parm.setup.phone[0] == '*' &&
248 cntrl->parm.setup.phone[1] == '*') {
249 /* internal call: translate ** prefix to CTP value */
250 commands[AT_TYPE] = kstrdup("^SCTP=0\r", GFP_ATOMIC);
251 if (!commands[AT_TYPE])
252 goto oom;
253 snprintf(commands[AT_DIAL], l,
254 "D%s\r", cntrl->parm.setup.phone+2);
255 } else {
256 commands[AT_TYPE] = kstrdup("^SCTP=1\r", GFP_ATOMIC);
257 if (!commands[AT_TYPE])
258 goto oom;
259 snprintf(commands[AT_DIAL], l,
260 "D%s\r", cntrl->parm.setup.phone);
261 }
262
263 l = strlen(cntrl->parm.setup.eazmsn);
264 if (l) {
265 l += 8;
266 commands[AT_MSN] = kmalloc(l, GFP_ATOMIC);
267 if (!commands[AT_MSN])
268 goto oom;
269 snprintf(commands[AT_MSN], l, "^SMSN=%s\r",
270 cntrl->parm.setup.eazmsn);
271 }
272
273 switch (cntrl->parm.setup.si1) {
274 case 1: /* audio */
275 /* BC = 9090A3: 3.1 kHz audio, A-law */
276 commands[AT_BC] = kstrdup("^SBC=9090A3\r", GFP_ATOMIC);
277 if (!commands[AT_BC])
278 goto oom;
279 break;
280 case 7: /* data */
281 default: /* hope the app knows what it is doing */
282 /* BC = 8890: unrestricted digital information */
283 commands[AT_BC] = kstrdup("^SBC=8890\r", GFP_ATOMIC);
284 if (!commands[AT_BC])
285 goto oom;
286 }
287 /* ToDo: other si1 values, inspect si2, set HLC/LLC */
288
289 commands[AT_PROTO] = kmalloc(9, GFP_ATOMIC);
290 if (!commands[AT_PROTO])
291 goto oom;
292 snprintf(commands[AT_PROTO], 9, "^SBPR=%u\r", bcs->proto2);
293
294 commands[AT_ISO] = kmalloc(9, GFP_ATOMIC);
295 if (!commands[AT_ISO])
296 goto oom;
297 snprintf(commands[AT_ISO], 9, "^SISO=%u\r",
298 (unsigned) bcs->channel + 1);
299
300 if (!gigaset_add_event(cs, &bcs->at_state, EV_DIAL, commands,
301 bcs->at_state.seq_index, NULL)) {
302 for (i = 0; i < AT_NUM; ++i)
303 kfree(commands[i]);
304 kfree(commands);
305 gigaset_free_channel(bcs);
306 return -ENOMEM;
307 }
308 gigaset_schedule_event(cs);
309 break;
310 case ISDN_CMD_ACCEPTD:
311 gig_dbg(DEBUG_CMD, "ISDN_CMD_ACCEPTD");
312 if (ch >= cs->channels) {
313 dev_err(cs->dev,
314 "ISDN_CMD_ACCEPTD: invalid channel (%d)\n", ch);
315 return -EINVAL;
316 }
317 bcs = cs->bcs + ch;
318 if (!gigaset_add_event(cs, &bcs->at_state,
319 EV_ACCEPT, NULL, 0, NULL))
320 return -ENOMEM;
321 gigaset_schedule_event(cs);
322
323 break;
324 case ISDN_CMD_HANGUP:
325 gig_dbg(DEBUG_CMD, "ISDN_CMD_HANGUP");
326 if (ch >= cs->channels) {
327 dev_err(cs->dev,
328 "ISDN_CMD_HANGUP: invalid channel (%d)\n", ch);
329 return -EINVAL;
330 }
331 bcs = cs->bcs + ch;
332 if (!gigaset_add_event(cs, &bcs->at_state,
333 EV_HUP, NULL, 0, NULL))
334 return -ENOMEM;
335 gigaset_schedule_event(cs);
336
337 break;
338 case ISDN_CMD_CLREAZ: /* Do not signal incoming signals */
339 dev_info(cs->dev, "ignoring ISDN_CMD_CLREAZ\n");
340 break;
341 case ISDN_CMD_SETEAZ: /* Signal incoming calls for given MSN */
342 dev_info(cs->dev, "ignoring ISDN_CMD_SETEAZ (%s)\n",
343 cntrl->parm.num);
344 break;
345 case ISDN_CMD_SETL2: /* Set L2 to given protocol */
346 if (ch >= cs->channels) {
347 dev_err(cs->dev,
348 "ISDN_CMD_SETL2: invalid channel (%d)\n", ch);
349 return -EINVAL;
350 }
351 bcs = cs->bcs + ch;
352 if (bcs->chstate & CHS_D_UP) {
353 dev_err(cs->dev,
354 "ISDN_CMD_SETL2: channel active (%d)\n", ch);
355 return -EINVAL;
356 }
357 switch (cntrl->arg >> 8) {
358 case ISDN_PROTO_L2_HDLC:
359 gig_dbg(DEBUG_CMD, "ISDN_CMD_SETL2: setting L2_HDLC");
360 bcs->proto2 = L2_HDLC;
361 break;
362 case ISDN_PROTO_L2_TRANS:
363 gig_dbg(DEBUG_CMD, "ISDN_CMD_SETL2: setting L2_VOICE");
364 bcs->proto2 = L2_VOICE;
365 break;
366 default:
367 dev_err(cs->dev,
368 "ISDN_CMD_SETL2: unsupported protocol (%lu)\n",
369 cntrl->arg >> 8);
370 return -EINVAL;
371 }
372 break;
373 case ISDN_CMD_SETL3: /* Set L3 to given protocol */
374 gig_dbg(DEBUG_CMD, "ISDN_CMD_SETL3");
375 if (ch >= cs->channels) {
376 dev_err(cs->dev,
377 "ISDN_CMD_SETL3: invalid channel (%d)\n", ch);
378 return -EINVAL;
379 }
380
381 if (cntrl->arg >> 8 != ISDN_PROTO_L3_TRANS) {
382 dev_err(cs->dev,
383 "ISDN_CMD_SETL3: unsupported protocol (%lu)\n",
384 cntrl->arg >> 8);
385 return -EINVAL;
386 }
387
388 break;
389
390 default:
391 gig_dbg(DEBUG_CMD, "unknown command %d from LL",
392 cntrl->command);
393 return -EINVAL;
394 }
395
396 return retval;
397
398 oom:
399 dev_err(bcs->cs->dev, "out of memory\n");
400 for (i = 0; i < AT_NUM; ++i)
401 kfree(commands[i]);
402 return -ENOMEM;
403 }
404
405 static void gigaset_i4l_cmd(struct cardstate *cs, int cmd)
406 {
407 isdn_if *iif = cs->iif;
408 isdn_ctrl command;
409
410 command.driver = cs->myid;
411 command.command = cmd;
412 command.arg = 0;
413 iif->statcallb(&command);
414 }
415
416 static void gigaset_i4l_channel_cmd(struct bc_state *bcs, int cmd)
417 {
418 isdn_if *iif = bcs->cs->iif;
419 isdn_ctrl command;
420
421 command.driver = bcs->cs->myid;
422 command.command = cmd;
423 command.arg = bcs->channel;
424 iif->statcallb(&command);
425 }
426
427 /**
428 * gigaset_isdn_icall() - signal incoming call
429 * @at_state: connection state structure.
430 *
431 * Called by main module to notify the LL that an incoming call has been
432 * received. @at_state contains the parameters of the call.
433 *
434 * Return value: call disposition (ICALL_*)
435 */
436 int gigaset_isdn_icall(struct at_state_t *at_state)
437 {
438 struct cardstate *cs = at_state->cs;
439 struct bc_state *bcs = at_state->bcs;
440 isdn_if *iif = cs->iif;
441 isdn_ctrl response;
442 int retval;
443
444 /* fill ICALL structure */
445 response.parm.setup.si1 = 0; /* default: unknown */
446 response.parm.setup.si2 = 0;
447 response.parm.setup.screen = 0;
448 response.parm.setup.plan = 0;
449 if (!at_state->str_var[STR_ZBC]) {
450 /* no BC (internal call): assume speech, A-law */
451 response.parm.setup.si1 = 1;
452 } else if (!strcmp(at_state->str_var[STR_ZBC], "8890")) {
453 /* unrestricted digital information */
454 response.parm.setup.si1 = 7;
455 } else if (!strcmp(at_state->str_var[STR_ZBC], "8090A3")) {
456 /* speech, A-law */
457 response.parm.setup.si1 = 1;
458 } else if (!strcmp(at_state->str_var[STR_ZBC], "9090A3")) {
459 /* 3,1 kHz audio, A-law */
460 response.parm.setup.si1 = 1;
461 response.parm.setup.si2 = 2;
462 } else {
463 dev_warn(cs->dev, "RING ignored - unsupported BC %s\n",
464 at_state->str_var[STR_ZBC]);
465 return ICALL_IGNORE;
466 }
467 if (at_state->str_var[STR_NMBR]) {
468 strlcpy(response.parm.setup.phone, at_state->str_var[STR_NMBR],
469 sizeof response.parm.setup.phone);
470 } else
471 response.parm.setup.phone[0] = 0;
472 if (at_state->str_var[STR_ZCPN]) {
473 strlcpy(response.parm.setup.eazmsn, at_state->str_var[STR_ZCPN],
474 sizeof response.parm.setup.eazmsn);
475 } else
476 response.parm.setup.eazmsn[0] = 0;
477
478 if (!bcs) {
479 dev_notice(cs->dev, "no channel for incoming call\n");
480 response.command = ISDN_STAT_ICALLW;
481 response.arg = 0;
482 } else {
483 gig_dbg(DEBUG_CMD, "Sending ICALL");
484 response.command = ISDN_STAT_ICALL;
485 response.arg = bcs->channel;
486 }
487 response.driver = cs->myid;
488 retval = iif->statcallb(&response);
489 gig_dbg(DEBUG_CMD, "Response: %d", retval);
490 switch (retval) {
491 case 0: /* no takers */
492 return ICALL_IGNORE;
493 case 1: /* alerting */
494 bcs->chstate |= CHS_NOTIFY_LL;
495 return ICALL_ACCEPT;
496 case 2: /* reject */
497 return ICALL_REJECT;
498 case 3: /* incomplete */
499 dev_warn(cs->dev,
500 "LL requested unsupported feature: Incomplete Number\n");
501 return ICALL_IGNORE;
502 case 4: /* proceeding */
503 /* Gigaset will send ALERTING anyway.
504 * There doesn't seem to be a way to avoid this.
505 */
506 return ICALL_ACCEPT;
507 case 5: /* deflect */
508 dev_warn(cs->dev,
509 "LL requested unsupported feature: Call Deflection\n");
510 return ICALL_IGNORE;
511 default:
512 dev_err(cs->dev, "LL error %d on ICALL\n", retval);
513 return ICALL_IGNORE;
514 }
515 }
516
517 /**
518 * gigaset_isdn_connD() - signal D channel connect
519 * @bcs: B channel descriptor structure.
520 *
521 * Called by main module to notify the LL that the D channel connection has
522 * been established.
523 */
524 void gigaset_isdn_connD(struct bc_state *bcs)
525 {
526 gig_dbg(DEBUG_CMD, "sending DCONN");
527 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_DCONN);
528 }
529
530 /**
531 * gigaset_isdn_hupD() - signal D channel hangup
532 * @bcs: B channel descriptor structure.
533 *
534 * Called by main module to notify the LL that the D channel connection has
535 * been shut down.
536 */
537 void gigaset_isdn_hupD(struct bc_state *bcs)
538 {
539 gig_dbg(DEBUG_CMD, "sending DHUP");
540 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_DHUP);
541 }
542
543 /**
544 * gigaset_isdn_connB() - signal B channel connect
545 * @bcs: B channel descriptor structure.
546 *
547 * Called by main module to notify the LL that the B channel connection has
548 * been established.
549 */
550 void gigaset_isdn_connB(struct bc_state *bcs)
551 {
552 gig_dbg(DEBUG_CMD, "sending BCONN");
553 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_BCONN);
554 }
555
556 /**
557 * gigaset_isdn_hupB() - signal B channel hangup
558 * @bcs: B channel descriptor structure.
559 *
560 * Called by main module to notify the LL that the B channel connection has
561 * been shut down.
562 */
563 void gigaset_isdn_hupB(struct bc_state *bcs)
564 {
565 gig_dbg(DEBUG_CMD, "sending BHUP");
566 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_BHUP);
567 }
568
569 /**
570 * gigaset_isdn_start() - signal device availability
571 * @cs: device descriptor structure.
572 *
573 * Called by main module to notify the LL that the device is available for
574 * use.
575 */
576 void gigaset_isdn_start(struct cardstate *cs)
577 {
578 gig_dbg(DEBUG_CMD, "sending RUN");
579 gigaset_i4l_cmd(cs, ISDN_STAT_RUN);
580 }
581
582 /**
583 * gigaset_isdn_stop() - signal device unavailability
584 * @cs: device descriptor structure.
585 *
586 * Called by main module to notify the LL that the device is no longer
587 * available for use.
588 */
589 void gigaset_isdn_stop(struct cardstate *cs)
590 {
591 gig_dbg(DEBUG_CMD, "sending STOP");
592 gigaset_i4l_cmd(cs, ISDN_STAT_STOP);
593 }
594
595 /**
596 * gigaset_isdn_regdev() - register to LL
597 * @cs: device descriptor structure.
598 * @isdnid: device name.
599 *
600 * Return value: 1 for success, 0 for failure
601 */
602 int gigaset_isdn_regdev(struct cardstate *cs, const char *isdnid)
603 {
604 isdn_if *iif;
605
606 pr_info("ISDN4Linux interface\n");
607
608 iif = kmalloc(sizeof *iif, GFP_KERNEL);
609 if (!iif) {
610 pr_err("out of memory\n");
611 return 0;
612 }
613
614 if (snprintf(iif->id, sizeof iif->id, "%s_%u", isdnid, cs->minor_index)
615 >= sizeof iif->id) {
616 pr_err("ID too long: %s\n", isdnid);
617 kfree(iif);
618 return 0;
619 }
620
621 iif->owner = THIS_MODULE;
622 iif->channels = cs->channels;
623 iif->maxbufsize = MAX_BUF_SIZE;
624 iif->features = ISDN_FEATURE_L2_TRANS |
625 ISDN_FEATURE_L2_HDLC |
626 #ifdef GIG_X75
627 ISDN_FEATURE_L2_X75I |
628 #endif
629 ISDN_FEATURE_L3_TRANS |
630 ISDN_FEATURE_P_EURO;
631 iif->hl_hdrlen = HW_HDR_LEN; /* Area for storing ack */
632 iif->command = command_from_LL;
633 iif->writebuf_skb = writebuf_from_LL;
634 iif->writecmd = NULL; /* Don't support isdnctrl */
635 iif->readstat = NULL; /* Don't support isdnctrl */
636 iif->rcvcallb_skb = NULL; /* Will be set by LL */
637 iif->statcallb = NULL; /* Will be set by LL */
638
639 if (!register_isdn(iif)) {
640 pr_err("register_isdn failed\n");
641 kfree(iif);
642 return 0;
643 }
644
645 cs->iif = iif;
646 cs->myid = iif->channels; /* Set my device id */
647 cs->hw_hdr_len = HW_HDR_LEN;
648 return 1;
649 }
650
651 /**
652 * gigaset_isdn_unregdev() - unregister device from LL
653 * @cs: device descriptor structure.
654 */
655 void gigaset_isdn_unregdev(struct cardstate *cs)
656 {
657 gig_dbg(DEBUG_CMD, "sending UNLOAD");
658 gigaset_i4l_cmd(cs, ISDN_STAT_UNLOAD);
659 kfree(cs->iif);
660 cs->iif = NULL;
661 }
662
663 /**
664 * gigaset_isdn_regdrv() - register driver to LL
665 */
666 void gigaset_isdn_regdrv(void)
667 {
668 /* nothing to do */
669 }
670
671 /**
672 * gigaset_isdn_unregdrv() - unregister driver from LL
673 */
674 void gigaset_isdn_unregdrv(void)
675 {
676 /* nothing to do */
677 }