X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fchar%2Fhvc_console.c;h=bf70450a49ccbc403c62917c53f0db73f7328f5d;hb=c472273f863c80b87e53356256c5466df24328f0;hp=02aac104842d91033077da4488926fccfc7daa3d;hpb=ce6754235b423610e91f5300e1555c2e4ee1c03a;p=linux-2.6-omap-h63xx.git diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 02aac104842..bf70450a49c 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c @@ -322,11 +322,10 @@ static int hvc_open(struct tty_struct *tty, struct file * filp) hp->tty = tty; - if (hp->ops->notifier_add) - rc = hp->ops->notifier_add(hp, hp->data); - spin_unlock_irqrestore(&hp->lock, flags); + if (hp->ops->notifier_add) + rc = hp->ops->notifier_add(hp, hp->data); /* * If the notifier fails we return an error. The tty layer @@ -368,13 +367,13 @@ static void hvc_close(struct tty_struct *tty, struct file * filp) spin_lock_irqsave(&hp->lock, flags); if (--hp->count == 0) { - if (hp->ops->notifier_del) - hp->ops->notifier_del(hp, hp->data); - /* We are done with the tty pointer now. */ hp->tty = NULL; spin_unlock_irqrestore(&hp->lock, flags); + if (hp->ops->notifier_del) + hp->ops->notifier_del(hp, hp->data); + /* * Chain calls chars_in_buffer() and returns immediately if * there is no buffered data otherwise sleeps on a wait queue @@ -417,11 +416,11 @@ static void hvc_hangup(struct tty_struct *tty) hp->n_outbuf = 0; hp->tty = NULL; + spin_unlock_irqrestore(&hp->lock, flags); + if (hp->ops->notifier_del) hp->ops->notifier_del(hp, hp->data); - spin_unlock_irqrestore(&hp->lock, flags); - while(temp_open_count) { --temp_open_count; kref_put(&hp->kref, destroy_hvc_struct); @@ -820,11 +819,11 @@ static int hvc_init(void) hvc_driver = drv; return 0; -put_tty: - put_tty_driver(hvc_driver); stop_thread: kthread_stop(hvc_task); hvc_task = NULL; +put_tty: + put_tty_driver(drv); out: return err; }