Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
[linux-2.6.git] / drivers / s390 / char / vmcp.c
index af616ae..09e7d9b 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/kernel.h>
 #include <linux/miscdevice.h>
 #include <linux/module.h>
+#include <linux/smp_lock.h>
 #include <asm/cpcmd.h>
 #include <asm/debug.h>
 #include <asm/uaccess.h>
@@ -39,11 +40,14 @@ static int vmcp_open(struct inode *inode, struct file *file)
        session = kmalloc(sizeof(*session), GFP_KERNEL);
        if (!session)
                return -ENOMEM;
+
+       lock_kernel();
        session->bufsize = PAGE_SIZE;
        session->response = NULL;
        session->resp_size = 0;
        mutex_init(&session->mutex);
        file->private_data = session;
+       unlock_kernel();
        return nonseekable_open(inode, file);
 }
 
@@ -192,27 +196,23 @@ static int __init vmcp_init(void)
                PRINT_WARN("z/VM CP interface is only available under z/VM\n");
                return -ENODEV;
        }
+
        vmcp_debug = debug_register("vmcp", 1, 1, 240);
-       if (!vmcp_debug) {
-               PRINT_ERR("z/VM CP interface not loaded. Could not register "
-                          "debug feature\n");
+       if (!vmcp_debug)
                return -ENOMEM;
-       }
+
        ret = debug_register_view(vmcp_debug, &debug_hex_ascii_view);
        if (ret) {
-               PRINT_ERR("z/VM CP interface not loaded. Could not register "
-                         "debug feature view. Error code: %d\n", ret);
                debug_unregister(vmcp_debug);
                return ret;
        }
+
        ret = misc_register(&vmcp_dev);
        if (ret) {
-               PRINT_ERR("z/VM CP interface not loaded. Could not register "
-                          "misc device. Error code: %d\n", ret);
                debug_unregister(vmcp_debug);
                return ret;
        }
-       PRINT_INFO("z/VM CP interface loaded\n");
+
        return 0;
 }
 
@@ -220,7 +220,6 @@ static void __exit vmcp_exit(void)
 {
        misc_deregister(&vmcp_dev);
        debug_unregister(vmcp_debug);
-       PRINT_INFO("z/VM CP interface unloaded.\n");
 }
 
 module_init(vmcp_init);