diff options
author | Alan Cox <alan@redhat.com> | 2008-10-13 05:38:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 12:51:40 -0400 |
commit | 5aaa70a80f5bbfcc4d6a1f844bdd1c5d6b445b5f (patch) | |
tree | 8826ff2e11d11ab0070d1ebf0ca8d0b91a9fa586 | |
parent | c26c56c0f40e200e61d1390629c806f6adaffbcc (diff) |
tty: ipw need reworking
This came in via another tree and unfortunately is rather broken on
the tty side. Comment the apparent locking problems for someone who knows
the driver to look at.
Fix the termios and other ioctl handling. The driver was calling the wrong
methods for what it wanted to do but the right ones existed so its a simple
fix up.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/char/pcmcia/ipwireless/tty.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/char/pcmcia/ipwireless/tty.c b/drivers/char/pcmcia/ipwireless/tty.c index 3a23e7694d55..569f2f7743a7 100644 --- a/drivers/char/pcmcia/ipwireless/tty.c +++ b/drivers/char/pcmcia/ipwireless/tty.c | |||
@@ -276,6 +276,7 @@ static int ipw_write_room(struct tty_struct *linux_tty) | |||
276 | struct ipw_tty *tty = linux_tty->driver_data; | 276 | struct ipw_tty *tty = linux_tty->driver_data; |
277 | int room; | 277 | int room; |
278 | 278 | ||
279 | /* FIXME: Exactly how is the tty object locked here .. */ | ||
279 | if (!tty) | 280 | if (!tty) |
280 | return -ENODEV; | 281 | return -ENODEV; |
281 | 282 | ||
@@ -397,6 +398,7 @@ static int set_control_lines(struct ipw_tty *tty, unsigned int set, | |||
397 | static int ipw_tiocmget(struct tty_struct *linux_tty, struct file *file) | 398 | static int ipw_tiocmget(struct tty_struct *linux_tty, struct file *file) |
398 | { | 399 | { |
399 | struct ipw_tty *tty = linux_tty->driver_data; | 400 | struct ipw_tty *tty = linux_tty->driver_data; |
401 | /* FIXME: Exactly how is the tty object locked here .. */ | ||
400 | 402 | ||
401 | if (!tty) | 403 | if (!tty) |
402 | return -ENODEV; | 404 | return -ENODEV; |
@@ -412,6 +414,7 @@ ipw_tiocmset(struct tty_struct *linux_tty, struct file *file, | |||
412 | unsigned int set, unsigned int clear) | 414 | unsigned int set, unsigned int clear) |
413 | { | 415 | { |
414 | struct ipw_tty *tty = linux_tty->driver_data; | 416 | struct ipw_tty *tty = linux_tty->driver_data; |
417 | /* FIXME: Exactly how is the tty object locked here .. */ | ||
415 | 418 | ||
416 | if (!tty) | 419 | if (!tty) |
417 | return -ENODEV; | 420 | return -ENODEV; |
@@ -433,6 +436,8 @@ static int ipw_ioctl(struct tty_struct *linux_tty, struct file *file, | |||
433 | if (!tty->open_count) | 436 | if (!tty->open_count) |
434 | return -EINVAL; | 437 | return -EINVAL; |
435 | 438 | ||
439 | /* FIXME: Exactly how is the tty object locked here .. */ | ||
440 | |||
436 | switch (cmd) { | 441 | switch (cmd) { |
437 | case TIOCGSERIAL: | 442 | case TIOCGSERIAL: |
438 | return ipwireless_get_serial_info(tty, (void __user *) arg); | 443 | return ipwireless_get_serial_info(tty, (void __user *) arg); |
@@ -467,13 +472,6 @@ static int ipw_ioctl(struct tty_struct *linux_tty, struct file *file, | |||
467 | } | 472 | } |
468 | return 0; | 473 | return 0; |
469 | 474 | ||
470 | case TCGETS: | ||
471 | case TCGETA: | ||
472 | return n_tty_ioctl(linux_tty, file, cmd, arg); | ||
473 | |||
474 | case TCFLSH: | ||
475 | return n_tty_ioctl(linux_tty, file, cmd, arg); | ||
476 | |||
477 | case FIONREAD: | 475 | case FIONREAD: |
478 | { | 476 | { |
479 | int val = 0; | 477 | int val = 0; |
@@ -482,10 +480,11 @@ static int ipw_ioctl(struct tty_struct *linux_tty, struct file *file, | |||
482 | return -EFAULT; | 480 | return -EFAULT; |
483 | } | 481 | } |
484 | return 0; | 482 | return 0; |
483 | case TCFLSH: | ||
484 | return tty_perform_flush(linux_tty, arg); | ||
485 | } | 485 | } |
486 | } | 486 | } |
487 | 487 | return tty_mode_ioctl(linux_tty, file, cmd , arg); | |
488 | return -ENOIOCTLCMD; | ||
489 | } | 488 | } |
490 | 489 | ||
491 | static int add_tty(dev_node_t *nodesp, int j, | 490 | static int add_tty(dev_node_t *nodesp, int j, |
@@ -588,6 +587,8 @@ void ipwireless_tty_free(struct ipw_tty *tty) | |||
588 | tty_hangup(ttyj->linux_tty); | 587 | tty_hangup(ttyj->linux_tty); |
589 | /* Wait till the tty_hangup has completed */ | 588 | /* Wait till the tty_hangup has completed */ |
590 | flush_scheduled_work(); | 589 | flush_scheduled_work(); |
590 | /* FIXME: Exactly how is the tty object locked here | ||
591 | against a parallel ioctl etc */ | ||
591 | mutex_lock(&ttyj->ipw_tty_mutex); | 592 | mutex_lock(&ttyj->ipw_tty_mutex); |
592 | } | 593 | } |
593 | while (ttyj->open_count) | 594 | while (ttyj->open_count) |