Skip to content

Commit

Permalink
Merge branch 'autosuspend' into for-next
Browse files Browse the repository at this point in the history
Conflicts:

	drivers/hid/hid-core.c
  • Loading branch information
Jiri Kosina committed Mar 30, 2009
2 parents afa5eb7 + 6d77976 commit 621de59
Show file tree
Hide file tree
Showing 6 changed files with 428 additions and 114 deletions.
16 changes: 16 additions & 0 deletions drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1819,6 +1819,22 @@ void hid_unregister_driver(struct hid_driver *hdrv)
}
EXPORT_SYMBOL_GPL(hid_unregister_driver);

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)
{
int ret;
Expand Down
17 changes: 14 additions & 3 deletions drivers/hid/hidraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,17 @@ static int hidraw_open(struct inode *inode, struct file *file)

dev = hidraw_table[minor];
if (!dev->open++) {
if (dev->hid->ll_driver->power) {
err = dev->hid->ll_driver->power(dev->hid, PM_HINT_FULLON);
if (err < 0)
goto out_unlock;
}
err = dev->hid->ll_driver->open(dev->hid);
if (err < 0)
if (err < 0) {
if (dev->hid->ll_driver->power)
dev->hid->ll_driver->power(dev->hid, PM_HINT_NORMAL);
dev->open--;
}
}

out_unlock:
Expand All @@ -209,10 +217,13 @@ static int hidraw_release(struct inode * inode, struct file * file)
list_del(&list->node);
dev = hidraw_table[minor];
if (!--dev->open) {
if (list->hidraw->exist)
if (list->hidraw->exist) {
if (dev->hid->ll_driver->power)
dev->hid->ll_driver->power(dev->hid, PM_HINT_NORMAL);
dev->hid->ll_driver->close(dev->hid);
else
} else {
kfree(list->hidraw);
}
}

kfree(list);
Expand Down
Loading

0 comments on commit 621de59

Please sign in to comment.