Commit 5aaa70a8 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

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: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c26c56c0
...@@ -276,6 +276,7 @@ static int ipw_write_room(struct tty_struct *linux_tty) ...@@ -276,6 +276,7 @@ static int ipw_write_room(struct tty_struct *linux_tty)
struct ipw_tty *tty = linux_tty->driver_data; struct ipw_tty *tty = linux_tty->driver_data;
int room; int room;
/* FIXME: Exactly how is the tty object locked here .. */
if (!tty) if (!tty)
return -ENODEV; return -ENODEV;
...@@ -397,6 +398,7 @@ static int set_control_lines(struct ipw_tty *tty, unsigned int set, ...@@ -397,6 +398,7 @@ static int set_control_lines(struct ipw_tty *tty, unsigned int set,
static int ipw_tiocmget(struct tty_struct *linux_tty, struct file *file) static int ipw_tiocmget(struct tty_struct *linux_tty, struct file *file)
{ {
struct ipw_tty *tty = linux_tty->driver_data; struct ipw_tty *tty = linux_tty->driver_data;
/* FIXME: Exactly how is the tty object locked here .. */
if (!tty) if (!tty)
return -ENODEV; return -ENODEV;
...@@ -412,6 +414,7 @@ ipw_tiocmset(struct tty_struct *linux_tty, struct file *file, ...@@ -412,6 +414,7 @@ ipw_tiocmset(struct tty_struct *linux_tty, struct file *file,
unsigned int set, unsigned int clear) unsigned int set, unsigned int clear)
{ {
struct ipw_tty *tty = linux_tty->driver_data; struct ipw_tty *tty = linux_tty->driver_data;
/* FIXME: Exactly how is the tty object locked here .. */
if (!tty) if (!tty)
return -ENODEV; return -ENODEV;
...@@ -433,6 +436,8 @@ static int ipw_ioctl(struct tty_struct *linux_tty, struct file *file, ...@@ -433,6 +436,8 @@ static int ipw_ioctl(struct tty_struct *linux_tty, struct file *file,
if (!tty->open_count) if (!tty->open_count)
return -EINVAL; return -EINVAL;
/* FIXME: Exactly how is the tty object locked here .. */
switch (cmd) { switch (cmd) {
case TIOCGSERIAL: case TIOCGSERIAL:
return ipwireless_get_serial_info(tty, (void __user *) arg); 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,13 +472,6 @@ static int ipw_ioctl(struct tty_struct *linux_tty, struct file *file,
} }
return 0; return 0;
case TCGETS:
case TCGETA:
return n_tty_ioctl(linux_tty, file, cmd, arg);
case TCFLSH:
return n_tty_ioctl(linux_tty, file, cmd, arg);
case FIONREAD: case FIONREAD:
{ {
int val = 0; int val = 0;
...@@ -482,10 +480,11 @@ static int ipw_ioctl(struct tty_struct *linux_tty, struct file *file, ...@@ -482,10 +480,11 @@ static int ipw_ioctl(struct tty_struct *linux_tty, struct file *file,
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
case TCFLSH:
return tty_perform_flush(linux_tty, arg);
} }
} }
return tty_mode_ioctl(linux_tty, file, cmd , arg);
return -ENOIOCTLCMD;
} }
static int add_tty(dev_node_t *nodesp, int j, static int add_tty(dev_node_t *nodesp, int j,
...@@ -588,6 +587,8 @@ void ipwireless_tty_free(struct ipw_tty *tty) ...@@ -588,6 +587,8 @@ void ipwireless_tty_free(struct ipw_tty *tty)
tty_hangup(ttyj->linux_tty); tty_hangup(ttyj->linux_tty);
/* Wait till the tty_hangup has completed */ /* Wait till the tty_hangup has completed */
flush_scheduled_work(); flush_scheduled_work();
/* FIXME: Exactly how is the tty object locked here
against a parallel ioctl etc */
mutex_lock(&ttyj->ipw_tty_mutex); mutex_lock(&ttyj->ipw_tty_mutex);
} }
while (ttyj->open_count) while (ttyj->open_count)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment