Commit fc362e2e0efd8b652ebfb409a4e43e6189c04f6f

Authored by Hendrik Brueckner
Committed by Benjamin Herrenschmidt
1 parent a02efb906d

hvc_console: Add a hangup notifier for backends

I have added a hangup notifier that can be used by hvc console
backends to handle a tty hangup. The default irq hangup notifier
calls the notifier_del_irq() for compatibility.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Showing 7 changed files with 14 additions and 3 deletions Side-by-side Diff

drivers/char/hvc_console.c
... ... @@ -418,8 +418,8 @@
418 418  
419 419 spin_unlock_irqrestore(&hp->lock, flags);
420 420  
421   - if (hp->ops->notifier_del)
422   - hp->ops->notifier_del(hp, hp->data);
  421 + if (hp->ops->notifier_hangup)
  422 + hp->ops->notifier_hangup(hp, hp->data);
423 423  
424 424 while(temp_open_count) {
425 425 --temp_open_count;
drivers/char/hvc_console.h
... ... @@ -65,9 +65,10 @@
65 65 int (*get_chars)(uint32_t vtermno, char *buf, int count);
66 66 int (*put_chars)(uint32_t vtermno, const char *buf, int count);
67 67  
68   - /* Callbacks for notification. Called in open and close */
  68 + /* Callbacks for notification. Called in open, close and hangup */
69 69 int (*notifier_add)(struct hvc_struct *hp, int irq);
70 70 void (*notifier_del)(struct hvc_struct *hp, int irq);
  71 + void (*notifier_hangup)(struct hvc_struct *hp, int irq);
71 72 };
72 73  
73 74 /* Register a vterm and a slot index for use as a console (console_init) */
... ... @@ -86,6 +87,7 @@
86 87 /* default notifier for irq based notification */
87 88 extern int notifier_add_irq(struct hvc_struct *hp, int data);
88 89 extern void notifier_del_irq(struct hvc_struct *hp, int data);
  90 +extern void notifier_hangup_irq(struct hvc_struct *hp, int data);
89 91  
90 92  
91 93 #if defined(CONFIG_XMON) && defined(CONFIG_SMP)
drivers/char/hvc_irq.c
... ... @@ -42,4 +42,9 @@
42 42 free_irq(irq, hp);
43 43 hp->irq_requested = 0;
44 44 }
  45 +
  46 +void notifier_hangup_irq(struct hvc_struct *hp, int irq)
  47 +{
  48 + notifier_del_irq(hp, irq);
  49 +}
drivers/char/hvc_iseries.c
... ... @@ -202,6 +202,7 @@
202 202 .put_chars = put_chars,
203 203 .notifier_add = notifier_add_irq,
204 204 .notifier_del = notifier_del_irq,
  205 + .notifier_hangup = notifier_hangup_irq,
205 206 };
206 207  
207 208 static int __devinit hvc_vio_probe(struct vio_dev *vdev,
drivers/char/hvc_vio.c
... ... @@ -82,6 +82,7 @@
82 82 .put_chars = hvc_put_chars,
83 83 .notifier_add = notifier_add_irq,
84 84 .notifier_del = notifier_del_irq,
  85 + .notifier_hangup = notifier_hangup_irq,
85 86 };
86 87  
87 88 static int __devinit hvc_vio_probe(struct vio_dev *vdev,
drivers/char/hvc_xen.c
... ... @@ -102,6 +102,7 @@
102 102 .put_chars = write_console,
103 103 .notifier_add = notifier_add_irq,
104 104 .notifier_del = notifier_del_irq,
  105 + .notifier_hangup = notifier_hangup_irq,
105 106 };
106 107  
107 108 static int __init xen_init(void)
drivers/char/virtio_console.c
... ... @@ -198,6 +198,7 @@
198 198 virtio_cons.put_chars = put_chars;
199 199 virtio_cons.notifier_add = notifier_add_vio;
200 200 virtio_cons.notifier_del = notifier_del_vio;
  201 + virtio_cons.notifier_hangup = notifier_del_vio;
201 202  
202 203 /* The first argument of hvc_alloc() is the virtual console number, so
203 204 * we use zero. The second argument is the parameter for the