diff options
Diffstat (limited to 'drivers/tty/ipwireless/tty.c')
-rw-r--r-- | drivers/tty/ipwireless/tty.c | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c index ef92869502a7..77ceaa9c9e3f 100644 --- a/drivers/tty/ipwireless/tty.c +++ b/drivers/tty/ipwireless/tty.c | |||
@@ -90,33 +90,23 @@ static void report_deregistering(struct ipw_tty *tty) | |||
90 | tty->index); | 90 | tty->index); |
91 | } | 91 | } |
92 | 92 | ||
93 | static struct ipw_tty *get_tty(int minor) | 93 | static struct ipw_tty *get_tty(int index) |
94 | { | 94 | { |
95 | if (minor < ipw_tty_driver->minor_start | 95 | /* |
96 | || minor >= ipw_tty_driver->minor_start + | 96 | * The 'ras_raw' channel is only available when 'loopback' mode |
97 | IPWIRELESS_PCMCIA_MINORS) | 97 | * is enabled. |
98 | * Number of minor starts with 16 (_RANGE * _RAS_RAW). | ||
99 | */ | ||
100 | if (!ipwireless_loopback && index >= | ||
101 | IPWIRELESS_PCMCIA_MINOR_RANGE * TTYTYPE_RAS_RAW) | ||
98 | return NULL; | 102 | return NULL; |
99 | else { | 103 | |
100 | int minor_offset = minor - ipw_tty_driver->minor_start; | 104 | return ttys[index]; |
101 | |||
102 | /* | ||
103 | * The 'ras_raw' channel is only available when 'loopback' mode | ||
104 | * is enabled. | ||
105 | * Number of minor starts with 16 (_RANGE * _RAS_RAW). | ||
106 | */ | ||
107 | if (!ipwireless_loopback && | ||
108 | minor_offset >= | ||
109 | IPWIRELESS_PCMCIA_MINOR_RANGE * TTYTYPE_RAS_RAW) | ||
110 | return NULL; | ||
111 | |||
112 | return ttys[minor_offset]; | ||
113 | } | ||
114 | } | 105 | } |
115 | 106 | ||
116 | static int ipw_open(struct tty_struct *linux_tty, struct file *filp) | 107 | static int ipw_open(struct tty_struct *linux_tty, struct file *filp) |
117 | { | 108 | { |
118 | int minor = linux_tty->index; | 109 | struct ipw_tty *tty = get_tty(linux_tty->index); |
119 | struct ipw_tty *tty = get_tty(minor); | ||
120 | 110 | ||
121 | if (!tty) | 111 | if (!tty) |
122 | return -ENODEV; | 112 | return -ENODEV; |
@@ -510,7 +500,7 @@ static int add_tty(int j, | |||
510 | ipwireless_associate_network_tty(network, | 500 | ipwireless_associate_network_tty(network, |
511 | secondary_channel_idx, | 501 | secondary_channel_idx, |
512 | ttys[j]); | 502 | ttys[j]); |
513 | if (get_tty(j + ipw_tty_driver->minor_start) == ttys[j]) | 503 | if (get_tty(j) == ttys[j]) |
514 | report_registering(ttys[j]); | 504 | report_registering(ttys[j]); |
515 | return 0; | 505 | return 0; |
516 | } | 506 | } |
@@ -570,7 +560,7 @@ void ipwireless_tty_free(struct ipw_tty *tty) | |||
570 | 560 | ||
571 | if (ttyj) { | 561 | if (ttyj) { |
572 | mutex_lock(&ttyj->ipw_tty_mutex); | 562 | mutex_lock(&ttyj->ipw_tty_mutex); |
573 | if (get_tty(j + ipw_tty_driver->minor_start) == ttyj) | 563 | if (get_tty(j) == ttyj) |
574 | report_deregistering(ttyj); | 564 | report_deregistering(ttyj); |
575 | ttyj->closing = 1; | 565 | ttyj->closing = 1; |
576 | if (ttyj->linux_tty != NULL) { | 566 | if (ttyj->linux_tty != NULL) { |
@@ -614,7 +604,6 @@ int ipwireless_tty_init(void) | |||
614 | if (!ipw_tty_driver) | 604 | if (!ipw_tty_driver) |
615 | return -ENOMEM; | 605 | return -ENOMEM; |
616 | 606 | ||
617 | ipw_tty_driver->owner = THIS_MODULE; | ||
618 | ipw_tty_driver->driver_name = IPWIRELESS_PCCARD_NAME; | 607 | ipw_tty_driver->driver_name = IPWIRELESS_PCCARD_NAME; |
619 | ipw_tty_driver->name = "ttyIPWp"; | 608 | ipw_tty_driver->name = "ttyIPWp"; |
620 | ipw_tty_driver->major = 0; | 609 | ipw_tty_driver->major = 0; |