Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Hendrik Brueckner and committed by
Benjamin Herrenschmidt
fc362e2e a02efb90

+14 -3
+2 -2
drivers/char/hvc_console.c
··· 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;
+3 -1
drivers/char/hvc_console.h
··· 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) */ ··· 87 86 /* default notifier for irq based notification */ 88 87 extern int notifier_add_irq(struct hvc_struct *hp, int data); 89 88 extern void notifier_del_irq(struct hvc_struct *hp, int data); 89 + extern void notifier_hangup_irq(struct hvc_struct *hp, int data); 90 90 91 91 92 92 #if defined(CONFIG_XMON) && defined(CONFIG_SMP)
+5
drivers/char/hvc_irq.c
··· 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 + }
+1
drivers/char/hvc_iseries.c
··· 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,
+1
drivers/char/hvc_vio.c
··· 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,
+1
drivers/char/hvc_xen.c
··· 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)
+1
drivers/char/virtio_console.c
··· 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