Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alan Cox and committed by
Linus Torvalds
5aaa70a8 c26c56c0

+10 -9
+10 -9
drivers/char/pcmcia/ipwireless/tty.c
··· 276 276 struct ipw_tty *tty = linux_tty->driver_data; 277 277 int room; 278 278 279 + /* FIXME: Exactly how is the tty object locked here .. */ 279 280 if (!tty) 280 281 return -ENODEV; 281 282 ··· 398 397 static int ipw_tiocmget(struct tty_struct *linux_tty, struct file *file) 399 398 { 400 399 struct ipw_tty *tty = linux_tty->driver_data; 400 + /* FIXME: Exactly how is the tty object locked here .. */ 401 401 402 402 if (!tty) 403 403 return -ENODEV; ··· 414 412 unsigned int set, unsigned int clear) 415 413 { 416 414 struct ipw_tty *tty = linux_tty->driver_data; 415 + /* FIXME: Exactly how is the tty object locked here .. */ 417 416 418 417 if (!tty) 419 418 return -ENODEV; ··· 435 432 436 433 if (!tty->open_count) 437 434 return -EINVAL; 435 + 436 + /* FIXME: Exactly how is the tty object locked here .. */ 438 437 439 438 switch (cmd) { 440 439 case TIOCGSERIAL: ··· 472 467 } 473 468 return 0; 474 469 475 - case TCGETS: 476 - case TCGETA: 477 - return n_tty_ioctl(linux_tty, file, cmd, arg); 478 - 479 - case TCFLSH: 480 - return n_tty_ioctl(linux_tty, file, cmd, arg); 481 - 482 470 case FIONREAD: 483 471 { 484 472 int val = 0; ··· 480 482 return -EFAULT; 481 483 } 482 484 return 0; 485 + case TCFLSH: 486 + return tty_perform_flush(linux_tty, arg); 483 487 } 484 488 } 485 - 486 - return -ENOIOCTLCMD; 489 + return tty_mode_ioctl(linux_tty, file, cmd , arg); 487 490 } 488 491 489 492 static int add_tty(dev_node_t *nodesp, int j, ··· 587 588 tty_hangup(ttyj->linux_tty); 588 589 /* Wait till the tty_hangup has completed */ 589 590 flush_scheduled_work(); 591 + /* FIXME: Exactly how is the tty object locked here 592 + against a parallel ioctl etc */ 590 593 mutex_lock(&ttyj->ipw_tty_mutex); 591 594 } 592 595 while (ttyj->open_count)