diff options
53 files changed, 79 insertions, 83 deletions
diff --git a/arch/cris/drivers/serial.c b/arch/cris/drivers/serial.c index c93bcd2ecb95..a1ea0e21f089 100644 --- a/arch/cris/drivers/serial.c +++ b/arch/cris/drivers/serial.c @@ -3289,7 +3289,7 @@ rs_open(struct tty_struct *tty, struct file * filp) /* find which port we want to open */ - line = MINOR(tty->device) - tty->driver->minor_start; + line = tty->index; if (line < 0 || line >= NR_PORTS) return -ENODEV; diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c index 48829c2b7e5f..6e671cacd825 100644 --- a/arch/ia64/hp/sim/simserial.c +++ b/arch/ia64/hp/sim/simserial.c @@ -879,7 +879,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp) unsigned long page; MOD_INC_USE_COUNT; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= NR_PORTS)) { MOD_DEC_USE_COUNT; return -ENODEV; diff --git a/arch/mips/au1000/common/serial.c b/arch/mips/au1000/common/serial.c index 63d53dec081d..aa63d311fe7f 100644 --- a/arch/mips/au1000/common/serial.c +++ b/arch/mips/au1000/common/serial.c @@ -2264,7 +2264,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp) unsigned long page; MOD_INC_USE_COUNT; - line = MINOR(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= NR_PORTS)) { MOD_DEC_USE_COUNT; return -ENODEV; diff --git a/arch/mips/baget/vacserial.c b/arch/mips/baget/vacserial.c index f8eb66c8f56a..c949785bd6f3 100644 --- a/arch/mips/baget/vacserial.c +++ b/arch/mips/baget/vacserial.c @@ -1997,7 +1997,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp) unsigned long page; MOD_INC_USE_COUNT; - line = MINOR(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= NR_PORTS)) { MOD_DEC_USE_COUNT; return -ENODEV; diff --git a/arch/ppc/4xx_io/serial_sicc.c b/arch/ppc/4xx_io/serial_sicc.c index 97f3470d9bc8..60acc7caa07d 100644 --- a/arch/ppc/4xx_io/serial_sicc.c +++ b/arch/ppc/4xx_io/serial_sicc.c @@ -1052,8 +1052,7 @@ static void siccuart_flush_buffer(struct tty_struct *tty) unsigned long flags; #if DEBUG - printk("siccuart_flush_buffer(%d) called\n", - MINOR(tty->device) - tty->driver->minor_start); + printk("siccuart_flush_buffer(%d) called\n", tty->index); #endif save_flags(flags); cli(); info->xmit.head = info->xmit.tail = 0; @@ -1580,7 +1579,7 @@ static void siccuart_wait_until_sent(struct tty_struct *tty, int timeout) expire = jiffies + timeout; #if DEBUG printk("siccuart_wait_until_sent(%d), jiff=%lu, expire=%lu char_time=%lu...\n", - MINOR(tty->device) - tty->driver->minor_start, jiffies, + tty->index, jiffies, expire, char_time); #endif while ((readb(info->port->uart_base + BL_SICC_LSR) & _LSR_TX_ALL) != _LSR_TX_ALL) { @@ -1754,7 +1753,7 @@ static struct SICC_info *siccuart_get(int line) static int siccuart_open(struct tty_struct *tty, struct file *filp) { struct SICC_info *info; - int retval, line = MINOR(tty->device) - tty->driver->minor_start; + int retval, line = tty->index; // is this a line that we've got? diff --git a/arch/ppc/8260_io/uart.c b/arch/ppc/8260_io/uart.c index efb16b89177d..f0723ac1f83a 100644 --- a/arch/ppc/8260_io/uart.c +++ b/arch/ppc/8260_io/uart.c @@ -1975,7 +1975,7 @@ static int rs_8xx_open(struct tty_struct *tty, struct file * filp) ser_info_t *info; int retval, line; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= NR_PORTS)) return -ENODEV; retval = get_async_struct(line, &info); diff --git a/arch/ppc/8xx_io/uart.c b/arch/ppc/8xx_io/uart.c index 7e794775d6bb..81f74c1aca1c 100644 --- a/arch/ppc/8xx_io/uart.c +++ b/arch/ppc/8xx_io/uart.c @@ -2035,7 +2035,7 @@ static int rs_8xx_open(struct tty_struct *tty, struct file * filp) ser_info_t *info; int retval, line; - line = MINOR(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= NR_PORTS)) return -ENODEV; retval = get_async_struct(line, &info); diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index 5d1f9761e591..82b90a0f8dc5 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@ -109,7 +109,7 @@ int line_write(struct line *lines, struct tty_struct *tty, int from_user, buf = new; } - i = minor(tty->device) - tty->driver->minor_start; + i = tty->index; line = &lines[i]; down(&line->sem); @@ -219,7 +219,7 @@ int line_open(struct line *lines, struct tty_struct *tty, int n, err = 0; if(tty == NULL) n = 0; - else n = minor(tty->device) - tty->driver->minor_start; + else n = tty->index; line = &lines[n]; down(&line->sem); @@ -267,7 +267,7 @@ void line_close(struct line *lines, struct tty_struct *tty) int n; if(tty == NULL) n = 0; - else n = minor(tty->device) - tty->driver->minor_start; + else n = tty->index; line = &lines[n]; down(&line->sem); diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index a4d7b8e9092e..ca32674f45e7 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c @@ -1895,7 +1895,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp) unsigned long page; MOD_INC_USE_COUNT; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= NR_PORTS)) { MOD_DEC_USE_COUNT; return -ENODEV; diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 58008cf9a241..dfc7daa0bffa 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c @@ -2579,7 +2579,7 @@ cy_open(struct tty_struct *tty, struct file * filp) unsigned long page; MOD_INC_USE_COUNT; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (NR_PORTS <= line)){ MOD_DEC_USE_COUNT; return -ENODEV; diff --git a/drivers/char/dz.c b/drivers/char/dz.c index a3bf3db620a9..6c13bdb239ed 100644 --- a/drivers/char/dz.c +++ b/drivers/char/dz.c @@ -1271,7 +1271,7 @@ static int dz_open (struct tty_struct *tty, struct file *filp) struct dz_serial *info; int retval, line; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; /* * The dz lines for the mouse/keyboard must be opened using their diff --git a/drivers/char/epca.c b/drivers/char/epca.c index 6aea1c76213a..977cef268834 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c @@ -1373,7 +1373,7 @@ static int pc_open(struct tty_struct *tty, struct file * filp) return (0) ; } - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if (line < 0 || line >= nbdevs) { printk(KERN_ERR "<Error> - pc_open : line out of range in pc_open\n"); diff --git a/drivers/char/esp.c b/drivers/char/esp.c index e61ca3935ecf..a07aa6de333d 100644 --- a/drivers/char/esp.c +++ b/drivers/char/esp.c @@ -2354,7 +2354,7 @@ static int esp_open(struct tty_struct *tty, struct file * filp) struct esp_struct *info; int retval, line; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= NR_PORTS)) return -ENODEV; diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 72f71fd6109c..7c4ef931066d 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c @@ -69,7 +69,7 @@ struct hvc_struct hvc_struct[MAX_NR_HVC_CONSOLES]; static int hvc_open(struct tty_struct *tty, struct file * filp) { - int line = minor(tty->device) - tty->driver->minor_start; + int line = tty->index; struct hvc_struct *hp; unsigned long flags; diff --git a/drivers/char/ip2main.c b/drivers/char/ip2main.c index aa417bd7ca3a..c601cd743ed6 100644 --- a/drivers/char/ip2main.c +++ b/drivers/char/ip2main.c @@ -1564,9 +1564,9 @@ ip2_open( PTTY tty, struct file *pFile ) wait_queue_t wait; int rc = 0; int do_clocal = 0; - i2ChanStrPtr pCh = DevTable[minor(tty->device)]; + i2ChanStrPtr pCh = DevTable[tty->index]; - ip2trace (minor(tty->device), ITRC_OPEN, ITRC_ENTER, 0 ); + ip2trace (tty->index, ITRC_OPEN, ITRC_ENTER, 0 ); if ( pCh == NULL ) { return -ENODEV; @@ -2179,7 +2179,7 @@ ip2_unthrottle ( PTTY tty ) static void ip2_start ( PTTY tty ) { - i2ChanStrPtr pCh = DevTable[minor(tty->device)]; + i2ChanStrPtr pCh = DevTable[tty->index]; i2QueueCommands(PTYPE_BYPASS, pCh, 0, 1, CMD_RESUME); i2QueueCommands(PTYPE_BYPASS, pCh, 100, 1, CMD_UNSUSPEND); @@ -2192,7 +2192,7 @@ ip2_start ( PTTY tty ) static void ip2_stop ( PTTY tty ) { - i2ChanStrPtr pCh = DevTable[minor(tty->device)]; + i2ChanStrPtr pCh = DevTable[tty->index]; i2QueueCommands(PTYPE_BYPASS, pCh, 100, 1, CMD_SUSPEND); #ifdef IP2DEBUG_WRITE @@ -2220,7 +2220,7 @@ static int ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) { wait_queue_t wait; - i2ChanStrPtr pCh = DevTable[minor(tty->device)]; + i2ChanStrPtr pCh = DevTable[tty->index]; struct async_icount cprev, cnow; /* kernel counter temps */ struct serial_icounter_struct *p_cuser; /* user space */ int rc = 0; diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 8487dbbc171b..658a194b9daf 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c @@ -1021,7 +1021,7 @@ static int isicom_open(struct tty_struct * tty, struct file * filp) #ifdef ISICOM_DEBUG printk(KERN_DEBUG "ISICOM: open start!!!.\n"); #endif - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; #ifdef ISICOM_DEBUG printk(KERN_DEBUG "line = %d.\n", line); diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index b4feb4d94215..cde0672544c6 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c @@ -1035,7 +1035,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp) (int) filp, tty->name); #endif - minordev = minor(tty->device); + minordev = tty->index; brdnr = MINOR2BRD(minordev); if (brdnr >= stli_nrbrds) return(-ENODEV); diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 22755ea47f18..e942e6ed978b 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c @@ -189,7 +189,7 @@ static struct mxser_mstatus GMStatus[MAX_PORTS]; #define WAKEUP_CHARS 256 -#define PORTNO(x) (minor((x)->device) - (x)->driver->minor_start) +#define PORTNO(x) ((x)->index) static int verbose = 0; static int ttymajor = MOXAMAJOR; diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 56f397efc8a6..ec87ad19c790 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c @@ -94,7 +94,7 @@ #define UART_MCR_AFE 0x20 #define UART_LSR_SPECIAL 0x1E -#define PORTNO(x) (minor((x)->device) - (x)->driver->minor_start) +#define PORTNO(x) ((x)->index) #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 751c1535d605..931ea243e9e7 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -2868,7 +2868,7 @@ static int mgslpc_open(struct tty_struct *tty, struct file * filp) unsigned long flags; /* verify range of specified line number */ - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= mgslpc_device_count)) { printk("%s(%d):mgslpc_open with illegal line #%d.\n", __FILE__,__LINE__,line); diff --git a/drivers/char/pcxx.c b/drivers/char/pcxx.c index fda809c33b84..1c18027b2494 100644 --- a/drivers/char/pcxx.c +++ b/drivers/char/pcxx.c @@ -405,7 +405,7 @@ int pcxe_open(struct tty_struct *tty, struct file * filp) int boardnum; int retval; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if(line < 0 || line >= nbdevs) { printk("line out of range in pcxe_open\n"); diff --git a/drivers/char/pty.c b/drivers/char/pty.c index 45e62e6cf165..2c4933be5f57 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c @@ -90,8 +90,7 @@ static void pty_close(struct tty_struct * tty, struct file * filp) { unsigned int major = major(tty->device) - UNIX98_PTY_MASTER_MAJOR; if ( major < UNIX98_NR_MAJORS ) { - devpts_pty_kill( minor(tty->device) - - tty->driver->minor_start + tty->driver->name_base ); + devpts_pty_kill( tty->index + tty->driver->name_base ); } } #endif @@ -238,8 +237,7 @@ static int pty_chars_in_buffer(struct tty_struct *tty) #ifdef CONFIG_UNIX98_PTYS static int pty_get_device_number(struct tty_struct *tty, unsigned int *value) { - unsigned int result = minor(tty->device) - - tty->driver->minor_start + tty->driver->name_base; + unsigned int result = tty->index + tty->driver->name_base; return put_user(result, value); } #endif @@ -313,7 +311,7 @@ static int pty_open(struct tty_struct *tty, struct file * filp) retval = -ENODEV; if (!tty || !tty->link) goto out; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= NR_PTYS)) goto out; pty = (struct pty_struct *)(tty->driver->driver_state) + line; diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 1c7b49883f00..558f01c9a8bc 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c @@ -1089,12 +1089,12 @@ static int rc_open(struct tty_struct * tty, struct file * filp) struct riscom_board * bp; unsigned long flags; - board = RC_BOARD(minor(tty->device)); + board = RC_BOARD(tty->index); if (board >= RC_NBOARD || !(rc_board[board].flags & RC_BOARD_PRESENT)) return -ENODEV; bp = &rc_board[board]; - port = rc_port + board * RC_NPORT + RC_PORT(minor(tty->device)); + port = rc_port + board * RC_NPORT + RC_PORT(tty->index); if (rc_paranoia_check(port, tty->name, "rc_open")) return -ENODEV; diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 3c7b2c885e9c..dac4f77d513d 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c @@ -822,7 +822,7 @@ static int rp_open(struct tty_struct *tty, struct file * filp) CHANNEL_t *cp; unsigned long page; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= MAX_RP_PORTS)) return -ENODEV; if (!tmp_buf) { diff --git a/drivers/char/ser_a2232.c b/drivers/char/ser_a2232.c index a82a3b925594..cbc09d613e29 100644 --- a/drivers/char/ser_a2232.c +++ b/drivers/char/ser_a2232.c @@ -456,7 +456,7 @@ static int a2232_open(struct tty_struct * tty, struct file * filp) int retval; struct a2232_port *port; - line = minor(tty->device); + line = tty->index; port = &a2232_ports[line]; tty->driver_data = port; diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index a537a2b24f63..47fd30d627f7 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c @@ -2133,7 +2133,7 @@ cy_open(struct tty_struct *tty, struct file * filp) int retval, line; /* CP('O'); */ - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (NR_PORTS <= line)){ return -ENODEV; } diff --git a/drivers/char/serial_tx3912.c b/drivers/char/serial_tx3912.c index d13725ed1ceb..56d5da7b1ff5 100644 --- a/drivers/char/serial_tx3912.c +++ b/drivers/char/serial_tx3912.c @@ -547,7 +547,7 @@ static int rs_open (struct tty_struct * tty, struct file * filp) return -EIO; } - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; rs_dprintk (TX3912_UART_DEBUG_OPEN, "%d: opening line %d. tty=%p ctty=%p)\n", (int) current->pid, line, tty, current->tty); diff --git a/drivers/char/sh-sci.c b/drivers/char/sh-sci.c index 1cfe4c4cde95..4da69ac114ce 100644 --- a/drivers/char/sh-sci.c +++ b/drivers/char/sh-sci.c @@ -812,7 +812,7 @@ static int sci_open(struct tty_struct * tty, struct file * filp) struct sci_port *port; int retval, line; - line = minor(tty->device) - SCI_MINOR_START; + line = tty->index; if ((line < 0) || (line >= SCI_NPORTS)) return -ENODEV; diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index 452546e9535e..f49d36edbdc9 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c @@ -1454,17 +1454,17 @@ static int sx_open(struct tty_struct * tty, struct file * filp) struct specialix_board * bp; unsigned long flags; - board = SX_BOARD(minor(tty->device)); + board = SX_BOARD(tty->index); if (board >= SX_NBOARD || !(sx_board[board].flags & SX_BOARD_PRESENT)) return -ENODEV; bp = &sx_board[board]; - port = sx_port + board * SX_NPORT + SX_PORT(minor(tty->device)); + port = sx_port + board * SX_NPORT + SX_PORT(tty->index); #ifdef DEBUG_SPECIALIX printk (KERN_DEBUG "Board = %d, bp = %p, port = %p, portno = %d.\n", - board, bp, port, SX_PORT(minor(tty->device))); + board, bp, port, SX_PORT(tty->index)); #endif if (sx_paranoia_check(port, tty->name, "sx_open")) diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index 28ec802d1ee0..8a5d7ce37b70 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c @@ -1021,7 +1021,7 @@ static int stl_open(struct tty_struct *tty, struct file *filp) (int) filp, tty->name); #endif - minordev = minor(tty->device); + minordev = tty->index; brdnr = MINOR2BRD(minordev); if (brdnr >= stl_nrbrds) return(-ENODEV); diff --git a/drivers/char/sx.c b/drivers/char/sx.c index fcd63a23d169..d101b6397fad 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c @@ -1434,7 +1434,7 @@ static int sx_open (struct tty_struct * tty, struct file * filp) return -EIO; } - line = minor(tty->device); + line = tty->index; sx_dprintk (SX_DEBUG_OPEN, "%d: opening line %d. tty=%p ctty=%p, np=%d)\n", current->pid, line, tty, current->tty, sx_nports); diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index ca8ed363ba33..f274368a8f39 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c @@ -3530,7 +3530,7 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp) unsigned long flags; /* verify range of specified line number */ - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= mgsl_device_count)) { printk("%s(%d):mgsl_open with illegal line #%d.\n", __FILE__,__LINE__,line); diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index b0d7affd110b..a79298e19dcc 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c @@ -740,7 +740,7 @@ static int open(struct tty_struct *tty, struct file *filp) int retval, line; unsigned long flags; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= synclinkmp_device_count)) { printk("%s(%d): open with illegal line #%d.\n", __FILE__,__LINE__,line); diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 2bbf720033f1..e9b991cdf922 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -172,8 +172,7 @@ static inline void free_tty_struct(struct tty_struct *tty) kfree(tty); } -#define TTY_NUMBER(tty) (minor((tty)->device) - (tty)->driver->minor_start + \ - (tty)->driver->name_base) +#define TTY_NUMBER(tty) ((tty)->index + (tty)->driver->name_base) char *tty_name(struct tty_struct *tty, char *buf) { @@ -843,6 +842,7 @@ static int init_dev(kdev_t device, struct tty_struct **ret_tty) initialize_tty_struct(tty); tty->device = device; tty->driver = driver; + tty->index = idx; sprintf(tty->name, "%s%d", driver->name, idx + driver->name_base); @@ -872,6 +872,7 @@ static int init_dev(kdev_t device, struct tty_struct **ret_tty) o_tty->device = mk_kdev(driver->other->major, driver->other->minor_start + idx); o_tty->driver = driver->other; + o_tty->index = idx; sprintf(o_tty->name, "%s%d", driver->other->name, idx + driver->other->name_base); @@ -1069,7 +1070,7 @@ static void release_dev(struct file * filp) tty_fasync(-1, filp, 0); - idx = minor(tty->device) - tty->driver->minor_start; + idx = tty->index; pty_master = (tty->driver->type == TTY_DRIVER_TYPE_PTY && tty->driver->subtype == PTY_TYPE_MASTER); o_tty = tty->link; @@ -1519,7 +1520,7 @@ static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty, return 0; #ifdef CONFIG_VT if (tty->driver->type == TTY_DRIVER_TYPE_CONSOLE) { - unsigned int currcons = minor(tty->device) - tty->driver->minor_start; + unsigned int currcons = tty->index; if (vc_resize(currcons, tmp_ws.ws_col, tmp_ws.ws_row)) return -ENXIO; } diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c index 6ad591fe45b5..a1083708d250 100644 --- a/drivers/char/vme_scc.c +++ b/drivers/char/vme_scc.c @@ -842,7 +842,7 @@ static void scc_send_xchar(struct tty_struct *tty, char ch) static int scc_open (struct tty_struct * tty, struct file * filp) { - int line = minor(tty->device) - SCC_MINOR_BASE; + int line = tty->index; int retval; struct scc_port *port = &scc_ports[line]; int i, channel = port->channel; diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 6f2f35429098..dc10de2851ef 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c @@ -2345,7 +2345,7 @@ static void con_stop(struct tty_struct *tty) int console_num; if (!tty) return; - console_num = minor(tty->device) - (tty->driver->minor_start); + console_num = tty->index; if (!vc_cons_allocated(console_num)) return; set_vc_kbd_led(kbd_table + console_num, VC_SCROLLOCK); @@ -2360,7 +2360,7 @@ static void con_start(struct tty_struct *tty) int console_num; if (!tty) return; - console_num = minor(tty->device) - (tty->driver->minor_start); + console_num = tty->index; if (!vc_cons_allocated(console_num)) return; clr_vc_kbd_led(kbd_table + console_num, VC_SCROLLOCK); @@ -2392,7 +2392,7 @@ static int con_open(struct tty_struct *tty, struct file * filp) unsigned int currcons; int i; - currcons = minor(tty->device) - tty->driver->minor_start; + currcons = tty->index; i = vc_allocate(currcons); if (i) @@ -2418,7 +2418,7 @@ static void con_close(struct tty_struct *tty, struct file * filp) if (!tty) return; if (tty->count != 1) return; - vcs_make_devfs (minor(tty->device) - tty->driver->minor_start, 1); + vcs_make_devfs (tty->index, 1); vt = (struct vt_struct*)tty->driver_data; if (vt) vc_cons[vt->vc_num].d->vc_tty = NULL; diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index 1ed218e80f77..e5f31cd20002 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c @@ -1766,7 +1766,7 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp) MOD_INC_USE_COUNT; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if (line < 0 || line > ISDN_MAX_CHANNELS) return -ENODEV; info = &isdn_mdm.info[line]; diff --git a/drivers/macintosh/macserial.c b/drivers/macintosh/macserial.c index 5b1e8859a599..45902f5e7807 100644 --- a/drivers/macintosh/macserial.c +++ b/drivers/macintosh/macserial.c @@ -2229,7 +2229,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp) unsigned long page; MOD_INC_USE_COUNT; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= zs_channels_found)) { MOD_DEC_USE_COUNT; return -ENODEV; diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index 6824a613a05c..4715579235d7 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c @@ -540,13 +540,11 @@ static int irtty_open(struct tty_struct *tty) if (strchr(tty->driver->name, '%')) { sprintf(hwname, tty->driver->name, - minor(tty->device) - tty->driver->minor_start + - tty->driver->name_base); + tty->index + tty->driver->name_base); } else { sprintf(hwname, "%s%d", tty->driver->name, - minor(tty->device) - tty->driver->minor_start + - tty->driver->name_base); + tty->index + tty->driver->name_base); } /* apply mtt override */ diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c index e07301da8e97..e3a40160eaf2 100644 --- a/drivers/net/wan/pc300_tty.c +++ b/drivers/net/wan/pc300_tty.c @@ -318,18 +318,18 @@ static int cpc_tty_open(struct tty_struct *tty, struct file *flip) return -ENODEV; } - port = minor(tty->device) - tty->driver->minor_start; + port = tty->index; if ((port < 0) || (port >= CPC_TTY_NPORTS)){ - CPC_TTY_DBG("pc300_tty: open invalid minor %i\n",MINOR(tty->device)); + CPC_TTY_DBG("pc300_tty: open invalid port %d\n", port); return -ENODEV; } cpc_tty = &cpc_tty_area[port]; if (cpc_tty->state == CPC_TTY_ST_IDLE){ - CPC_TTY_DBG("%s: open - invalid interface, minor=%i\n", - cpc_tty->name, MINOR(tty->device)); + CPC_TTY_DBG("%s: open - invalid interface, port=%d\n", + cpc_tty->name, tty->index); return -ENODEV; } diff --git a/drivers/net/wan/sdla_chdlc.c b/drivers/net/wan/sdla_chdlc.c index 4983a7e2b741..96f82a685d32 100644 --- a/drivers/net/wan/sdla_chdlc.c +++ b/drivers/net/wan/sdla_chdlc.c @@ -3698,7 +3698,7 @@ static int wanpipe_tty_open(struct tty_struct *tty, struct file * filp) if (!tty->driver_data){ int port; - port = minor(tty->device) - tty->driver->minor_start; + port = tty->index; if ((port < 0) || (port >= NR_PORTS)) return -ENODEV; diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index 139f07da966c..b3cddeebbbf7 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c @@ -957,7 +957,7 @@ tty3215_open(struct tty_struct *tty, struct file * filp) struct raw3215_info *raw; int retval, line; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= NR_3215)) return -ENODEV; diff --git a/drivers/s390/net/ctctty.c b/drivers/s390/net/ctctty.c index 1e85b8df866e..ba75c7c935c6 100644 --- a/drivers/s390/net/ctctty.c +++ b/drivers/s390/net/ctctty.c @@ -973,7 +973,7 @@ ctc_tty_open(struct tty_struct *tty, struct file *filp) int retval, line; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if (line < 0 || line > CTC_TTY_MAX_DEVICES) return -ENODEV; info = &driver->info[line]; diff --git a/drivers/sbus/char/aurora.c b/drivers/sbus/char/aurora.c index 13b67d5a178c..bebc564ed14e 100644 --- a/drivers/sbus/char/aurora.c +++ b/drivers/sbus/char/aurora.c @@ -1421,7 +1421,7 @@ static int aurora_open(struct tty_struct * tty, struct file * filp) printk("aurora_open: start\n"); #endif - board = AURORA_BOARD(minor(tty->device)); + board = AURORA_BOARD(tty->index); if (board > AURORA_NBOARD || !(aurora_board[board].flags & AURORA_BOARD_PRESENT)) { #ifdef AURORA_DEBUG @@ -1432,7 +1432,7 @@ static int aurora_open(struct tty_struct * tty, struct file * filp) } bp = &aurora_board[board]; - port = aurora_port + board * AURORA_NPORT * AURORA_NCD180 + AURORA_PORT(minor(tty->device)); + port = aurora_port + board * AURORA_NPORT * AURORA_NCD180 + AURORA_PORT(tty->index); if ((aurora_paranoia_check(port, tty->name, "aurora_open")) { #ifdef AURORA_DEBUG printk("aurora_open: error paranoia check\n"); diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c index 1372a11335bc..ca48aacc6081 100644 --- a/drivers/serial/68328serial.c +++ b/drivers/serial/68328serial.c @@ -1374,7 +1374,7 @@ int rs_open(struct tty_struct *tty, struct file * filp) struct m68k_serial *info; int retval, line; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if (line >= NR_PORTS || line < 0) /* we have exactly one */ return -ENODEV; diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c index 47594f7c280a..892e0cdc4942 100644 --- a/drivers/serial/68360serial.c +++ b/drivers/serial/68360serial.c @@ -2041,7 +2041,7 @@ static int rs_360_open(struct tty_struct *tty, struct file * filp) ser_info_t *info; int retval, line; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= NR_PORTS)) return -ENODEV; retval = get_async_struct(line, &info); diff --git a/drivers/serial/core.c b/drivers/serial/core.c index f38106f0e9f8..814ed0c7b0c4 100644 --- a/drivers/serial/core.c +++ b/drivers/serial/core.c @@ -577,8 +577,7 @@ static void uart_flush_buffer(struct tty_struct *tty) struct uart_port *port = state->port; unsigned long flags; - DPRINTK("uart_flush_buffer(%d) called\n", - minor(tty->device) - tty->driver->minor_start); + DPRINTK("uart_flush_buffer(%d) called\n", tty->index); spin_lock_irqsave(&port->lock, flags); uart_circ_clear(&state->info->xmit); @@ -1556,7 +1555,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp) { struct uart_driver *drv = (struct uart_driver *)tty->driver->driver_state; struct uart_state *state; - int retval, line = minor(tty->device) - tty->driver->minor_start; + int retval, line = tty->index; BUG_ON(!kernel_locked()); DPRINTK("uart_open(%d) called\n", line); diff --git a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c index fc9e28c4d249..120aec80864f 100644 --- a/drivers/serial/mcfserial.c +++ b/drivers/serial/mcfserial.c @@ -1416,7 +1416,7 @@ int mcfrs_open(struct tty_struct *tty, struct file * filp) struct mcf_serial *info; int retval, line; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= NR_PORTS)) return -ENODEV; info = mcfrs_table + line; diff --git a/drivers/sgi/char/sgiserial.c b/drivers/sgi/char/sgiserial.c index 1a5cd1bb00f2..dfbc68e7f93f 100644 --- a/drivers/sgi/char/sgiserial.c +++ b/drivers/sgi/char/sgiserial.c @@ -1725,7 +1725,7 @@ int rs_open(struct tty_struct *tty, struct file * filp) struct sgi_serial *info; int retval, line; - line = MINOR(tty->device) - tty->driver->minor_start; + line = tty->index; /* The zilog lines for the mouse/keyboard must be * opened using their respective drivers. */ diff --git a/drivers/tc/zs.c b/drivers/tc/zs.c index ad814df91191..dfc46477eb5d 100644 --- a/drivers/tc/zs.c +++ b/drivers/tc/zs.c @@ -1639,7 +1639,7 @@ int rs_open(struct tty_struct *tty, struct file * filp) struct dec_serial *info; int retval, line; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= zs_channels_found)) return -ENODEV; info = zs_soft + line; diff --git a/include/linux/tty.h b/include/linux/tty.h index f48a081bf8cb..de633b4b551b 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -260,6 +260,7 @@ struct tty_flip_buffer { struct tty_struct { int magic; struct tty_driver *driver; + int index; struct tty_ldisc ldisc; struct termios *termios, *termios_locked; char name[64]; diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 71d8cd352196..4ef753de4ae6 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c @@ -532,7 +532,7 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp) struct rfcomm_dlc *dlc; int err, id; - id = minor(tty->device) - tty->driver->minor_start; + id = tty->index; BT_DBG("tty %p id %d", tty, id); diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index 17addb35043f..837c6652fac2 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c @@ -398,7 +398,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); MOD_INC_USE_COUNT; - line = minor(tty->device) - tty->driver->minor_start; + line = tty->index; if ((line < 0) || (line >= IRCOMM_TTY_PORTS)) { MOD_DEC_USE_COUNT; return -ENODEV; |
