diff options
author | Jiri Kosina <jkosina@suse.cz> | 2006-12-08 12:41:03 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-12-08 13:43:14 -0500 |
commit | 4916b3a57fc94664677d439b911b8aaf86c7ec23 (patch) | |
tree | fc8038ec52950ddfdb1c6c66f90eb1c381e446ca /drivers/usb/input/hiddev.c | |
parent | 229695e51efc4ed5e04ab471c82591d0f432909d (diff) |
[PATCH] Generic HID layer - USB API
- 'dev' in struct hid_device changed from struct usb_device to
struct device and fixed all the users
- renamed functions which are part of USB HID API from 'hid_*' to
'usbhid_*'
- force feedback initialization moved from common part into USB-specific
driver
- added usbhid.h header for USB HID API users
- removed USB-specific fields from struct hid_device and moved them
to new usbhid_device, which is pointed to by hid_device->driver_data
- fixed all USB users to use this new structure
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/input/hiddev.c')
-rw-r--r-- | drivers/usb/input/hiddev.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c index 07d7996575cd..0c2647eb9eec 100644 --- a/drivers/usb/input/hiddev.c +++ b/drivers/usb/input/hiddev.c | |||
@@ -240,7 +240,7 @@ static int hiddev_release(struct inode * inode, struct file * file) | |||
240 | 240 | ||
241 | if (!--list->hiddev->open) { | 241 | if (!--list->hiddev->open) { |
242 | if (list->hiddev->exist) | 242 | if (list->hiddev->exist) |
243 | hid_close(list->hiddev->hid); | 243 | usbhid_close(list->hiddev->hid); |
244 | else | 244 | else |
245 | kfree(list->hiddev); | 245 | kfree(list->hiddev); |
246 | } | 246 | } |
@@ -271,7 +271,7 @@ static int hiddev_open(struct inode *inode, struct file *file) | |||
271 | 271 | ||
272 | if (!list->hiddev->open++) | 272 | if (!list->hiddev->open++) |
273 | if (list->hiddev->exist) | 273 | if (list->hiddev->exist) |
274 | hid_open(hiddev_table[i]->hid); | 274 | usbhid_open(hiddev_table[i]->hid); |
275 | 275 | ||
276 | return 0; | 276 | return 0; |
277 | } | 277 | } |
@@ -383,7 +383,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
383 | struct hiddev_list *list = file->private_data; | 383 | struct hiddev_list *list = file->private_data; |
384 | struct hiddev *hiddev = list->hiddev; | 384 | struct hiddev *hiddev = list->hiddev; |
385 | struct hid_device *hid = hiddev->hid; | 385 | struct hid_device *hid = hiddev->hid; |
386 | struct usb_device *dev = hid->dev; | 386 | struct usb_device *dev = to_usb_device(hid->dev); |
387 | struct hiddev_collection_info cinfo; | 387 | struct hiddev_collection_info cinfo; |
388 | struct hiddev_report_info rinfo; | 388 | struct hiddev_report_info rinfo; |
389 | struct hiddev_field_info finfo; | 389 | struct hiddev_field_info finfo; |
@@ -392,6 +392,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
392 | struct hiddev_devinfo dinfo; | 392 | struct hiddev_devinfo dinfo; |
393 | struct hid_report *report; | 393 | struct hid_report *report; |
394 | struct hid_field *field; | 394 | struct hid_field *field; |
395 | struct usbhid_device *usbhid = hid->driver_data; | ||
395 | void __user *user_arg = (void __user *)arg; | 396 | void __user *user_arg = (void __user *)arg; |
396 | int i; | 397 | int i; |
397 | 398 | ||
@@ -421,7 +422,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
421 | dinfo.bustype = BUS_USB; | 422 | dinfo.bustype = BUS_USB; |
422 | dinfo.busnum = dev->bus->busnum; | 423 | dinfo.busnum = dev->bus->busnum; |
423 | dinfo.devnum = dev->devnum; | 424 | dinfo.devnum = dev->devnum; |
424 | dinfo.ifnum = hid->ifnum; | 425 | dinfo.ifnum = usbhid->ifnum; |
425 | dinfo.vendor = le16_to_cpu(dev->descriptor.idVendor); | 426 | dinfo.vendor = le16_to_cpu(dev->descriptor.idVendor); |
426 | dinfo.product = le16_to_cpu(dev->descriptor.idProduct); | 427 | dinfo.product = le16_to_cpu(dev->descriptor.idProduct); |
427 | dinfo.version = le16_to_cpu(dev->descriptor.bcdDevice); | 428 | dinfo.version = le16_to_cpu(dev->descriptor.bcdDevice); |
@@ -480,7 +481,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
480 | } | 481 | } |
481 | 482 | ||
482 | case HIDIOCINITREPORT: | 483 | case HIDIOCINITREPORT: |
483 | hid_init_reports(hid); | 484 | usbhid_init_reports(hid); |
484 | 485 | ||
485 | return 0; | 486 | return 0; |
486 | 487 | ||
@@ -494,8 +495,8 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
494 | if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) | 495 | if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) |
495 | return -EINVAL; | 496 | return -EINVAL; |
496 | 497 | ||
497 | hid_submit_report(hid, report, USB_DIR_IN); | 498 | usbhid_submit_report(hid, report, USB_DIR_IN); |
498 | hid_wait_io(hid); | 499 | usbhid_wait_io(hid); |
499 | 500 | ||
500 | return 0; | 501 | return 0; |
501 | 502 | ||
@@ -509,8 +510,8 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
509 | if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) | 510 | if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) |
510 | return -EINVAL; | 511 | return -EINVAL; |
511 | 512 | ||
512 | hid_submit_report(hid, report, USB_DIR_OUT); | 513 | usbhid_submit_report(hid, report, USB_DIR_OUT); |
513 | hid_wait_io(hid); | 514 | usbhid_wait_io(hid); |
514 | 515 | ||
515 | return 0; | 516 | return 0; |
516 | 517 | ||
@@ -746,6 +747,7 @@ static struct usb_class_driver hiddev_class = { | |||
746 | int hiddev_connect(struct hid_device *hid) | 747 | int hiddev_connect(struct hid_device *hid) |
747 | { | 748 | { |
748 | struct hiddev *hiddev; | 749 | struct hiddev *hiddev; |
750 | struct usbhid_device *usbhid = hid->driver_data; | ||
749 | int i; | 751 | int i; |
750 | int retval; | 752 | int retval; |
751 | 753 | ||
@@ -761,7 +763,7 @@ int hiddev_connect(struct hid_device *hid) | |||
761 | if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL))) | 763 | if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL))) |
762 | return -1; | 764 | return -1; |
763 | 765 | ||
764 | retval = usb_register_dev(hid->intf, &hiddev_class); | 766 | retval = usb_register_dev(usbhid->intf, &hiddev_class); |
765 | if (retval) { | 767 | if (retval) { |
766 | err("Not able to get a minor for this device."); | 768 | err("Not able to get a minor for this device."); |
767 | kfree(hiddev); | 769 | kfree(hiddev); |
@@ -773,10 +775,10 @@ int hiddev_connect(struct hid_device *hid) | |||
773 | hiddev->hid = hid; | 775 | hiddev->hid = hid; |
774 | hiddev->exist = 1; | 776 | hiddev->exist = 1; |
775 | 777 | ||
776 | hid->minor = hid->intf->minor; | 778 | hid->minor = usbhid->intf->minor; |
777 | hid->hiddev = hiddev; | 779 | hid->hiddev = hiddev; |
778 | 780 | ||
779 | hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev; | 781 | hiddev_table[usbhid->intf->minor - HIDDEV_MINOR_BASE] = hiddev; |
780 | 782 | ||
781 | return 0; | 783 | return 0; |
782 | } | 784 | } |
@@ -789,14 +791,15 @@ static struct usb_class_driver hiddev_class; | |||
789 | void hiddev_disconnect(struct hid_device *hid) | 791 | void hiddev_disconnect(struct hid_device *hid) |
790 | { | 792 | { |
791 | struct hiddev *hiddev = hid->hiddev; | 793 | struct hiddev *hiddev = hid->hiddev; |
794 | struct usbhid_device *usbhid = hid->driver_data; | ||
792 | 795 | ||
793 | hiddev->exist = 0; | 796 | hiddev->exist = 0; |
794 | 797 | ||
795 | hiddev_table[hiddev->hid->minor - HIDDEV_MINOR_BASE] = NULL; | 798 | hiddev_table[hiddev->hid->minor - HIDDEV_MINOR_BASE] = NULL; |
796 | usb_deregister_dev(hiddev->hid->intf, &hiddev_class); | 799 | usb_deregister_dev(usbhid->intf, &hiddev_class); |
797 | 800 | ||
798 | if (hiddev->open) { | 801 | if (hiddev->open) { |
799 | hid_close(hiddev->hid); | 802 | usbhid_close(hiddev->hid); |
800 | wake_up_interruptible(&hiddev->wait); | 803 | wake_up_interruptible(&hiddev->wait); |
801 | } else { | 804 | } else { |
802 | kfree(hiddev); | 805 | kfree(hiddev); |