aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/gigaset/interface.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/interface.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/interface.c')
-rw-r--r--drivers/isdn/gigaset/interface.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index ac408acaaf17..08e4c4eea14d 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -33,7 +33,7 @@ static int if_lock(struct cardstate *cs, int *arg)
33 } 33 }
34 34
35 if (!cmd && atomic_read(&cs->mstate) == MS_LOCKED 35 if (!cmd && atomic_read(&cs->mstate) == MS_LOCKED
36 && atomic_read(&cs->connected)) { 36 && cs->connected) {
37 cs->ops->set_modem_ctrl(cs, 0, TIOCM_DTR|TIOCM_RTS); 37 cs->ops->set_modem_ctrl(cs, 0, TIOCM_DTR|TIOCM_RTS);
38 cs->ops->baud_rate(cs, B115200); 38 cs->ops->baud_rate(cs, B115200);
39 cs->ops->set_line_ctrl(cs, CS8); 39 cs->ops->set_line_ctrl(cs, CS8);
@@ -107,6 +107,11 @@ static int if_config(struct cardstate *cs, int *arg)
107 if (atomic_read(&cs->mstate) != MS_LOCKED) 107 if (atomic_read(&cs->mstate) != MS_LOCKED)
108 return -EBUSY; 108 return -EBUSY;
109 109
110 if (!cs->connected) {
111 err("not connected!");
112 return -ENODEV;
113 }
114
110 *arg = 0; 115 *arg = 0;
111 return gigaset_enterconfigmode(cs); 116 return gigaset_enterconfigmode(cs);
112} 117}
@@ -246,7 +251,7 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,
246 break; 251 break;
247 case GIGASET_BRKCHARS: 252 case GIGASET_BRKCHARS:
248 //FIXME test if MS_LOCKED 253 //FIXME test if MS_LOCKED
249 if (!atomic_read(&cs->connected)) { 254 if (!cs->connected) {
250 gig_dbg(DEBUG_ANY, 255 gig_dbg(DEBUG_ANY,
251 "can't communicate with unplugged device"); 256 "can't communicate with unplugged device");
252 retval = -ENODEV; 257 retval = -ENODEV;
@@ -327,7 +332,7 @@ static int if_tiocmset(struct tty_struct *tty, struct file *file,
327 if (mutex_lock_interruptible(&cs->mutex)) 332 if (mutex_lock_interruptible(&cs->mutex))
328 return -ERESTARTSYS; // FIXME -EINTR? 333 return -ERESTARTSYS; // FIXME -EINTR?
329 334
330 if (!atomic_read(&cs->connected)) { 335 if (!cs->connected) {
331 gig_dbg(DEBUG_ANY, "can't communicate with unplugged device"); 336 gig_dbg(DEBUG_ANY, "can't communicate with unplugged device");
332 retval = -ENODEV; 337 retval = -ENODEV;
333 } else { 338 } else {
@@ -362,7 +367,7 @@ static int if_write(struct tty_struct *tty, const unsigned char *buf, int count)
362 else if (atomic_read(&cs->mstate) != MS_LOCKED) { 367 else if (atomic_read(&cs->mstate) != MS_LOCKED) {
363 warn("can't write to unlocked device"); 368 warn("can't write to unlocked device");
364 retval = -EBUSY; 369 retval = -EBUSY;
365 } else if (!atomic_read(&cs->connected)) { 370 } else if (!cs->connected) {
366 gig_dbg(DEBUG_ANY, "can't write to unplugged device"); 371 gig_dbg(DEBUG_ANY, "can't write to unplugged device");
367 retval = -EBUSY; //FIXME 372 retval = -EBUSY; //FIXME
368 } else { 373 } else {
@@ -396,7 +401,7 @@ static int if_write_room(struct tty_struct *tty)
396 else if (atomic_read(&cs->mstate) != MS_LOCKED) { 401 else if (atomic_read(&cs->mstate) != MS_LOCKED) {
397 warn("can't write to unlocked device"); 402 warn("can't write to unlocked device");
398 retval = -EBUSY; //FIXME 403 retval = -EBUSY; //FIXME
399 } else if (!atomic_read(&cs->connected)) { 404 } else if (!cs->connected) {
400 gig_dbg(DEBUG_ANY, "can't write to unplugged device"); 405 gig_dbg(DEBUG_ANY, "can't write to unplugged device");
401 retval = -EBUSY; //FIXME 406 retval = -EBUSY; //FIXME
402 } else 407 } else
@@ -428,7 +433,7 @@ static int if_chars_in_buffer(struct tty_struct *tty)
428 else if (atomic_read(&cs->mstate) != MS_LOCKED) { 433 else if (atomic_read(&cs->mstate) != MS_LOCKED) {
429 warn("can't write to unlocked device"); 434 warn("can't write to unlocked device");
430 retval = -EBUSY; 435 retval = -EBUSY;
431 } else if (!atomic_read(&cs->connected)) { 436 } else if (!cs->connected) {
432 gig_dbg(DEBUG_ANY, "can't write to unplugged device"); 437 gig_dbg(DEBUG_ANY, "can't write to unplugged device");
433 retval = -EBUSY; //FIXME 438 retval = -EBUSY; //FIXME
434 } else 439 } else
@@ -508,7 +513,7 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old)
508 goto out; 513 goto out;
509 } 514 }
510 515
511 if (!atomic_read(&cs->connected)) { 516 if (!cs->connected) {
512 gig_dbg(DEBUG_ANY, "can't communicate with unplugged device"); 517 gig_dbg(DEBUG_ANY, "can't communicate with unplugged device");
513 goto out; 518 goto out;
514 } 519 }