diff options
Diffstat (limited to 'drivers/usb/input/hiddev.c')
-rw-r--r-- | drivers/usb/input/hiddev.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c index 7dc14d0cacc1..a8b3d66cd498 100644 --- a/drivers/usb/input/hiddev.c +++ b/drivers/usb/input/hiddev.c | |||
@@ -32,8 +32,9 @@ | |||
32 | #include <linux/smp_lock.h> | 32 | #include <linux/smp_lock.h> |
33 | #include <linux/input.h> | 33 | #include <linux/input.h> |
34 | #include <linux/usb.h> | 34 | #include <linux/usb.h> |
35 | #include "hid.h" | 35 | #include <linux/hid.h> |
36 | #include <linux/hiddev.h> | 36 | #include <linux/hiddev.h> |
37 | #include "usbhid.h" | ||
37 | 38 | ||
38 | #ifdef CONFIG_USB_DYNAMIC_MINORS | 39 | #ifdef CONFIG_USB_DYNAMIC_MINORS |
39 | #define HIDDEV_MINOR_BASE 0 | 40 | #define HIDDEV_MINOR_BASE 0 |
@@ -196,7 +197,7 @@ void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, | |||
196 | 197 | ||
197 | hiddev_send_event(hid, &uref); | 198 | hiddev_send_event(hid, &uref); |
198 | } | 199 | } |
199 | 200 | EXPORT_SYMBOL_GPL(hiddev_hid_event); | |
200 | 201 | ||
201 | void hiddev_report_event(struct hid_device *hid, struct hid_report *report) | 202 | void hiddev_report_event(struct hid_device *hid, struct hid_report *report) |
202 | { | 203 | { |
@@ -213,6 +214,7 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report) | |||
213 | 214 | ||
214 | hiddev_send_event(hid, &uref); | 215 | hiddev_send_event(hid, &uref); |
215 | } | 216 | } |
217 | |||
216 | /* | 218 | /* |
217 | * fasync file op | 219 | * fasync file op |
218 | */ | 220 | */ |
@@ -239,7 +241,7 @@ static int hiddev_release(struct inode * inode, struct file * file) | |||
239 | 241 | ||
240 | if (!--list->hiddev->open) { | 242 | if (!--list->hiddev->open) { |
241 | if (list->hiddev->exist) | 243 | if (list->hiddev->exist) |
242 | hid_close(list->hiddev->hid); | 244 | usbhid_close(list->hiddev->hid); |
243 | else | 245 | else |
244 | kfree(list->hiddev); | 246 | kfree(list->hiddev); |
245 | } | 247 | } |
@@ -270,7 +272,7 @@ static int hiddev_open(struct inode *inode, struct file *file) | |||
270 | 272 | ||
271 | if (!list->hiddev->open++) | 273 | if (!list->hiddev->open++) |
272 | if (list->hiddev->exist) | 274 | if (list->hiddev->exist) |
273 | hid_open(hiddev_table[i]->hid); | 275 | usbhid_open(hiddev_table[i]->hid); |
274 | 276 | ||
275 | return 0; | 277 | return 0; |
276 | } | 278 | } |
@@ -382,7 +384,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
382 | struct hiddev_list *list = file->private_data; | 384 | struct hiddev_list *list = file->private_data; |
383 | struct hiddev *hiddev = list->hiddev; | 385 | struct hiddev *hiddev = list->hiddev; |
384 | struct hid_device *hid = hiddev->hid; | 386 | struct hid_device *hid = hiddev->hid; |
385 | struct usb_device *dev = hid->dev; | 387 | struct usb_device *dev = hid_to_usb_dev(hid); |
386 | struct hiddev_collection_info cinfo; | 388 | struct hiddev_collection_info cinfo; |
387 | struct hiddev_report_info rinfo; | 389 | struct hiddev_report_info rinfo; |
388 | struct hiddev_field_info finfo; | 390 | struct hiddev_field_info finfo; |
@@ -391,6 +393,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
391 | struct hiddev_devinfo dinfo; | 393 | struct hiddev_devinfo dinfo; |
392 | struct hid_report *report; | 394 | struct hid_report *report; |
393 | struct hid_field *field; | 395 | struct hid_field *field; |
396 | struct usbhid_device *usbhid = hid->driver_data; | ||
394 | void __user *user_arg = (void __user *)arg; | 397 | void __user *user_arg = (void __user *)arg; |
395 | int i; | 398 | int i; |
396 | 399 | ||
@@ -420,7 +423,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
420 | dinfo.bustype = BUS_USB; | 423 | dinfo.bustype = BUS_USB; |
421 | dinfo.busnum = dev->bus->busnum; | 424 | dinfo.busnum = dev->bus->busnum; |
422 | dinfo.devnum = dev->devnum; | 425 | dinfo.devnum = dev->devnum; |
423 | dinfo.ifnum = hid->ifnum; | 426 | dinfo.ifnum = usbhid->ifnum; |
424 | dinfo.vendor = le16_to_cpu(dev->descriptor.idVendor); | 427 | dinfo.vendor = le16_to_cpu(dev->descriptor.idVendor); |
425 | dinfo.product = le16_to_cpu(dev->descriptor.idProduct); | 428 | dinfo.product = le16_to_cpu(dev->descriptor.idProduct); |
426 | dinfo.version = le16_to_cpu(dev->descriptor.bcdDevice); | 429 | dinfo.version = le16_to_cpu(dev->descriptor.bcdDevice); |
@@ -479,7 +482,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
479 | } | 482 | } |
480 | 483 | ||
481 | case HIDIOCINITREPORT: | 484 | case HIDIOCINITREPORT: |
482 | hid_init_reports(hid); | 485 | usbhid_init_reports(hid); |
483 | 486 | ||
484 | return 0; | 487 | return 0; |
485 | 488 | ||
@@ -493,8 +496,8 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
493 | if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) | 496 | if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) |
494 | return -EINVAL; | 497 | return -EINVAL; |
495 | 498 | ||
496 | hid_submit_report(hid, report, USB_DIR_IN); | 499 | usbhid_submit_report(hid, report, USB_DIR_IN); |
497 | hid_wait_io(hid); | 500 | usbhid_wait_io(hid); |
498 | 501 | ||
499 | return 0; | 502 | return 0; |
500 | 503 | ||
@@ -508,8 +511,8 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
508 | if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) | 511 | if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) |
509 | return -EINVAL; | 512 | return -EINVAL; |
510 | 513 | ||
511 | hid_submit_report(hid, report, USB_DIR_OUT); | 514 | usbhid_submit_report(hid, report, USB_DIR_OUT); |
512 | hid_wait_io(hid); | 515 | usbhid_wait_io(hid); |
513 | 516 | ||
514 | return 0; | 517 | return 0; |
515 | 518 | ||
@@ -745,6 +748,7 @@ static struct usb_class_driver hiddev_class = { | |||
745 | int hiddev_connect(struct hid_device *hid) | 748 | int hiddev_connect(struct hid_device *hid) |
746 | { | 749 | { |
747 | struct hiddev *hiddev; | 750 | struct hiddev *hiddev; |
751 | struct usbhid_device *usbhid = hid->driver_data; | ||
748 | int i; | 752 | int i; |
749 | int retval; | 753 | int retval; |
750 | 754 | ||
@@ -760,7 +764,7 @@ int hiddev_connect(struct hid_device *hid) | |||
760 | if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL))) | 764 | if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL))) |
761 | return -1; | 765 | return -1; |
762 | 766 | ||
763 | retval = usb_register_dev(hid->intf, &hiddev_class); | 767 | retval = usb_register_dev(usbhid->intf, &hiddev_class); |
764 | if (retval) { | 768 | if (retval) { |
765 | err("Not able to get a minor for this device."); | 769 | err("Not able to get a minor for this device."); |
766 | kfree(hiddev); | 770 | kfree(hiddev); |
@@ -772,10 +776,10 @@ int hiddev_connect(struct hid_device *hid) | |||
772 | hiddev->hid = hid; | 776 | hiddev->hid = hid; |
773 | hiddev->exist = 1; | 777 | hiddev->exist = 1; |
774 | 778 | ||
775 | hid->minor = hid->intf->minor; | 779 | hid->minor = usbhid->intf->minor; |
776 | hid->hiddev = hiddev; | 780 | hid->hiddev = hiddev; |
777 | 781 | ||
778 | hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev; | 782 | hiddev_table[usbhid->intf->minor - HIDDEV_MINOR_BASE] = hiddev; |
779 | 783 | ||
780 | return 0; | 784 | return 0; |
781 | } | 785 | } |
@@ -788,14 +792,15 @@ static struct usb_class_driver hiddev_class; | |||
788 | void hiddev_disconnect(struct hid_device *hid) | 792 | void hiddev_disconnect(struct hid_device *hid) |
789 | { | 793 | { |
790 | struct hiddev *hiddev = hid->hiddev; | 794 | struct hiddev *hiddev = hid->hiddev; |
795 | struct usbhid_device *usbhid = hid->driver_data; | ||
791 | 796 | ||
792 | hiddev->exist = 0; | 797 | hiddev->exist = 0; |
793 | 798 | ||
794 | hiddev_table[hiddev->hid->minor - HIDDEV_MINOR_BASE] = NULL; | 799 | hiddev_table[hiddev->hid->minor - HIDDEV_MINOR_BASE] = NULL; |
795 | usb_deregister_dev(hiddev->hid->intf, &hiddev_class); | 800 | usb_deregister_dev(usbhid->intf, &hiddev_class); |
796 | 801 | ||
797 | if (hiddev->open) { | 802 | if (hiddev->open) { |
798 | hid_close(hiddev->hid); | 803 | usbhid_close(hiddev->hid); |
799 | wake_up_interruptible(&hiddev->wait); | 804 | wake_up_interruptible(&hiddev->wait); |
800 | } else { | 805 | } else { |
801 | kfree(hiddev); | 806 | kfree(hiddev); |