#include <linux/console.h>
 #include <linux/interrupt.h>
 #include <linux/err.h>
+#include <linux/reboot.h>
 
 #include <linux/slab.h>
 #include <linux/bootmem.h>
 }
 
 /*
- * panic() calls console_unblank before the system enters a
- * disabled, endless loop.
+ * panic() calls con3215_flush through a panic_notifier
+ * before the system enters a disabled, endless loop.
  */
 static void
-con3215_unblank(void)
+con3215_flush(void)
 {
        struct raw3215_info *raw;
        unsigned long flags;
        spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
 }
 
+static int con3215_notify(struct notifier_block *self,
+                         unsigned long event, void *data)
+{
+       con3215_flush();
+       return NOTIFY_OK;
+}
+
+static struct notifier_block on_panic_nb = {
+       .notifier_call = con3215_notify,
+       .priority = 0,
+};
+
+static struct notifier_block on_reboot_nb = {
+       .notifier_call = con3215_notify,
+       .priority = 0,
+};
+
 /*
  *  The console structure for the 3215 console
  */
        .name    = "ttyS",
        .write   = con3215_write,
        .device  = con3215_device,
-       .unblank = con3215_unblank,
        .flags   = CON_PRINTBUFFER,
 };
 
                raw3215[0] = NULL;
                return -ENODEV;
        }
+       atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb);
+       register_reboot_notifier(&on_reboot_nb);
        register_console(&con3215);
        return 0;
 }
 
 #include <linux/list.h>
 #include <linux/types.h>
 #include <linux/err.h>
+#include <linux/reboot.h>
 
 #include <asm/ccwdev.h>
 #include <asm/cio.h>
 }
 
 /*
- * panic() calls console_unblank before the system enters a
- * disabled, endless loop.
+ * panic() calls con3270_flush through a panic_notifier
+ * before the system enters a disabled, endless loop.
  */
 static void
-con3270_unblank(void)
+con3270_flush(void)
 {
        struct con3270 *cp;
        unsigned long flags;
        spin_unlock_irqrestore(&cp->view.lock, flags);
 }
 
+static int con3270_notify(struct notifier_block *self,
+                         unsigned long event, void *data)
+{
+       con3270_flush();
+       return NOTIFY_OK;
+}
+
+static struct notifier_block on_panic_nb = {
+       .notifier_call = con3270_notify,
+       .priority = 0,
+};
+
+static struct notifier_block on_reboot_nb = {
+       .notifier_call = con3270_notify,
+       .priority = 0,
+};
+
 /*
  *  The console structure for the 3270 console
  */
        .name    = "tty3270",
        .write   = con3270_write,
        .device  = con3270_device,
-       .unblank = con3270_unblank,
        .flags   = CON_PRINTBUFFER,
 };
 
        condev->cline->len = 0;
        con3270_create_status(condev);
        condev->input = alloc_string(&condev->freemem, 80);
+       atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb);
+       register_reboot_notifier(&on_reboot_nb);
        register_console(&con3270);
        return 0;
 }
 
 #include <linux/bootmem.h>
 #include <linux/termios.h>
 #include <linux/err.h>
+#include <linux/reboot.h>
 
 #include "sclp.h"
 #include "sclp_rw.h"
  * will be flushed to the SCLP.
  */
 static void
-sclp_console_unblank(void)
+sclp_console_flush(void)
 {
        unsigned long flags;
 
        spin_unlock_irqrestore(&sclp_con_lock, flags);
 }
 
+static int
+sclp_console_notify(struct notifier_block *self,
+                         unsigned long event, void *data)
+{
+       sclp_console_flush();
+       return NOTIFY_OK;
+}
+
+static struct notifier_block on_panic_nb = {
+       .notifier_call = sclp_console_notify,
+       .priority = 1,
+};
+
+static struct notifier_block on_reboot_nb = {
+       .notifier_call = sclp_console_notify,
+       .priority = 1,
+};
+
 /*
  * used to register the SCLP console to the kernel and to
  * give printk necessary information
        .name = sclp_console_name,
        .write = sclp_console_write,
        .device = sclp_console_device,
-       .unblank = sclp_console_unblank,
        .flags = CON_PRINTBUFFER,
        .index = 0 /* ttyS0 */
 };
        sclp_con_width_htab = 8;
 
        /* enable printk-access to this driver */
+       atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb);
+       register_reboot_notifier(&on_reboot_nb);
        register_console(&sclp_console);
        return 0;
 }
 
 #include <linux/bootmem.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
+#include <linux/reboot.h>
+
 #include <asm/uaccess.h>
 #include "sclp.h"
 
        return sclp_vt220_driver;
 }
 
-/*
- * This routine is called from panic when the kernel is going to give up.
- * We have to make sure that all buffers will be flushed to the SCLP.
- * Note that this function may be called from within an interrupt context.
- */
-static void
-sclp_vt220_con_unblank(void)
+static int
+sclp_vt220_notify(struct notifier_block *self,
+                         unsigned long event, void *data)
 {
        __sclp_vt220_flush_buffer();
+       return NOTIFY_OK;
 }
 
+static struct notifier_block on_panic_nb = {
+       .notifier_call = sclp_vt220_notify,
+       .priority = 1,
+};
+
+static struct notifier_block on_reboot_nb = {
+       .notifier_call = sclp_vt220_notify,
+       .priority = 1,
+};
+
 /* Structure needed to register with printk */
 static struct console sclp_vt220_console =
 {
        .name = SCLP_VT220_CONSOLE_NAME,
        .write = sclp_vt220_con_write,
        .device = sclp_vt220_con_device,
-       .unblank = sclp_vt220_con_unblank,
        .flags = CON_PRINTBUFFER,
        .index = SCLP_VT220_CONSOLE_INDEX
 };
        if (rc)
                return rc;
        /* Attach linux console */
+       atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb);
+       register_reboot_notifier(&on_reboot_nb);
        register_console(&sclp_vt220_console);
        return 0;
 }