Merge tag 'for_linus-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jwesse...
[linux-2.6.git] / drivers / misc / pti.c
index 8653bd0..383133b 100644 (file)
@@ -33,6 +33,8 @@
 #include <linux/mutex.h>
 #include <linux/miscdevice.h>
 #include <linux/pti.h>
+#include <linux/slab.h>
+#include <linux/uaccess.h>
 
 #define DRIVERNAME             "pti"
 #define PCINAME                        "pciPTI"
@@ -163,6 +165,11 @@ static void pti_write_to_aperture(struct pti_masterchannel *mc,
 static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc,
                                             const char *thread_name)
 {
+       /*
+        * Since we access the comm member in current's task_struct, we only
+        * need to be as large as what 'comm' in that structure is.
+        */
+       char comm[TASK_COMM_LEN];
        struct pti_masterchannel mccontrol = {.master = CONTROL_ID,
                                              .channel = 0};
        const char *thread_name_p;
@@ -170,13 +177,6 @@ static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc,
        u8 control_frame[CONTROL_FRAME_LEN];
 
        if (!thread_name) {
-               /*
-                * Since we access the comm member in current's task_struct,
-                * we only need to be as large as what 'comm' in that
-                * structure is.
-                */
-               char comm[TASK_COMM_LEN];
-
                if (!in_interrupt())
                        get_task_comm(comm, current);
                else
@@ -481,13 +481,9 @@ static int pti_tty_install(struct tty_driver *driver, struct tty_struct *tty)
 {
        int idx = tty->index;
        struct pti_tty *pti_tty_data;
-       int ret = tty_init_termios(tty);
+       int ret = tty_standard_install(driver, tty);
 
        if (ret == 0) {
-               tty_driver_kref_get(driver);
-               tty->count++;
-               driver->ttys[idx] = tty;
-
                pti_tty_data = kmalloc(sizeof(struct pti_tty), GFP_KERNEL);
                if (pti_tty_data == NULL)
                        return -ENOMEM;
@@ -911,21 +907,17 @@ static int __init pti_init(void)
 
        /* First register module as tty device */
 
-       pti_tty_driver = alloc_tty_driver(1);
+       pti_tty_driver = alloc_tty_driver(PTITTY_MINOR_NUM);
        if (pti_tty_driver == NULL) {
                pr_err("%s(%d): Memory allocation failed for ptiTTY driver\n",
                        __func__, __LINE__);
                return -ENOMEM;
        }
 
-       pti_tty_driver->owner                   = THIS_MODULE;
-       pti_tty_driver->magic                   = TTY_DRIVER_MAGIC;
        pti_tty_driver->driver_name             = DRIVERNAME;
        pti_tty_driver->name                    = TTYNAME;
        pti_tty_driver->major                   = 0;
        pti_tty_driver->minor_start             = PTITTY_MINOR_START;
-       pti_tty_driver->minor_num               = PTITTY_MINOR_NUM;
-       pti_tty_driver->num                     = PTITTY_MINOR_NUM;
        pti_tty_driver->type                    = TTY_DRIVER_TYPE_SYSTEM;
        pti_tty_driver->subtype                 = SYSTEM_TYPE_SYSCONS;
        pti_tty_driver->flags                   = TTY_DRIVER_REAL_RAW |