@@ -829,7 +829,7 @@ static int hvcs_remove(struct vio_dev *dev)
spin_lock_irqsave(&hvcsd->lock, flags);
- tty = hvcsd->port.tty;
+ tty = tty_port_tty_get(&hvcsd->port);
spin_unlock_irqrestore(&hvcsd->lock, flags);
@@ -844,8 +844,10 @@ static int hvcs_remove(struct vio_dev *dev)
* hvcs_hangup. The tty should always be valid at this time unless a
* simultaneous tty close already cleaned up the hvcs_struct.
*/
- if (tty)
+ if (tty) {
tty_hangup(tty);
+ tty_kref_put(tty);
+ }
printk(KERN_INFO "HVCS: vty-server@%X removed from the"
" vio bus.\n", dev->unit_address);