aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/hvc/hvsi.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-04-02 07:54:28 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-09 14:28:26 -0400
commitd73a4e790d05151dadf8c6de84382411a8f073fd (patch)
tree4f7962c9ad5cea39183b6df7f93ba8e35c90f143 /drivers/tty/hvc/hvsi.c
parent5f566051fbc3e7754f903b3b4bf67a44e0ae2d1a (diff)
TTY: hvsi, add tty_port
And use count from there. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/hvc/hvsi.c')
-rw-r--r--drivers/tty/hvc/hvsi.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c
index 4006aed42ee2..113a09abcf7b 100644
--- a/drivers/tty/hvc/hvsi.c
+++ b/drivers/tty/hvc/hvsi.c
@@ -69,6 +69,7 @@
69#define __ALIGNED__ __attribute__((__aligned__(sizeof(long)))) 69#define __ALIGNED__ __attribute__((__aligned__(sizeof(long))))
70 70
71struct hvsi_struct { 71struct hvsi_struct {
72 struct tty_port port;
72 struct delayed_work writer; 73 struct delayed_work writer;
73 struct work_struct handshaker; 74 struct work_struct handshaker;
74 wait_queue_head_t emptyq; /* woken when outbuf is emptied */ 75 wait_queue_head_t emptyq; /* woken when outbuf is emptied */
@@ -76,7 +77,6 @@ struct hvsi_struct {
76 spinlock_t lock; 77 spinlock_t lock;
77 int index; 78 int index;
78 struct tty_struct *tty; 79 struct tty_struct *tty;
79 int count;
80 uint8_t throttle_buf[128]; 80 uint8_t throttle_buf[128];
81 uint8_t outbuf[N_OUTBUF]; /* to implement write_room and chars_in_buffer */ 81 uint8_t outbuf[N_OUTBUF]; /* to implement write_room and chars_in_buffer */
82 /* inbuf is for packet reassembly. leave a little room for leftovers. */ 82 /* inbuf is for packet reassembly. leave a little room for leftovers. */
@@ -751,7 +751,7 @@ static int hvsi_open(struct tty_struct *tty, struct file *filp)
751 751
752 spin_lock_irqsave(&hp->lock, flags); 752 spin_lock_irqsave(&hp->lock, flags);
753 hp->tty = tty; 753 hp->tty = tty;
754 hp->count++; 754 hp->port.count++;
755 atomic_set(&hp->seqno, 0); 755 atomic_set(&hp->seqno, 0);
756 h_vio_signal(hp->vtermno, VIO_IRQ_ENABLE); 756 h_vio_signal(hp->vtermno, VIO_IRQ_ENABLE);
757 spin_unlock_irqrestore(&hp->lock, flags); 757 spin_unlock_irqrestore(&hp->lock, flags);
@@ -808,7 +808,7 @@ static void hvsi_close(struct tty_struct *tty, struct file *filp)
808 808
809 spin_lock_irqsave(&hp->lock, flags); 809 spin_lock_irqsave(&hp->lock, flags);
810 810
811 if (--hp->count == 0) { 811 if (--hp->port.count == 0) {
812 hp->tty = NULL; 812 hp->tty = NULL;
813 hp->inbuf_end = hp->inbuf; /* discard remaining partial packets */ 813 hp->inbuf_end = hp->inbuf; /* discard remaining partial packets */
814 814
@@ -841,9 +841,9 @@ static void hvsi_close(struct tty_struct *tty, struct file *filp)
841 841
842 spin_lock_irqsave(&hp->lock, flags); 842 spin_lock_irqsave(&hp->lock, flags);
843 } 843 }
844 } else if (hp->count < 0) 844 } else if (hp->port.count < 0)
845 printk(KERN_ERR "hvsi_close %lu: oops, count is %d\n", 845 printk(KERN_ERR "hvsi_close %lu: oops, count is %d\n",
846 hp - hvsi_ports, hp->count); 846 hp - hvsi_ports, hp->port.count);
847 847
848 spin_unlock_irqrestore(&hp->lock, flags); 848 spin_unlock_irqrestore(&hp->lock, flags);
849} 849}
@@ -857,7 +857,7 @@ static void hvsi_hangup(struct tty_struct *tty)
857 857
858 spin_lock_irqsave(&hp->lock, flags); 858 spin_lock_irqsave(&hp->lock, flags);
859 859
860 hp->count = 0; 860 hp->port.count = 0;
861 hp->n_outbuf = 0; 861 hp->n_outbuf = 0;
862 hp->tty = NULL; 862 hp->tty = NULL;
863 863
@@ -1228,6 +1228,7 @@ static int __init hvsi_console_init(void)
1228 init_waitqueue_head(&hp->emptyq); 1228 init_waitqueue_head(&hp->emptyq);
1229 init_waitqueue_head(&hp->stateq); 1229 init_waitqueue_head(&hp->stateq);
1230 spin_lock_init(&hp->lock); 1230 spin_lock_init(&hp->lock);
1231 tty_port_init(&hp->port);
1231 hp->index = hvsi_count; 1232 hp->index = hvsi_count;
1232 hp->inbuf_end = hp->inbuf; 1233 hp->inbuf_end = hp->inbuf;
1233 hp->state = HVSI_CLOSED; 1234 hp->state = HVSI_CLOSED;