X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fhid%2Fhidraw.c;h=8ecd775251039c32ddffb23cb489f55846c0c73f;hb=6a250778c79d6d14db9ed8e1f86f7b934e2bf3dc;hp=a702e2f6da7d953892a468574e8348e23397e735;hpb=13626cb91f41df803c54047172bfc7a716e36c2b;p=linux-2.6 diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index a702e2f6da..8ecd775251 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -30,6 +30,7 @@ #include #include #include +#include #include @@ -113,13 +114,13 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t if (count > HID_MIN_BUFFER_SIZE) { printk(KERN_WARNING "hidraw: pid %d passed too large report\n", - current->pid); + task_pid_nr(current)); return -EINVAL; } if (count < 2) { printk(KERN_WARNING "hidraw: pid %d passed too short report\n", - current->pid); + task_pid_nr(current)); return -EINVAL; } @@ -157,6 +158,7 @@ static int hidraw_open(struct inode *inode, struct file *file) struct hidraw_list *list; int err = 0; + lock_kernel(); if (!(list = kzalloc(sizeof(struct hidraw_list), GFP_KERNEL))) { err = -ENOMEM; goto out; @@ -183,6 +185,7 @@ static int hidraw_open(struct inode *inode, struct file *file) out_unlock: spin_unlock(&minors_lock); out: + unlock_kernel(); return err; } @@ -208,6 +211,8 @@ static int hidraw_release(struct inode * inode, struct file * file) kfree(list->hidraw); } + kfree(list); + return 0; } @@ -319,8 +324,9 @@ int hidraw_connect(struct hid_device *hid) goto out; } - dev->dev = device_create(hidraw_class, NULL, MKDEV(hidraw_major, minor), - "%s%d", "hidraw", minor); + dev->dev = device_create_drvdata(hidraw_class, NULL, + MKDEV(hidraw_major, minor), NULL, + "%s%d", "hidraw", minor); if (IS_ERR(dev->dev)) { spin_lock(&minors_lock);