Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325672
b: refs/heads/master
c: 97d1508
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Aug 13, 2012
1 parent 11b3968 commit ec4c05a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bdb498c20040616e94b05c31a0ceb3e134b7e829
refs/heads/master: 97d150898592be8d5381ebc8d435526df38a2791
32 changes: 17 additions & 15 deletions trunk/drivers/tty/hvc/hvcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1109,11 +1109,10 @@ static struct hvcs_struct *hvcs_get_by_index(int index)
static int hvcs_open(struct tty_struct *tty, struct file *filp)
{
struct hvcs_struct *hvcsd;
int rc, retval = 0;
unsigned long flags;
unsigned int irq;
struct vio_dev *vdev;
unsigned long unit_address;
unsigned long unit_address, flags;
unsigned int irq;
int retval;

if (tty->driver_data)
goto fast_open;
Expand All @@ -1122,17 +1121,23 @@ static int hvcs_open(struct tty_struct *tty, struct file *filp)
* Is there a vty-server that shares the same index?
* This function increments the kref index.
*/
if (!(hvcsd = hvcs_get_by_index(tty->index))) {
hvcsd = hvcs_get_by_index(tty->index);
if (!hvcsd) {
printk(KERN_WARNING "HVCS: open failed, no device associated"
" with tty->index %d.\n", tty->index);
return -ENODEV;
}

spin_lock_irqsave(&hvcsd->lock, flags);

if (hvcsd->connected == 0)
if ((retval = hvcs_partner_connect(hvcsd)))
goto error_release;
if (hvcsd->connected == 0) {
retval = hvcs_partner_connect(hvcsd);
if (retval) {
spin_unlock_irqrestore(&hvcsd->lock, flags);
printk(KERN_WARNING "HVCS: partner connect failed.\n");
goto err_put;
}
}

hvcsd->port.count = 1;
hvcsd->port.tty = tty;
Expand All @@ -1155,10 +1160,10 @@ static int hvcs_open(struct tty_struct *tty, struct file *filp)
* This must be done outside of the spinlock because it requests irqs
* and will grab the spinlock and free the connection if it fails.
*/
if (((rc = hvcs_enable_device(hvcsd, unit_address, irq, vdev)))) {
tty_port_put(&hvcsd->port);
retval = hvcs_enable_device(hvcsd, unit_address, irq, vdev);
if (retval) {
printk(KERN_WARNING "HVCS: enable device failed.\n");
return rc;
goto err_put;
}

goto open_success;
Expand All @@ -1179,12 +1184,9 @@ static int hvcs_open(struct tty_struct *tty, struct file *filp)
hvcsd->vdev->unit_address );

return 0;

error_release:
spin_unlock_irqrestore(&hvcsd->lock, flags);
err_put:
tty_port_put(&hvcsd->port);

printk(KERN_WARNING "HVCS: partner connect failed.\n");
return retval;
}

Expand Down

0 comments on commit ec4c05a

Please sign in to comment.