aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/rocket.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2013-01-03 09:53:06 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-16 01:30:15 -0500
commit2e124b4a390ca85325fae75764bef92f0547fa25 (patch)
tree5519fbcdbe954e79b271ea6d31ac5a4dc754c4f5 /drivers/tty/rocket.c
parentd6c53c0e9bd0a83f9f9ddbc9fd80141a54d83896 (diff)
TTY: switch tty_flip_buffer_push
Now, we start converting tty buffer functions to actually use tty_port. This will allow us to get rid of the need of tty in many call sites. Only tty_port will needed and hence no more tty_port_tty_get in those paths. Now, the one where most of tty_port_tty_get gets removed: tty_flip_buffer_push. IOW we also closed all the races in drivers not using tty_port_tty_get at all yet. Also we move tty_flip_buffer_push declaration from include/linux/tty.h to include/linux/tty_flip.h to all others while we are changing it anyway. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/rocket.c')
-rw-r--r--drivers/tty/rocket.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index 5848a767001a..8073cc0dff59 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -315,9 +315,8 @@ static inline int rocket_paranoia_check(struct r_port *info,
315 * that receive data is present on a serial port. Pulls data from FIFO, moves it into the 315 * that receive data is present on a serial port. Pulls data from FIFO, moves it into the
316 * tty layer. 316 * tty layer.
317 */ 317 */
318static void rp_do_receive(struct r_port *info, 318static void rp_do_receive(struct r_port *info, CHANNEL_t *cp,
319 struct tty_struct *tty, 319 unsigned int ChanStatus)
320 CHANNEL_t * cp, unsigned int ChanStatus)
321{ 320{
322 unsigned int CharNStat; 321 unsigned int CharNStat;
323 int ToRecv, wRecv, space; 322 int ToRecv, wRecv, space;
@@ -416,7 +415,7 @@ static void rp_do_receive(struct r_port *info,
416 cbuf[ToRecv - 1] = sInB(sGetTxRxDataIO(cp)); 415 cbuf[ToRecv - 1] = sInB(sGetTxRxDataIO(cp));
417 } 416 }
418 /* Push the data up to the tty layer */ 417 /* Push the data up to the tty layer */
419 tty_flip_buffer_push(tty); 418 tty_flip_buffer_push(&info->port);
420} 419}
421 420
422/* 421/*
@@ -495,7 +494,6 @@ static void rp_do_transmit(struct r_port *info)
495static void rp_handle_port(struct r_port *info) 494static void rp_handle_port(struct r_port *info)
496{ 495{
497 CHANNEL_t *cp; 496 CHANNEL_t *cp;
498 struct tty_struct *tty;
499 unsigned int IntMask, ChanStatus; 497 unsigned int IntMask, ChanStatus;
500 498
501 if (!info) 499 if (!info)
@@ -506,12 +504,7 @@ static void rp_handle_port(struct r_port *info)
506 "info->flags & NOT_INIT\n"); 504 "info->flags & NOT_INIT\n");
507 return; 505 return;
508 } 506 }
509 tty = tty_port_tty_get(&info->port); 507
510 if (!tty) {
511 printk(KERN_WARNING "rp: WARNING: rp_handle_port called with "
512 "tty==NULL\n");
513 return;
514 }
515 cp = &info->channel; 508 cp = &info->channel;
516 509
517 IntMask = sGetChanIntID(cp) & info->intmask; 510 IntMask = sGetChanIntID(cp) & info->intmask;
@@ -520,7 +513,7 @@ static void rp_handle_port(struct r_port *info)
520#endif 513#endif
521 ChanStatus = sGetChanStatus(cp); 514 ChanStatus = sGetChanStatus(cp);
522 if (IntMask & RXF_TRIG) { /* Rx FIFO trigger level */ 515 if (IntMask & RXF_TRIG) { /* Rx FIFO trigger level */
523 rp_do_receive(info, tty, cp, ChanStatus); 516 rp_do_receive(info, cp, ChanStatus);
524 } 517 }
525 if (IntMask & DELTA_CD) { /* CD change */ 518 if (IntMask & DELTA_CD) { /* CD change */
526#if (defined(ROCKET_DEBUG_OPEN) || defined(ROCKET_DEBUG_INTR) || defined(ROCKET_DEBUG_HANGUP)) 519#if (defined(ROCKET_DEBUG_OPEN) || defined(ROCKET_DEBUG_INTR) || defined(ROCKET_DEBUG_HANGUP))
@@ -528,10 +521,15 @@ static void rp_handle_port(struct r_port *info)
528 (ChanStatus & CD_ACT) ? "on" : "off"); 521 (ChanStatus & CD_ACT) ? "on" : "off");
529#endif 522#endif
530 if (!(ChanStatus & CD_ACT) && info->cd_status) { 523 if (!(ChanStatus & CD_ACT) && info->cd_status) {
524 struct tty_struct *tty;
531#ifdef ROCKET_DEBUG_HANGUP 525#ifdef ROCKET_DEBUG_HANGUP
532 printk(KERN_INFO "CD drop, calling hangup.\n"); 526 printk(KERN_INFO "CD drop, calling hangup.\n");
533#endif 527#endif
534 tty_hangup(tty); 528 tty = tty_port_tty_get(&info->port);
529 if (tty) {
530 tty_hangup(tty);
531 tty_kref_put(tty);
532 }
535 } 533 }
536 info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0; 534 info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0;
537 wake_up_interruptible(&info->port.open_wait); 535 wake_up_interruptible(&info->port.open_wait);
@@ -544,7 +542,6 @@ static void rp_handle_port(struct r_port *info)
544 printk(KERN_INFO "DSR change...\n"); 542 printk(KERN_INFO "DSR change...\n");
545 } 543 }
546#endif 544#endif
547 tty_kref_put(tty);
548} 545}
549 546
550/* 547/*