Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-mmc
[powerpc.git] / drivers / isdn / gigaset / i4l.c
index cc1d309..1654fa4 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * Stuff used by all variants of the driver
  *
- * Copyright (c) 2001 by Stefan Eilers (Eilers.Stefan@epost.de),
- *                       Hansjoerg Lipp (hjlipp@web.de),
- *                       Tilman Schmidt (tilman@imap.cc).
+ * Copyright (c) 2001 by Stefan Eilers,
+ *                       Hansjoerg Lipp <hjlipp@web.de>,
+ *                       Tilman Schmidt <tilman@imap.cc>.
  *
  * =====================================================================
  *     This program is free software; you can redistribute it and/or
@@ -56,11 +56,6 @@ static int writebuf_from_LL(int driverID, int channel, int ack,
                "Receiving data from LL (id: %d, ch: %d, ack: %d, sz: %d)",
                driverID, channel, ack, len);
 
-       if (!atomic_read(&cs->connected)) {
-               err("%s: disconnected", __func__);
-               return -ENODEV;
-       }
-
        if (!len) {
                if (ack)
                        notice("%s: not ACKing empty packet", __func__);
@@ -119,11 +114,12 @@ static int command_from_LL(isdn_ctrl *cntrl)
        struct bc_state *bcs;
        int retval = 0;
        struct setup_parm *sp;
+       unsigned param;
+       unsigned long flags;
 
        gigaset_debugdrivers();
 
-       //FIXME "remove test for &connected"
-       if ((!cs || !atomic_read(&cs->connected))) {
+       if (!cs) {
                warn("LL tried to access unknown device with nr. %d",
                     cntrl->driver);
                return -ENODEV;
@@ -166,8 +162,11 @@ static int command_from_LL(isdn_ctrl *cntrl)
                }
                *sp = cntrl->parm.setup;
 
-               if (!gigaset_add_event(cs, &bcs->at_state, EV_DIAL, sp,
-                                      atomic_read(&bcs->at_state.seq_index),
+               spin_lock_irqsave(&cs->lock, flags);
+               param = bcs->at_state.seq_index;
+               spin_unlock_irqrestore(&cs->lock, flags);
+
+               if (!gigaset_add_event(cs, &bcs->at_state, EV_DIAL, sp, param,
                                       NULL)) {
                        //FIXME what should we do?
                        kfree(sp);