aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/gigaset/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/gigaset/common.c')
-rw-r--r--drivers/isdn/gigaset/common.c175
1 files changed, 91 insertions, 84 deletions
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index 33dcd8d72b7c..f6f45f221920 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -14,7 +14,6 @@
14 */ 14 */
15 15
16#include "gigaset.h" 16#include "gigaset.h"
17#include <linux/ctype.h>
18#include <linux/module.h> 17#include <linux/module.h>
19#include <linux/moduleparam.h> 18#include <linux/moduleparam.h>
20 19
@@ -29,7 +28,7 @@
29#endif 28#endif
30 29
31/* Module parameters */ 30/* Module parameters */
32int gigaset_debuglevel = DEBUG_DEFAULT; 31int gigaset_debuglevel;
33EXPORT_SYMBOL_GPL(gigaset_debuglevel); 32EXPORT_SYMBOL_GPL(gigaset_debuglevel);
34module_param_named(debug, gigaset_debuglevel, int, S_IRUGO|S_IWUSR); 33module_param_named(debug, gigaset_debuglevel, int, S_IRUGO|S_IWUSR);
35MODULE_PARM_DESC(debug, "debug level"); 34MODULE_PARM_DESC(debug, "debug level");
@@ -108,7 +107,7 @@ int gigaset_enterconfigmode(struct cardstate *cs)
108{ 107{
109 int i, r; 108 int i, r;
110 109
111 cs->control_state = TIOCM_RTS; //FIXME 110 cs->control_state = TIOCM_RTS;
112 111
113 r = setflags(cs, TIOCM_DTR, 200); 112 r = setflags(cs, TIOCM_DTR, 200);
114 if (r < 0) 113 if (r < 0)
@@ -132,10 +131,10 @@ int gigaset_enterconfigmode(struct cardstate *cs)
132 131
133error: 132error:
134 dev_err(cs->dev, "error %d on setuartbits\n", -r); 133 dev_err(cs->dev, "error %d on setuartbits\n", -r);
135 cs->control_state = TIOCM_RTS|TIOCM_DTR; // FIXME is this a good value? 134 cs->control_state = TIOCM_RTS|TIOCM_DTR;
136 cs->ops->set_modem_ctrl(cs, 0, TIOCM_RTS|TIOCM_DTR); 135 cs->ops->set_modem_ctrl(cs, 0, TIOCM_RTS|TIOCM_DTR);
137 136
138 return -1; //r 137 return -1;
139} 138}
140 139
141static int test_timeout(struct at_state_t *at_state) 140static int test_timeout(struct at_state_t *at_state)
@@ -149,11 +148,8 @@ static int test_timeout(struct at_state_t *at_state)
149 return 0; 148 return 0;
150 } 149 }
151 150
152 if (!gigaset_add_event(at_state->cs, at_state, EV_TIMEOUT, NULL, 151 gigaset_add_event(at_state->cs, at_state, EV_TIMEOUT, NULL,
153 at_state->timer_index, NULL)) { 152 at_state->timer_index, NULL);
154 //FIXME what should we do?
155 }
156
157 return 1; 153 return 1;
158} 154}
159 155
@@ -181,7 +177,7 @@ static void timer_tick(unsigned long data)
181 if (cs->running) { 177 if (cs->running) {
182 mod_timer(&cs->timer, jiffies + msecs_to_jiffies(GIG_TICK)); 178 mod_timer(&cs->timer, jiffies + msecs_to_jiffies(GIG_TICK));
183 if (timeout) { 179 if (timeout) {
184 gig_dbg(DEBUG_CMD, "scheduling timeout"); 180 gig_dbg(DEBUG_EVENT, "scheduling timeout");
185 tasklet_schedule(&cs->event_tasklet); 181 tasklet_schedule(&cs->event_tasklet);
186 } 182 }
187 } 183 }
@@ -195,32 +191,59 @@ int gigaset_get_channel(struct bc_state *bcs)
195 191
196 spin_lock_irqsave(&bcs->cs->lock, flags); 192 spin_lock_irqsave(&bcs->cs->lock, flags);
197 if (bcs->use_count || !try_module_get(bcs->cs->driver->owner)) { 193 if (bcs->use_count || !try_module_get(bcs->cs->driver->owner)) {
198 gig_dbg(DEBUG_ANY, "could not allocate channel %d", 194 gig_dbg(DEBUG_CHANNEL, "could not allocate channel %d",
199 bcs->channel); 195 bcs->channel);
200 spin_unlock_irqrestore(&bcs->cs->lock, flags); 196 spin_unlock_irqrestore(&bcs->cs->lock, flags);
201 return 0; 197 return 0;
202 } 198 }
203 ++bcs->use_count; 199 ++bcs->use_count;
204 bcs->busy = 1; 200 bcs->busy = 1;
205 gig_dbg(DEBUG_ANY, "allocated channel %d", bcs->channel); 201 gig_dbg(DEBUG_CHANNEL, "allocated channel %d", bcs->channel);
206 spin_unlock_irqrestore(&bcs->cs->lock, flags); 202 spin_unlock_irqrestore(&bcs->cs->lock, flags);
207 return 1; 203 return 1;
208} 204}
209 205
206struct bc_state *gigaset_get_free_channel(struct cardstate *cs)
207{
208 unsigned long flags;
209 int i;
210
211 spin_lock_irqsave(&cs->lock, flags);
212 if (!try_module_get(cs->driver->owner)) {
213 gig_dbg(DEBUG_CHANNEL,
214 "could not get module for allocating channel");
215 spin_unlock_irqrestore(&cs->lock, flags);
216 return NULL;
217 }
218 for (i = 0; i < cs->channels; ++i)
219 if (!cs->bcs[i].use_count) {
220 ++cs->bcs[i].use_count;
221 cs->bcs[i].busy = 1;
222 spin_unlock_irqrestore(&cs->lock, flags);
223 gig_dbg(DEBUG_CHANNEL, "allocated channel %d", i);
224 return cs->bcs + i;
225 }
226 module_put(cs->driver->owner);
227 spin_unlock_irqrestore(&cs->lock, flags);
228 gig_dbg(DEBUG_CHANNEL, "no free channel");
229 return NULL;
230}
231
210void gigaset_free_channel(struct bc_state *bcs) 232void gigaset_free_channel(struct bc_state *bcs)
211{ 233{
212 unsigned long flags; 234 unsigned long flags;
213 235
214 spin_lock_irqsave(&bcs->cs->lock, flags); 236 spin_lock_irqsave(&bcs->cs->lock, flags);
215 if (!bcs->busy) { 237 if (!bcs->busy) {
216 gig_dbg(DEBUG_ANY, "could not free channel %d", bcs->channel); 238 gig_dbg(DEBUG_CHANNEL, "could not free channel %d",
239 bcs->channel);
217 spin_unlock_irqrestore(&bcs->cs->lock, flags); 240 spin_unlock_irqrestore(&bcs->cs->lock, flags);
218 return; 241 return;
219 } 242 }
220 --bcs->use_count; 243 --bcs->use_count;
221 bcs->busy = 0; 244 bcs->busy = 0;
222 module_put(bcs->cs->driver->owner); 245 module_put(bcs->cs->driver->owner);
223 gig_dbg(DEBUG_ANY, "freed channel %d", bcs->channel); 246 gig_dbg(DEBUG_CHANNEL, "freed channel %d", bcs->channel);
224 spin_unlock_irqrestore(&bcs->cs->lock, flags); 247 spin_unlock_irqrestore(&bcs->cs->lock, flags);
225} 248}
226 249
@@ -233,14 +256,15 @@ int gigaset_get_channels(struct cardstate *cs)
233 for (i = 0; i < cs->channels; ++i) 256 for (i = 0; i < cs->channels; ++i)
234 if (cs->bcs[i].use_count) { 257 if (cs->bcs[i].use_count) {
235 spin_unlock_irqrestore(&cs->lock, flags); 258 spin_unlock_irqrestore(&cs->lock, flags);
236 gig_dbg(DEBUG_ANY, "could not allocate all channels"); 259 gig_dbg(DEBUG_CHANNEL,
260 "could not allocate all channels");
237 return 0; 261 return 0;
238 } 262 }
239 for (i = 0; i < cs->channels; ++i) 263 for (i = 0; i < cs->channels; ++i)
240 ++cs->bcs[i].use_count; 264 ++cs->bcs[i].use_count;
241 spin_unlock_irqrestore(&cs->lock, flags); 265 spin_unlock_irqrestore(&cs->lock, flags);
242 266
243 gig_dbg(DEBUG_ANY, "allocated all channels"); 267 gig_dbg(DEBUG_CHANNEL, "allocated all channels");
244 268
245 return 1; 269 return 1;
246} 270}
@@ -250,7 +274,7 @@ void gigaset_free_channels(struct cardstate *cs)
250 unsigned long flags; 274 unsigned long flags;
251 int i; 275 int i;
252 276
253 gig_dbg(DEBUG_ANY, "unblocking all channels"); 277 gig_dbg(DEBUG_CHANNEL, "unblocking all channels");
254 spin_lock_irqsave(&cs->lock, flags); 278 spin_lock_irqsave(&cs->lock, flags);
255 for (i = 0; i < cs->channels; ++i) 279 for (i = 0; i < cs->channels; ++i)
256 --cs->bcs[i].use_count; 280 --cs->bcs[i].use_count;
@@ -262,7 +286,7 @@ void gigaset_block_channels(struct cardstate *cs)
262 unsigned long flags; 286 unsigned long flags;
263 int i; 287 int i;
264 288
265 gig_dbg(DEBUG_ANY, "blocking all channels"); 289 gig_dbg(DEBUG_CHANNEL, "blocking all channels");
266 spin_lock_irqsave(&cs->lock, flags); 290 spin_lock_irqsave(&cs->lock, flags);
267 for (i = 0; i < cs->channels; ++i) 291 for (i = 0; i < cs->channels; ++i)
268 ++cs->bcs[i].use_count; 292 ++cs->bcs[i].use_count;
@@ -313,6 +337,8 @@ struct event_t *gigaset_add_event(struct cardstate *cs,
313 unsigned next, tail; 337 unsigned next, tail;
314 struct event_t *event = NULL; 338 struct event_t *event = NULL;
315 339
340 gig_dbg(DEBUG_EVENT, "queueing event %d", type);
341
316 spin_lock_irqsave(&cs->ev_lock, flags); 342 spin_lock_irqsave(&cs->ev_lock, flags);
317 343
318 tail = cs->ev_tail; 344 tail = cs->ev_tail;
@@ -367,16 +393,15 @@ static void gigaset_freebcs(struct bc_state *bcs)
367 int i; 393 int i;
368 394
369 gig_dbg(DEBUG_INIT, "freeing bcs[%d]->hw", bcs->channel); 395 gig_dbg(DEBUG_INIT, "freeing bcs[%d]->hw", bcs->channel);
370 if (!bcs->cs->ops->freebcshw(bcs)) { 396 if (!bcs->cs->ops->freebcshw(bcs))
371 gig_dbg(DEBUG_INIT, "failed"); 397 gig_dbg(DEBUG_INIT, "failed");
372 }
373 398
374 gig_dbg(DEBUG_INIT, "clearing bcs[%d]->at_state", bcs->channel); 399 gig_dbg(DEBUG_INIT, "clearing bcs[%d]->at_state", bcs->channel);
375 clear_at_state(&bcs->at_state); 400 clear_at_state(&bcs->at_state);
376 gig_dbg(DEBUG_INIT, "freeing bcs[%d]->skb", bcs->channel); 401 gig_dbg(DEBUG_INIT, "freeing bcs[%d]->skb", bcs->channel);
402 dev_kfree_skb(bcs->skb);
403 bcs->skb = NULL;
377 404
378 if (bcs->skb)
379 dev_kfree_skb(bcs->skb);
380 for (i = 0; i < AT_NUM; ++i) { 405 for (i = 0; i < AT_NUM; ++i) {
381 kfree(bcs->commands[i]); 406 kfree(bcs->commands[i]);
382 bcs->commands[i] = NULL; 407 bcs->commands[i] = NULL;
@@ -463,6 +488,12 @@ void gigaset_freecs(struct cardstate *cs)
463 488
464 switch (cs->cs_init) { 489 switch (cs->cs_init) {
465 default: 490 default:
491 /* clear B channel structures */
492 for (i = 0; i < cs->channels; ++i) {
493 gig_dbg(DEBUG_INIT, "clearing bcs[%d]", i);
494 gigaset_freebcs(cs->bcs + i);
495 }
496
466 /* clear device sysfs */ 497 /* clear device sysfs */
467 gigaset_free_dev_sysfs(cs); 498 gigaset_free_dev_sysfs(cs);
468 499
@@ -471,28 +502,20 @@ void gigaset_freecs(struct cardstate *cs)
471 gig_dbg(DEBUG_INIT, "clearing hw"); 502 gig_dbg(DEBUG_INIT, "clearing hw");
472 cs->ops->freecshw(cs); 503 cs->ops->freecshw(cs);
473 504
474 //FIXME cmdbuf
475
476 /* fall through */ 505 /* fall through */
477 case 2: /* error in initcshw */ 506 case 2: /* error in initcshw */
478 /* Deregister from LL */ 507 /* Deregister from LL */
479 make_invalid(cs, VALID_ID); 508 make_invalid(cs, VALID_ID);
480 gig_dbg(DEBUG_INIT, "clearing iif"); 509 gigaset_isdn_unregdev(cs);
481 gigaset_i4l_cmd(cs, ISDN_STAT_UNLOAD);
482 510
483 /* fall through */ 511 /* fall through */
484 case 1: /* error when regestering to LL */ 512 case 1: /* error when registering to LL */
485 gig_dbg(DEBUG_INIT, "clearing at_state"); 513 gig_dbg(DEBUG_INIT, "clearing at_state");
486 clear_at_state(&cs->at_state); 514 clear_at_state(&cs->at_state);
487 dealloc_at_states(cs); 515 dealloc_at_states(cs);
488 516
489 /* fall through */ 517 /* fall through */
490 case 0: /* error in one call to initbcs */ 518 case 0: /* error in basic setup */
491 for (i = 0; i < cs->channels; ++i) {
492 gig_dbg(DEBUG_INIT, "clearing bcs[%d]", i);
493 gigaset_freebcs(cs->bcs + i);
494 }
495
496 clear_events(cs); 519 clear_events(cs);
497 gig_dbg(DEBUG_INIT, "freeing inbuf"); 520 gig_dbg(DEBUG_INIT, "freeing inbuf");
498 kfree(cs->inbuf); 521 kfree(cs->inbuf);
@@ -534,16 +557,13 @@ void gigaset_at_init(struct at_state_t *at_state, struct bc_state *bcs,
534} 557}
535 558
536 559
537static void gigaset_inbuf_init(struct inbuf_t *inbuf, struct bc_state *bcs, 560static void gigaset_inbuf_init(struct inbuf_t *inbuf, struct cardstate *cs)
538 struct cardstate *cs, int inputstate)
539/* inbuf->read must be allocated before! */ 561/* inbuf->read must be allocated before! */
540{ 562{
541 inbuf->head = 0; 563 inbuf->head = 0;
542 inbuf->tail = 0; 564 inbuf->tail = 0;
543 inbuf->cs = cs; 565 inbuf->cs = cs;
544 inbuf->bcs = bcs; /*base driver: NULL*/ 566 inbuf->inputstate = INS_command;
545 inbuf->rcvbuf = NULL;
546 inbuf->inputstate = inputstate;
547} 567}
548 568
549/** 569/**
@@ -599,7 +619,7 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
599{ 619{
600 int i; 620 int i;
601 621
602 bcs->tx_skb = NULL; //FIXME -> hw part 622 bcs->tx_skb = NULL;
603 623
604 skb_queue_head_init(&bcs->squeue); 624 skb_queue_head_init(&bcs->squeue);
605 625
@@ -618,13 +638,13 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
618 bcs->fcs = PPP_INITFCS; 638 bcs->fcs = PPP_INITFCS;
619 bcs->inputstate = 0; 639 bcs->inputstate = 0;
620 if (cs->ignoreframes) { 640 if (cs->ignoreframes) {
621 bcs->inputstate |= INS_skip_frame;
622 bcs->skb = NULL; 641 bcs->skb = NULL;
623 } else if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL) 642 } else {
624 skb_reserve(bcs->skb, HW_HDR_LEN); 643 bcs->skb = dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len);
625 else { 644 if (bcs->skb != NULL)
626 pr_err("out of memory\n"); 645 skb_reserve(bcs->skb, cs->hw_hdr_len);
627 bcs->inputstate |= INS_skip_frame; 646 else
647 pr_err("out of memory\n");
628 } 648 }
629 649
630 bcs->channel = channel; 650 bcs->channel = channel;
@@ -645,8 +665,8 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
645 gig_dbg(DEBUG_INIT, " failed"); 665 gig_dbg(DEBUG_INIT, " failed");
646 666
647 gig_dbg(DEBUG_INIT, " freeing bcs[%d]->skb", channel); 667 gig_dbg(DEBUG_INIT, " freeing bcs[%d]->skb", channel);
648 if (bcs->skb) 668 dev_kfree_skb(bcs->skb);
649 dev_kfree_skb(bcs->skb); 669 bcs->skb = NULL;
650 670
651 return NULL; 671 return NULL;
652} 672}
@@ -673,12 +693,13 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
673 int onechannel, int ignoreframes, 693 int onechannel, int ignoreframes,
674 int cidmode, const char *modulename) 694 int cidmode, const char *modulename)
675{ 695{
676 struct cardstate *cs = NULL; 696 struct cardstate *cs;
677 unsigned long flags; 697 unsigned long flags;
678 int i; 698 int i;
679 699
680 gig_dbg(DEBUG_INIT, "allocating cs"); 700 gig_dbg(DEBUG_INIT, "allocating cs");
681 if (!(cs = alloc_cs(drv))) { 701 cs = alloc_cs(drv);
702 if (!cs) {
682 pr_err("maximum number of devices exceeded\n"); 703 pr_err("maximum number of devices exceeded\n");
683 return NULL; 704 return NULL;
684 } 705 }
@@ -707,7 +728,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
707 cs->ev_tail = 0; 728 cs->ev_tail = 0;
708 cs->ev_head = 0; 729 cs->ev_head = 0;
709 730
710 tasklet_init(&cs->event_tasklet, &gigaset_handle_event, 731 tasklet_init(&cs->event_tasklet, gigaset_handle_event,
711 (unsigned long) cs); 732 (unsigned long) cs);
712 cs->commands_pending = 0; 733 cs->commands_pending = 0;
713 cs->cur_at_seq = 0; 734 cs->cur_at_seq = 0;
@@ -726,14 +747,6 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
726 cs->mode = M_UNKNOWN; 747 cs->mode = M_UNKNOWN;
727 cs->mstate = MS_UNINITIALIZED; 748 cs->mstate = MS_UNINITIALIZED;
728 749
729 for (i = 0; i < channels; ++i) {
730 gig_dbg(DEBUG_INIT, "setting up bcs[%d].read", i);
731 if (!gigaset_initbcs(cs->bcs + i, cs, i)) {
732 pr_err("could not allocate channel %d data\n", i);
733 goto error;
734 }
735 }
736
737 ++cs->cs_init; 750 ++cs->cs_init;
738 751
739 gig_dbg(DEBUG_INIT, "setting up at_state"); 752 gig_dbg(DEBUG_INIT, "setting up at_state");
@@ -743,10 +756,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
743 cs->cbytes = 0; 756 cs->cbytes = 0;
744 757
745 gig_dbg(DEBUG_INIT, "setting up inbuf"); 758 gig_dbg(DEBUG_INIT, "setting up inbuf");
746 if (onechannel) { //FIXME distinction necessary? 759 gigaset_inbuf_init(cs->inbuf, cs);
747 gigaset_inbuf_init(cs->inbuf, cs->bcs, cs, INS_command);
748 } else
749 gigaset_inbuf_init(cs->inbuf, NULL, cs, INS_command);
750 760
751 cs->connected = 0; 761 cs->connected = 0;
752 cs->isdn_up = 0; 762 cs->isdn_up = 0;
@@ -758,7 +768,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
758 cs->cmdbytes = 0; 768 cs->cmdbytes = 0;
759 769
760 gig_dbg(DEBUG_INIT, "setting up iif"); 770 gig_dbg(DEBUG_INIT, "setting up iif");
761 if (!gigaset_register_to_LL(cs, modulename)) { 771 if (!gigaset_isdn_regdev(cs, modulename)) {
762 pr_err("error registering ISDN device\n"); 772 pr_err("error registering ISDN device\n");
763 goto error; 773 goto error;
764 } 774 }
@@ -777,6 +787,15 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
777 /* set up device sysfs */ 787 /* set up device sysfs */
778 gigaset_init_dev_sysfs(cs); 788 gigaset_init_dev_sysfs(cs);
779 789
790 /* set up channel data structures */
791 for (i = 0; i < channels; ++i) {
792 gig_dbg(DEBUG_INIT, "setting up bcs[%d]", i);
793 if (!gigaset_initbcs(cs->bcs + i, cs, i)) {
794 pr_err("could not allocate channel %d data\n", i);
795 goto error;
796 }
797 }
798
780 spin_lock_irqsave(&cs->lock, flags); 799 spin_lock_irqsave(&cs->lock, flags);
781 cs->running = 1; 800 cs->running = 1;
782 spin_unlock_irqrestore(&cs->lock, flags); 801 spin_unlock_irqrestore(&cs->lock, flags);
@@ -824,9 +843,10 @@ void gigaset_bcs_reinit(struct bc_state *bcs)
824 bcs->chstate = 0; 843 bcs->chstate = 0;
825 844
826 bcs->ignore = cs->ignoreframes; 845 bcs->ignore = cs->ignoreframes;
827 if (bcs->ignore) 846 if (bcs->ignore) {
828 bcs->inputstate |= INS_skip_frame; 847 dev_kfree_skb(bcs->skb);
829 848 bcs->skb = NULL;
849 }
830 850
831 cs->ops->reinitbcshw(bcs); 851 cs->ops->reinitbcshw(bcs);
832} 852}
@@ -847,8 +867,6 @@ static void cleanup_cs(struct cardstate *cs)
847 free_strings(&cs->at_state); 867 free_strings(&cs->at_state);
848 gigaset_at_init(&cs->at_state, NULL, cs, 0); 868 gigaset_at_init(&cs->at_state, NULL, cs, 0);
849 869
850 kfree(cs->inbuf->rcvbuf);
851 cs->inbuf->rcvbuf = NULL;
852 cs->inbuf->inputstate = INS_command; 870 cs->inbuf->inputstate = INS_command;
853 cs->inbuf->head = 0; 871 cs->inbuf->head = 0;
854 cs->inbuf->tail = 0; 872 cs->inbuf->tail = 0;
@@ -911,19 +929,14 @@ int gigaset_start(struct cardstate *cs)
911 cs->ops->baud_rate(cs, B115200); 929 cs->ops->baud_rate(cs, B115200);
912 cs->ops->set_line_ctrl(cs, CS8); 930 cs->ops->set_line_ctrl(cs, CS8);
913 cs->control_state = TIOCM_DTR|TIOCM_RTS; 931 cs->control_state = TIOCM_DTR|TIOCM_RTS;
914 } else {
915 //FIXME use some saved values?
916 } 932 }
917 933
918 cs->waiting = 1; 934 cs->waiting = 1;
919 935
920 if (!gigaset_add_event(cs, &cs->at_state, EV_START, NULL, 0, NULL)) { 936 if (!gigaset_add_event(cs, &cs->at_state, EV_START, NULL, 0, NULL)) {
921 cs->waiting = 0; 937 cs->waiting = 0;
922 //FIXME what should we do?
923 goto error; 938 goto error;
924 } 939 }
925
926 gig_dbg(DEBUG_CMD, "scheduling START");
927 gigaset_schedule_event(cs); 940 gigaset_schedule_event(cs);
928 941
929 wait_event(cs->waitqueue, !cs->waiting); 942 wait_event(cs->waitqueue, !cs->waiting);
@@ -958,12 +971,8 @@ int gigaset_shutdown(struct cardstate *cs)
958 971
959 cs->waiting = 1; 972 cs->waiting = 1;
960 973
961 if (!gigaset_add_event(cs, &cs->at_state, EV_SHUTDOWN, NULL, 0, NULL)) { 974 if (!gigaset_add_event(cs, &cs->at_state, EV_SHUTDOWN, NULL, 0, NULL))
962 //FIXME what should we do?
963 goto exit; 975 goto exit;
964 }
965
966 gig_dbg(DEBUG_CMD, "scheduling SHUTDOWN");
967 gigaset_schedule_event(cs); 976 gigaset_schedule_event(cs);
968 977
969 wait_event(cs->waitqueue, !cs->waiting); 978 wait_event(cs->waitqueue, !cs->waiting);
@@ -989,12 +998,8 @@ void gigaset_stop(struct cardstate *cs)
989 998
990 cs->waiting = 1; 999 cs->waiting = 1;
991 1000
992 if (!gigaset_add_event(cs, &cs->at_state, EV_STOP, NULL, 0, NULL)) { 1001 if (!gigaset_add_event(cs, &cs->at_state, EV_STOP, NULL, 0, NULL))
993 //FIXME what should we do?
994 goto exit; 1002 goto exit;
995 }
996
997 gig_dbg(DEBUG_CMD, "scheduling STOP");
998 gigaset_schedule_event(cs); 1003 gigaset_schedule_event(cs);
999 1004
1000 wait_event(cs->waitqueue, !cs->waiting); 1005 wait_event(cs->waitqueue, !cs->waiting);
@@ -1199,11 +1204,13 @@ static int __init gigaset_init_module(void)
1199 gigaset_debuglevel = DEBUG_DEFAULT; 1204 gigaset_debuglevel = DEBUG_DEFAULT;
1200 1205
1201 pr_info(DRIVER_DESC DRIVER_DESC_DEBUG "\n"); 1206 pr_info(DRIVER_DESC DRIVER_DESC_DEBUG "\n");
1207 gigaset_isdn_regdrv();
1202 return 0; 1208 return 0;
1203} 1209}
1204 1210
1205static void __exit gigaset_exit_module(void) 1211static void __exit gigaset_exit_module(void)
1206{ 1212{
1213 gigaset_isdn_unregdrv();
1207} 1214}
1208 1215
1209module_init(gigaset_init_module); 1216module_init(gigaset_init_module);