aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hidraw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hidraw.c')
-rw-r--r--drivers/hid/hidraw.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 02b19db5442e..e263d4731179 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -181,9 +181,17 @@ static int hidraw_open(struct inode *inode, struct file *file)
181 181
182 dev = hidraw_table[minor]; 182 dev = hidraw_table[minor];
183 if (!dev->open++) { 183 if (!dev->open++) {
184 if (dev->hid->ll_driver->power) {
185 err = dev->hid->ll_driver->power(dev->hid, PM_HINT_FULLON);
186 if (err < 0)
187 goto out_unlock;
188 }
184 err = dev->hid->ll_driver->open(dev->hid); 189 err = dev->hid->ll_driver->open(dev->hid);
185 if (err < 0) 190 if (err < 0) {
191 if (dev->hid->ll_driver->power)
192 dev->hid->ll_driver->power(dev->hid, PM_HINT_NORMAL);
186 dev->open--; 193 dev->open--;
194 }
187 } 195 }
188 196
189out_unlock: 197out_unlock:
@@ -209,10 +217,13 @@ static int hidraw_release(struct inode * inode, struct file * file)
209 list_del(&list->node); 217 list_del(&list->node);
210 dev = hidraw_table[minor]; 218 dev = hidraw_table[minor];
211 if (!--dev->open) { 219 if (!--dev->open) {
212 if (list->hidraw->exist) 220 if (list->hidraw->exist) {
221 if (dev->hid->ll_driver->power)
222 dev->hid->ll_driver->power(dev->hid, PM_HINT_NORMAL);
213 dev->hid->ll_driver->close(dev->hid); 223 dev->hid->ll_driver->close(dev->hid);
214 else 224 } else {
215 kfree(list->hidraw); 225 kfree(list->hidraw);
226 }
216 } 227 }
217 228
218 kfree(list); 229 kfree(list);