m68k: gs: use tty_port fixes

commit b5391e29f428d11755ca2c91074c6db6f5c69d7c ("gs: use tty_port")
forgot to update the m68k gs serial drivers.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Geert Uytterhoeven and committed by
Linus Torvalds
732730d4 bdee6ac7

+56 -55
+26 -26
drivers/char/ser_a2232.c
··· 192 Maybe one could implement a more efficient version by not only 193 transferring one character at a time. 194 */ 195 - struct tty_struct *tty = port->gs.tty; 196 197 #if 0 198 switch(err) { ··· 226 227 /* Does this here really have to be? */ 228 local_irq_save(flags); 229 - port->gs.flags &= ~GS_TX_INTEN; 230 local_irq_restore(flags); 231 } 232 ··· 242 243 /* Does this here really have to be? */ 244 local_irq_save(flags); 245 - port->gs.flags |= GS_TX_INTEN; 246 local_irq_restore(flags); 247 } 248 ··· 276 277 local_irq_save(flags); 278 279 - port->gs.flags &= ~GS_ACTIVE; 280 281 - if (port->gs.tty && port->gs.tty->termios->c_cflag & HUPCL) { 282 /* Set DTR and RTS to Low, flush output. 283 The NetBSD driver "msc.c" does it this way. */ 284 stat->Command = ( (stat->Command & ~A2232CMD_CMask) | ··· 309 volatile struct a2232status *status; 310 volatile struct a2232memory *mem; 311 312 - if (!port->gs.tty || !port->gs.tty->termios) return 0; 313 314 status = a2232stat(port->which_a2232, port->which_port_on_a2232); 315 mem = a2232mem(port->which_a2232); ··· 345 } 346 a2232_param |= rate; 347 348 - cflag = port->gs.tty->termios->c_cflag; 349 350 // get character size 351 chsize = cflag & CSIZE; ··· 382 the conventional way of inserting START/STOP characters 383 by hand in throttle()/unthrottle(). 384 */ 385 - softflow = !!( port->gs.tty->termios->c_iflag & IXOFF ); 386 387 // get Parity (Enabled/Disabled? If Enabled, Odd or Even?) 388 parity = cflag & (PARENB | PARODD); ··· 400 /* Hmm. Maybe an own a2232_port structure 401 member would be cleaner? */ 402 if (cflag & CLOCAL) 403 - port->gs.flags &= ~ASYNC_CHECK_CD; 404 else 405 - port->gs.flags |= ASYNC_CHECK_CD; 406 407 408 /* Now we have all parameters and can go to set them: */ ··· 482 port = &a2232_ports[line]; 483 484 tty->driver_data = port; 485 - port->gs.tty = tty; 486 - port->gs.count++; 487 retval = gs_init_port(&port->gs); 488 if (retval) { 489 - port->gs.count--; 490 return retval; 491 } 492 - port->gs.flags |= GS_ACTIVE; 493 retval = gs_block_til_ready(port, filp); 494 495 if (retval) { 496 - port->gs.count--; 497 return retval; 498 } 499 ··· 522 for (p = 0; p < NUMLINES; p++){ /* for every port on this board */ 523 err = 0; 524 port = &a2232_ports[n*NUMLINES+p]; 525 - if ( port->gs.flags & GS_ACTIVE ){ /* if the port is used */ 526 527 status = a2232stat(n,p); 528 ··· 577 obuf = mem->OutBuf[p]; 578 bufpos = status->OutHead; 579 while ( (port->gs.xmit_cnt > 0) && 580 - (!port->gs.tty->stopped) && 581 - (!port->gs.tty->hw_stopped) ){ /* While there are chars to transmit */ 582 if (((bufpos+1) & A2232_IOBUFLENMASK) != status->OutTail) { /* If the A2232 buffer is not full */ 583 ch = port->gs.xmit_buf[port->gs.xmit_tail]; /* get the next char to transmit */ 584 port->gs.xmit_tail = (port->gs.xmit_tail+1) & (SERIAL_XMIT_SIZE-1); /* modulo-addition for the gs.xmit_buf ring-buffer */ ··· 592 status->OutHead = bufpos; 593 594 /* WakeUp if output buffer runs low */ 595 - if ((port->gs.xmit_cnt <= port->gs.wakeup_chars) && port->gs.tty) { 596 - tty_wakeup(port->gs.tty); 597 } 598 } // if the port is used 599 } // for every port on the board ··· 613 struct a2232_port *port = &a2232_ports[n*7+p]; 614 port->cd_status = !(ncd & 1); /* ncd&1 <=> CD is now off */ 615 616 - if (!(port->gs.flags & ASYNC_CHECK_CD)) 617 ; /* Don't report DCD changes */ 618 else if (port->cd_status) { // if DCD on: DCD went UP! 619 620 /* Are we blocking in open?*/ 621 - wake_up_interruptible(&port->gs.open_wait); 622 } 623 else { // if DCD off: DCD went DOWN! 624 - if (port->gs.tty) 625 - tty_hangup (port->gs.tty); 626 } 627 628 } // if CD changed for this port ··· 655 #ifdef NEW_WRITE_LOCKING 656 mutex_init(&(port->gs.port_write_mutex)); 657 #endif 658 - init_waitqueue_head(&port->gs.open_wait); 659 - init_waitqueue_head(&port->gs.close_wait); 660 } 661 } 662
··· 192 Maybe one could implement a more efficient version by not only 193 transferring one character at a time. 194 */ 195 + struct tty_struct *tty = port->gs.port.tty; 196 197 #if 0 198 switch(err) { ··· 226 227 /* Does this here really have to be? */ 228 local_irq_save(flags); 229 + port->gs.port.flags &= ~GS_TX_INTEN; 230 local_irq_restore(flags); 231 } 232 ··· 242 243 /* Does this here really have to be? */ 244 local_irq_save(flags); 245 + port->gs.port.flags |= GS_TX_INTEN; 246 local_irq_restore(flags); 247 } 248 ··· 276 277 local_irq_save(flags); 278 279 + port->gs.port.flags &= ~GS_ACTIVE; 280 281 + if (port->gs.port.tty && port->gs.port.tty->termios->c_cflag & HUPCL) { 282 /* Set DTR and RTS to Low, flush output. 283 The NetBSD driver "msc.c" does it this way. */ 284 stat->Command = ( (stat->Command & ~A2232CMD_CMask) | ··· 309 volatile struct a2232status *status; 310 volatile struct a2232memory *mem; 311 312 + if (!port->gs.port.tty || !port->gs.port.tty->termios) return 0; 313 314 status = a2232stat(port->which_a2232, port->which_port_on_a2232); 315 mem = a2232mem(port->which_a2232); ··· 345 } 346 a2232_param |= rate; 347 348 + cflag = port->gs.port.tty->termios->c_cflag; 349 350 // get character size 351 chsize = cflag & CSIZE; ··· 382 the conventional way of inserting START/STOP characters 383 by hand in throttle()/unthrottle(). 384 */ 385 + softflow = !!( port->gs.port.tty->termios->c_iflag & IXOFF ); 386 387 // get Parity (Enabled/Disabled? If Enabled, Odd or Even?) 388 parity = cflag & (PARENB | PARODD); ··· 400 /* Hmm. Maybe an own a2232_port structure 401 member would be cleaner? */ 402 if (cflag & CLOCAL) 403 + port->gs.port.flags &= ~ASYNC_CHECK_CD; 404 else 405 + port->gs.port.flags |= ASYNC_CHECK_CD; 406 407 408 /* Now we have all parameters and can go to set them: */ ··· 482 port = &a2232_ports[line]; 483 484 tty->driver_data = port; 485 + port->gs.port.tty = tty; 486 + port->gs.port.count++; 487 retval = gs_init_port(&port->gs); 488 if (retval) { 489 + port->gs.port.count--; 490 return retval; 491 } 492 + port->gs.port.flags |= GS_ACTIVE; 493 retval = gs_block_til_ready(port, filp); 494 495 if (retval) { 496 + port->gs.port.count--; 497 return retval; 498 } 499 ··· 522 for (p = 0; p < NUMLINES; p++){ /* for every port on this board */ 523 err = 0; 524 port = &a2232_ports[n*NUMLINES+p]; 525 + if ( port->gs.port.flags & GS_ACTIVE ){ /* if the port is used */ 526 527 status = a2232stat(n,p); 528 ··· 577 obuf = mem->OutBuf[p]; 578 bufpos = status->OutHead; 579 while ( (port->gs.xmit_cnt > 0) && 580 + (!port->gs.port.tty->stopped) && 581 + (!port->gs.port.tty->hw_stopped) ){ /* While there are chars to transmit */ 582 if (((bufpos+1) & A2232_IOBUFLENMASK) != status->OutTail) { /* If the A2232 buffer is not full */ 583 ch = port->gs.xmit_buf[port->gs.xmit_tail]; /* get the next char to transmit */ 584 port->gs.xmit_tail = (port->gs.xmit_tail+1) & (SERIAL_XMIT_SIZE-1); /* modulo-addition for the gs.xmit_buf ring-buffer */ ··· 592 status->OutHead = bufpos; 593 594 /* WakeUp if output buffer runs low */ 595 + if ((port->gs.xmit_cnt <= port->gs.wakeup_chars) && port->gs.port.tty) { 596 + tty_wakeup(port->gs.port.tty); 597 } 598 } // if the port is used 599 } // for every port on the board ··· 613 struct a2232_port *port = &a2232_ports[n*7+p]; 614 port->cd_status = !(ncd & 1); /* ncd&1 <=> CD is now off */ 615 616 + if (!(port->gs.port.flags & ASYNC_CHECK_CD)) 617 ; /* Don't report DCD changes */ 618 else if (port->cd_status) { // if DCD on: DCD went UP! 619 620 /* Are we blocking in open?*/ 621 + wake_up_interruptible(&port->gs.port.open_wait); 622 } 623 else { // if DCD off: DCD went DOWN! 624 + if (port->gs.port.tty) 625 + tty_hangup (port->gs.port.tty); 626 } 627 628 } // if CD changed for this port ··· 655 #ifdef NEW_WRITE_LOCKING 656 mutex_init(&(port->gs.port_write_mutex)); 657 #endif 658 + init_waitqueue_head(&port->gs.port.open_wait); 659 + init_waitqueue_head(&port->gs.port.close_wait); 660 } 661 } 662
+30 -29
drivers/char/vme_scc.c
··· 183 #ifdef NEW_WRITE_LOCKING 184 port->gs.port_write_mutex = MUTEX; 185 #endif 186 - init_waitqueue_head(&port->gs.open_wait); 187 - init_waitqueue_head(&port->gs.close_wait); 188 } 189 } 190 ··· 422 { 423 unsigned char ch; 424 struct scc_port *port = data; 425 - struct tty_struct *tty = port->gs.tty; 426 SCC_ACCESS_INIT(port); 427 428 ch = SCCread_NB(RX_DATA_REG); ··· 453 static irqreturn_t scc_spcond_int(int irq, void *data) 454 { 455 struct scc_port *port = data; 456 - struct tty_struct *tty = port->gs.tty; 457 unsigned char stat, ch, err; 458 int int_pending_mask = port->channel == CHANNEL_A ? 459 IPR_A_RX : IPR_B_RX; ··· 500 struct scc_port *port = data; 501 SCC_ACCESS_INIT(port); 502 503 - if (!port->gs.tty) { 504 printk(KERN_WARNING "scc_tx_int with NULL tty!\n"); 505 SCCmod (INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0); 506 SCCwrite(COMMAND_REG, CR_TX_PENDING_RESET); ··· 512 SCCwrite(TX_DATA_REG, port->x_char); 513 port->x_char = 0; 514 } 515 - else if ((port->gs.xmit_cnt <= 0) || port->gs.tty->stopped || 516 - port->gs.tty->hw_stopped) 517 break; 518 else { 519 SCCwrite(TX_DATA_REG, port->gs.xmit_buf[port->gs.xmit_tail++]); ··· 523 break; 524 } 525 } 526 - if ((port->gs.xmit_cnt <= 0) || port->gs.tty->stopped || 527 - port->gs.tty->hw_stopped) { 528 /* disable tx interrupts */ 529 SCCmod (INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0); 530 SCCwrite(COMMAND_REG, CR_TX_PENDING_RESET); /* disable tx_int on next tx underrun? */ 531 - port->gs.flags &= ~GS_TX_INTEN; 532 } 533 - if (port->gs.tty && port->gs.xmit_cnt <= port->gs.wakeup_chars) 534 - tty_wakeup(port->gs.tty); 535 536 SCCwrite_NB(COMMAND_REG, CR_HIGHEST_IUS_RESET); 537 return IRQ_HANDLED; ··· 551 552 if (changed & SR_DCD) { 553 port->c_dcd = !!(sr & SR_DCD); 554 - if (!(port->gs.flags & ASYNC_CHECK_CD)) 555 ; /* Don't report DCD changes */ 556 else if (port->c_dcd) { 557 - wake_up_interruptible(&port->gs.open_wait); 558 } 559 else { 560 - if (port->gs.tty) 561 - tty_hangup (port->gs.tty); 562 } 563 } 564 SCCwrite(COMMAND_REG, CR_EXTSTAT_RESET); ··· 579 580 local_irq_save(flags); 581 SCCmod(INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0); 582 - port->gs.flags &= ~GS_TX_INTEN; 583 local_irq_restore(flags); 584 } 585 ··· 637 { 638 struct scc_port *port = ptr; 639 640 - port->gs.flags &= ~ GS_ACTIVE; 641 - if (port->gs.tty && port->gs.tty->termios->c_cflag & HUPCL) { 642 scc_setsignals (port, 0, 0); 643 } 644 } ··· 653 struct scc_port *port = ptr; 654 SCC_ACCESS_INIT(port); 655 656 - if (!port->gs.tty || !port->gs.tty->termios) return 0; 657 658 channel = port->channel; 659 660 if (channel == CHANNEL_A) 661 return 0; /* Settings controlled by boot PROM */ 662 663 - cflag = port->gs.tty->termios->c_cflag; 664 baud = port->gs.baud; 665 chsize = (cflag & CSIZE) >> 4; 666 ··· 679 } 680 681 if (cflag & CLOCAL) 682 - port->gs.flags &= ~ASYNC_CHECK_CD; 683 else 684 - port->gs.flags |= ASYNC_CHECK_CD; 685 686 #ifdef CONFIG_MVME147_SCC 687 if (MACH_IS_MVME147) ··· 857 { COMMAND_REG, CR_EXTSTAT_RESET }, 858 }; 859 #endif 860 - if (!(port->gs.flags & ASYNC_INITIALIZED)) { 861 local_irq_save(flags); 862 #if defined(CONFIG_MVME147_SCC) || defined(CONFIG_MVME162_SCC) 863 if (MACH_IS_MVME147 || MACH_IS_MVME16x) { ··· 881 } 882 883 tty->driver_data = port; 884 - port->gs.tty = tty; 885 - port->gs.count++; 886 retval = gs_init_port(&port->gs); 887 if (retval) { 888 - port->gs.count--; 889 return retval; 890 } 891 - port->gs.flags |= GS_ACTIVE; 892 retval = gs_block_til_ready(port, filp); 893 894 if (retval) { 895 - port->gs.count--; 896 return retval; 897 } 898
··· 183 #ifdef NEW_WRITE_LOCKING 184 port->gs.port_write_mutex = MUTEX; 185 #endif 186 + init_waitqueue_head(&port->gs.port.open_wait); 187 + init_waitqueue_head(&port->gs.port.close_wait); 188 } 189 } 190 ··· 422 { 423 unsigned char ch; 424 struct scc_port *port = data; 425 + struct tty_struct *tty = port->gs.port.tty; 426 SCC_ACCESS_INIT(port); 427 428 ch = SCCread_NB(RX_DATA_REG); ··· 453 static irqreturn_t scc_spcond_int(int irq, void *data) 454 { 455 struct scc_port *port = data; 456 + struct tty_struct *tty = port->gs.port.tty; 457 unsigned char stat, ch, err; 458 int int_pending_mask = port->channel == CHANNEL_A ? 459 IPR_A_RX : IPR_B_RX; ··· 500 struct scc_port *port = data; 501 SCC_ACCESS_INIT(port); 502 503 + if (!port->gs.port.tty) { 504 printk(KERN_WARNING "scc_tx_int with NULL tty!\n"); 505 SCCmod (INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0); 506 SCCwrite(COMMAND_REG, CR_TX_PENDING_RESET); ··· 512 SCCwrite(TX_DATA_REG, port->x_char); 513 port->x_char = 0; 514 } 515 + else if ((port->gs.xmit_cnt <= 0) || 516 + port->gs.port.tty->stopped || 517 + port->gs.port.tty->hw_stopped) 518 break; 519 else { 520 SCCwrite(TX_DATA_REG, port->gs.xmit_buf[port->gs.xmit_tail++]); ··· 522 break; 523 } 524 } 525 + if ((port->gs.xmit_cnt <= 0) || port->gs.port.tty->stopped || 526 + port->gs.port.tty->hw_stopped) { 527 /* disable tx interrupts */ 528 SCCmod (INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0); 529 SCCwrite(COMMAND_REG, CR_TX_PENDING_RESET); /* disable tx_int on next tx underrun? */ 530 + port->gs.port.flags &= ~GS_TX_INTEN; 531 } 532 + if (port->gs.port.tty && port->gs.xmit_cnt <= port->gs.wakeup_chars) 533 + tty_wakeup(port->gs.port.tty); 534 535 SCCwrite_NB(COMMAND_REG, CR_HIGHEST_IUS_RESET); 536 return IRQ_HANDLED; ··· 550 551 if (changed & SR_DCD) { 552 port->c_dcd = !!(sr & SR_DCD); 553 + if (!(port->gs.port.flags & ASYNC_CHECK_CD)) 554 ; /* Don't report DCD changes */ 555 else if (port->c_dcd) { 556 + wake_up_interruptible(&port->gs.port.open_wait); 557 } 558 else { 559 + if (port->gs.port.tty) 560 + tty_hangup (port->gs.port.tty); 561 } 562 } 563 SCCwrite(COMMAND_REG, CR_EXTSTAT_RESET); ··· 578 579 local_irq_save(flags); 580 SCCmod(INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0); 581 + port->gs.port.flags &= ~GS_TX_INTEN; 582 local_irq_restore(flags); 583 } 584 ··· 636 { 637 struct scc_port *port = ptr; 638 639 + port->gs.port.flags &= ~ GS_ACTIVE; 640 + if (port->gs.port.tty && port->gs.port.tty->termios->c_cflag & HUPCL) { 641 scc_setsignals (port, 0, 0); 642 } 643 } ··· 652 struct scc_port *port = ptr; 653 SCC_ACCESS_INIT(port); 654 655 + if (!port->gs.port.tty || !port->gs.port.tty->termios) return 0; 656 657 channel = port->channel; 658 659 if (channel == CHANNEL_A) 660 return 0; /* Settings controlled by boot PROM */ 661 662 + cflag = port->gs.port.tty->termios->c_cflag; 663 baud = port->gs.baud; 664 chsize = (cflag & CSIZE) >> 4; 665 ··· 678 } 679 680 if (cflag & CLOCAL) 681 + port->gs.port.flags &= ~ASYNC_CHECK_CD; 682 else 683 + port->gs.port.flags |= ASYNC_CHECK_CD; 684 685 #ifdef CONFIG_MVME147_SCC 686 if (MACH_IS_MVME147) ··· 856 { COMMAND_REG, CR_EXTSTAT_RESET }, 857 }; 858 #endif 859 + if (!(port->gs.port.flags & ASYNC_INITIALIZED)) { 860 local_irq_save(flags); 861 #if defined(CONFIG_MVME147_SCC) || defined(CONFIG_MVME162_SCC) 862 if (MACH_IS_MVME147 || MACH_IS_MVME16x) { ··· 880 } 881 882 tty->driver_data = port; 883 + port->gs.port.tty = tty; 884 + port->gs.port.count++; 885 retval = gs_init_port(&port->gs); 886 if (retval) { 887 + port->gs.port.count--; 888 return retval; 889 } 890 + port->gs.port.flags |= GS_ACTIVE; 891 retval = gs_block_til_ready(port, filp); 892 893 if (retval) { 894 + port->gs.port.count--; 895 return retval; 896 } 897