aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/gigaset/i4l.c
diff options
context:
space:
mode:
authorTilman Schmidt <tilman@imap.cc>2006-04-11 01:55:16 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-11 09:18:50 -0400
commit69049cc87dccb1e6fb54aa25c63033efac805dbd (patch)
tree9db1953a831091335b98f8749865f4c8b410ff9b /drivers/isdn/gigaset/i4l.c
parent27d1ac2ef7d0b9250ca9fd2ef506e12866ce8fdf (diff)
[PATCH] isdn4linux: Siemens Gigaset drivers: make some variables non-atomic
With Hansjoerg Lipp <hjlipp@web.de> Replace some atomic_t variables in the Gigaset drivers by non-atomic ones, using spinlocks instead to assure atomicity, as proposed in discussions on the linux-kernel mailing list. Signed-off-by: Hansjoerg Lipp <hjlipp@web.de> Signed-off-by: Tilman Schmidt <tilman@imap.cc> Cc: Karsten Keil <kkeil@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/isdn/gigaset/i4l.c')
-rw-r--r--drivers/isdn/gigaset/i4l.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c
index 7059b84b96a..0815dbfb829 100644
--- a/drivers/isdn/gigaset/i4l.c
+++ b/drivers/isdn/gigaset/i4l.c
@@ -56,11 +56,6 @@ static int writebuf_from_LL(int driverID, int channel, int ack,
56 "Receiving data from LL (id: %d, ch: %d, ack: %d, sz: %d)", 56 "Receiving data from LL (id: %d, ch: %d, ack: %d, sz: %d)",
57 driverID, channel, ack, len); 57 driverID, channel, ack, len);
58 58
59 if (!atomic_read(&cs->connected)) {
60 err("%s: disconnected", __func__);
61 return -ENODEV;
62 }
63
64 if (!len) { 59 if (!len) {
65 if (ack) 60 if (ack)
66 notice("%s: not ACKing empty packet", __func__); 61 notice("%s: not ACKing empty packet", __func__);
@@ -78,7 +73,7 @@ static int writebuf_from_LL(int driverID, int channel, int ack,
78 len, skblen, (unsigned) skb->head[0], (unsigned) skb->head[1]); 73 len, skblen, (unsigned) skb->head[0], (unsigned) skb->head[1]);
79 74
80 /* pass to device-specific module */ 75 /* pass to device-specific module */
81 return cs->ops->send_skb(bcs, skb); 76 return cs->ops->send_skb(bcs, skb); //FIXME cs->ops->send_skb() must handle !cs->connected correctly
82} 77}
83 78
84void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb) 79void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb)
@@ -119,11 +114,12 @@ static int command_from_LL(isdn_ctrl *cntrl)
119 struct bc_state *bcs; 114 struct bc_state *bcs;
120 int retval = 0; 115 int retval = 0;
121 struct setup_parm *sp; 116 struct setup_parm *sp;
117 unsigned param;
118 unsigned long flags;
122 119
123 gigaset_debugdrivers(); 120 gigaset_debugdrivers();
124 121
125 //FIXME "remove test for &connected" 122 if (!cs) {
126 if ((!cs || !atomic_read(&cs->connected))) {
127 warn("LL tried to access unknown device with nr. %d", 123 warn("LL tried to access unknown device with nr. %d",
128 cntrl->driver); 124 cntrl->driver);
129 return -ENODEV; 125 return -ENODEV;
@@ -166,8 +162,11 @@ static int command_from_LL(isdn_ctrl *cntrl)
166 } 162 }
167 *sp = cntrl->parm.setup; 163 *sp = cntrl->parm.setup;
168 164
169 if (!gigaset_add_event(cs, &bcs->at_state, EV_DIAL, sp, 165 spin_lock_irqsave(&cs->lock, flags);
170 atomic_read(&bcs->at_state.seq_index), 166 param = bcs->at_state.seq_index;
167 spin_unlock_irqrestore(&cs->lock, flags);
168
169 if (!gigaset_add_event(cs, &bcs->at_state, EV_DIAL, sp, param,
171 NULL)) { 170 NULL)) {
172 //FIXME what should we do? 171 //FIXME what should we do?
173 kfree(sp); 172 kfree(sp);