x86_64 irq: use mask/unmask and proper locking in fixup_irqs()
[powerpc.git] / drivers / isdn / gigaset / common.c
index 4f75cce..6df336b 100644 (file)
@@ -640,7 +640,6 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
                return NULL;
        }
        mutex_init(&cs->mutex);
-       mutex_lock(&cs->mutex);
 
        gig_dbg(DEBUG_INIT, "allocating bcs[0..%d]", channels - 1);
        cs->bcs = kmalloc(channels * sizeof(struct bc_state), GFP_KERNEL);
@@ -738,6 +737,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
 
        ++cs->cs_init;
 
+       /* set up character device */
        gigaset_if_init(cs);
 
        /* set up device sysfs */
@@ -753,11 +753,9 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
        add_timer(&cs->timer);
 
        gig_dbg(DEBUG_INIT, "cs initialized");
-       mutex_unlock(&cs->mutex);
        return cs;
 
 error:
-       mutex_unlock(&cs->mutex);
        gig_dbg(DEBUG_INIT, "failed");
        gigaset_freecs(cs);
        return NULL;
@@ -908,20 +906,7 @@ void gigaset_shutdown(struct cardstate *cs)
        gig_dbg(DEBUG_CMD, "scheduling SHUTDOWN");
        gigaset_schedule_event(cs);
 
-       if (wait_event_interruptible(cs->waitqueue, !cs->waiting)) {
-               warn("%s: aborted", __func__);
-               //FIXME
-       }
-
-       if (atomic_read(&cs->mstate) != MS_LOCKED) {
-               //FIXME?
-               //gigaset_baud_rate(cs, B115200);
-               //gigaset_set_line_ctrl(cs, CS8);
-               //gigaset_set_modem_ctrl(cs, TIOCM_DTR|TIOCM_RTS, 0);
-               //cs->control_state = 0;
-       } else {
-               //FIXME use some saved values?
-       }
+       wait_event(cs->waitqueue, !cs->waiting);
 
        cleanup_cs(cs);
 
@@ -944,10 +929,7 @@ void gigaset_stop(struct cardstate *cs)
        gig_dbg(DEBUG_CMD, "scheduling STOP");
        gigaset_schedule_event(cs);
 
-       if (wait_event_interruptible(cs->waitqueue, !cs->waiting)) {
-               warn("%s: aborted", __func__);
-               //FIXME
-       }
+       wait_event(cs->waitqueue, !cs->waiting);
 
        cleanup_cs(cs);
 
@@ -962,8 +944,8 @@ static DEFINE_SPINLOCK(driver_lock);
 struct cardstate *gigaset_get_cs_by_id(int id)
 {
        unsigned long flags;
-       static struct cardstate *ret = NULL;
-       static struct cardstate *cs;
+       struct cardstate *ret = NULL;
+       struct cardstate *cs;
        struct gigaset_driver *drv;
        unsigned i;
 
@@ -1017,7 +999,7 @@ void gigaset_debugdrivers(void)
 static struct cardstate *gigaset_get_cs_by_minor(unsigned minor)
 {
        unsigned long flags;
-       static struct cardstate *ret = NULL;
+       struct cardstate *ret = NULL;
        struct gigaset_driver *drv;
        unsigned index;