aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/hvc/hvcs.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-04-02 07:54:26 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-09 14:28:21 -0400
commit6968a7592a1f27386174617b6dbef31044da91ed (patch)
treeeeeb366882bf03a81dbc30ae063069a97370f998 /drivers/tty/hvc/hvcs.c
parent2cd9fa254508f71bd3025992ef5cecbf2120b0e4 (diff)
TTY: hvcs, use tty from tty_port
No refcounting, just a switch. The locking in the driver prevents races, so in fact the refcounting is not needed. But while we have a tty in tty_port, don't duplicate that and remove the one from hvcs_struct. 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/hvcs.c')
-rw-r--r--drivers/tty/hvc/hvcs.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index 817f94bf95a1..d56788c83974 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -270,8 +270,6 @@ struct hvcs_struct {
270 */ 270 */
271 unsigned int index; 271 unsigned int index;
272 272
273 struct tty_struct *tty;
274
275 /* 273 /*
276 * Used to tell the driver kernel_thread what operations need to take 274 * Used to tell the driver kernel_thread what operations need to take
277 * place upon this hvcs_struct instance. 275 * place upon this hvcs_struct instance.
@@ -560,7 +558,7 @@ static irqreturn_t hvcs_handle_interrupt(int irq, void *dev_instance)
560static void hvcs_try_write(struct hvcs_struct *hvcsd) 558static void hvcs_try_write(struct hvcs_struct *hvcsd)
561{ 559{
562 uint32_t unit_address = hvcsd->vdev->unit_address; 560 uint32_t unit_address = hvcsd->vdev->unit_address;
563 struct tty_struct *tty = hvcsd->tty; 561 struct tty_struct *tty = hvcsd->port.tty;
564 int sent; 562 int sent;
565 563
566 if (hvcsd->todo_mask & HVCS_TRY_WRITE) { 564 if (hvcsd->todo_mask & HVCS_TRY_WRITE) {
@@ -598,7 +596,7 @@ static int hvcs_io(struct hvcs_struct *hvcsd)
598 spin_lock_irqsave(&hvcsd->lock, flags); 596 spin_lock_irqsave(&hvcsd->lock, flags);
599 597
600 unit_address = hvcsd->vdev->unit_address; 598 unit_address = hvcsd->vdev->unit_address;
601 tty = hvcsd->tty; 599 tty = hvcsd->port.tty;
602 600
603 hvcs_try_write(hvcsd); 601 hvcs_try_write(hvcsd);
604 602
@@ -850,7 +848,7 @@ static int __devexit hvcs_remove(struct vio_dev *dev)
850 848
851 spin_lock_irqsave(&hvcsd->lock, flags); 849 spin_lock_irqsave(&hvcsd->lock, flags);
852 850
853 tty = hvcsd->tty; 851 tty = hvcsd->port.tty;
854 852
855 spin_unlock_irqrestore(&hvcsd->lock, flags); 853 spin_unlock_irqrestore(&hvcsd->lock, flags);
856 854
@@ -1137,7 +1135,7 @@ static int hvcs_open(struct tty_struct *tty, struct file *filp)
1137 goto error_release; 1135 goto error_release;
1138 1136
1139 hvcsd->port.count = 1; 1137 hvcsd->port.count = 1;
1140 hvcsd->tty = tty; 1138 hvcsd->port.tty = tty;
1141 tty->driver_data = hvcsd; 1139 tty->driver_data = hvcsd;
1142 1140
1143 memset(&hvcsd->buffer[0], 0x00, HVCS_BUFF_LEN); 1141 memset(&hvcsd->buffer[0], 0x00, HVCS_BUFF_LEN);
@@ -1223,7 +1221,7 @@ static void hvcs_close(struct tty_struct *tty, struct file *filp)
1223 * execute any operations on the TTY even though it is obligated 1221 * execute any operations on the TTY even though it is obligated
1224 * to deliver any pending I/O to the hypervisor. 1222 * to deliver any pending I/O to the hypervisor.
1225 */ 1223 */
1226 hvcsd->tty = NULL; 1224 hvcsd->port.tty = NULL;
1227 1225
1228 irq = hvcsd->vdev->irq; 1226 irq = hvcsd->vdev->irq;
1229 spin_unlock_irqrestore(&hvcsd->lock, flags); 1227 spin_unlock_irqrestore(&hvcsd->lock, flags);
@@ -1271,8 +1269,8 @@ static void hvcs_hangup(struct tty_struct * tty)
1271 hvcsd->todo_mask = 0; 1269 hvcsd->todo_mask = 0;
1272 1270
1273 /* I don't think the tty needs the hvcs_struct pointer after a hangup */ 1271 /* I don't think the tty needs the hvcs_struct pointer after a hangup */
1274 hvcsd->tty->driver_data = NULL; 1272 tty->driver_data = NULL;
1275 hvcsd->tty = NULL; 1273 hvcsd->port.tty = NULL;
1276 1274
1277 hvcsd->port.count = 0; 1275 hvcsd->port.count = 0;
1278 1276