port of usbhid autosuspend to hidbus tree
PATCH 1/1 port of usbhid autosuspend to hidbus tree
Hi,
this ports the usbhid autosuspend to Jiri's tree with hidbus
Regards
Oliver
Signed-off-by: Olidiff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 426ac5a..235ac96 100644
drivers/hid/hid-core.c +16 -0
@@ -1006,6 +1006,22 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i }EXPORT_SYMBOL_GPL (hid_input_report); +int hid_check_keys_pressed (struct hid_device *hid) +{ +struct hid_input *hidinput; +int i; + +list_for_each_entry (hidinput, &hid->inputs, list) { +for (i =0 ; i <BITS_TO_LONGS (KEY_MAX ); i++) +if (hidinput->input->key[i]) +return 1 ; + } + +return 0 ; +} + +EXPORT_SYMBOL_GPL (hid_check_keys_pressed); +static int __init hid_init (void ) {return hidraw_init ();
drivers/hid/usbhid/hid-core.c +313 -71
632 lines not on this page · raw message
drivers/hid/usbhid/hiddev.c +12 -4
@@ -249,10 +249,12 @@ static int hiddev_release(struct inode * inode, struct file * file)spin_unlock_irqrestore (&list->hiddev->list_lock, flags);if (!--list->hiddev->open) { -if (list->hiddev->exist) +if (list->hiddev->exist) {usbhid_close (list->hiddev->hid); -else +usbhid_put_power (list->hiddev->hid); + }else {kfree (list->hiddev); + } }kfree (list);
@@ -267,6 +269,7 @@ static int hiddev_open(struct inode *inode, struct file *file) {struct hiddev_list *list;unsigned long flags; +int res;int i =iminor (inode) -HIDDEV_MINOR_BASE ;
@@ -285,8 +288,13 @@ static int hiddev_open(struct inode *inode, struct file *file) file->private_data = list;if (!list->hiddev->open++) -if (list->hiddev->exist) -usbhid_open (hiddev_table[i]->hid); +if (list->hiddev->exist) { +struct hid_device *hid = hiddev_table[i]->hid; + res =usbhid_get_power (hid); +if (res <0 ) +return -EIO ; +usbhid_open (hid); + }return 0 ; }
drivers/hid/usbhid/usbhid.h +6 -3
@@ -37,7 +37,10 @@ int usbhid_wait_io(struct hid_device* hid);void usbhid_close (struct hid_device *hid);int usbhid_open (struct hid_device *hid);void usbhid_init_reports (struct hid_device *hid); -void usbhid_submit_report (struct hid_device *hid,struct hid_report *report,unsigned char dir); +void usbhid_submit_report +(struct hid_device *hid,struct hid_report *report,unsigned char dir); +int usbhid_get_power (struct hid_device *hid); +void usbhid_put_power (struct hid_device *hid);/* * USB-specific HID struct, to be pointed to
@@ -64,20 +67,20 @@ struct usbhid_device {unsigned char ctrlhead, ctrltail;/* Control fifo head & tail */ char *ctrlbuf;/* Control buffer */ dma_addr_t ctrlbuf_dma;/* Control buffer dma */ -spinlock_t ctrllock;/* Control fifo spinlock */ struct urb *urbout;/* Output URB */ struct hid_report *out[HID_CONTROL_FIFO_SIZE ];/* Output pipe fifo */ unsigned char outhead, outtail;/* Output pipe fifo head & tail */ char *outbuf;/* Output buffer */ dma_addr_t outbuf_dma;/* Output buffer dma */ -spinlock_t outlock;/* Output fifo spinlock */ +spinlock_t outputlock;/* Output fifo spinlock */ unsigned long iofl;/* I/O flags (CTRL_RUNNING, OUT_RUNNING) */ struct timer_list io_retry;/* Retry timer */ unsigned long stop_retry;/* Time to give up, in jiffies */ unsigned int retry_delay;/* Delay length in ms */ struct work_struct reset_work;/* Task context for resets */ +struct work_struct restart_work;/* waking up for output to be done in a task */ wait_queue_head_t wait;/* For sleeping */ };
include/linux/hid.h +4 -0
@@ -424,6 +424,9 @@ struct hid_control_fifo {#define HID_SUSPENDED 5#define HID_CLEAR_HALT 6#define HID_DISCONNECTED 7 +#define HID_REPORTED_IDLE 8 +#define HID_KEYS_PRESSED 9 +#define HID_LED_ON 10struct hid_input {struct list_head list;
@@ -534,6 +537,7 @@ int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usavoid hid_output_report (struct hid_report *report,__u8 *data);void hid_free_device (struct hid_device *device);struct hid_device *hid_parse_report (__u8 *start,unsigned size); +int hid_check_keys_pressed (struct hid_device *hid);/* HID quirks API */ u32 usbhid_lookup_quirk (const u16 idVendor,const u16 idProduct);
ver Neukum <[email protected]>
---
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line · Oliver Neukum
this ports the usbhid autosuspend to Jiri's tree with hidbus
Hi Oliver,
so did I get it right that you are going to send me an updated version with improved LED handling, which I then could queue for -next?
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs
A message that is not in the archive (sent off-list or not yet received): alpine.LNX.1.10.0810171146180.28536-YCXOAqNspd+N3ZZ/[email protected]
Am Freitag, 17. Oktober 2008 11:47:00 schrieb Jiri Kosina:
Quoted 8 lines · Oliver Neukum
Quoted 2 lines
this ports the usbhid autosuspend to Jiri's tree with hidbus
Hi Oliver,
so did I get it right that you are going to send me an updated version with improved LED handling, which I then could queue for -next?
Next week. I have too many bugs to look at this week.
Regards
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html