aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-roccat.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-12-08 02:02:48 -0500
committerJiri Kosina <jkosina@suse.cz>2010-12-08 08:35:14 -0500
commit5bea7660bba973dc5e8e9d92b11fb1dd5b524ebf (patch)
tree511ae632c2d2c22d94956ed2d236bd8654d27ff0 /drivers/hid/hid-roccat.c
parent33d6eb570b1f3fe5ba93cef465c5be66535c2c9a (diff)
HID: add hid_hw_open/close/power() handlers
Instead of exposing the guts of hid->ll_driver relationship to HID sub-drivers provide these helpers to encapsulate the details. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-roccat.c')
-rw-r--r--drivers/hid/hid-roccat.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/hid/hid-roccat.c b/drivers/hid/hid-roccat.c
index 5a6879e235ac..a9d9b29ff47f 100644
--- a/drivers/hid/hid-roccat.c
+++ b/drivers/hid/hid-roccat.c
@@ -173,19 +173,15 @@ static int roccat_open(struct inode *inode, struct file *file)
173 173
174 if (!device->open++) { 174 if (!device->open++) {
175 /* power on device on adding first reader */ 175 /* power on device on adding first reader */
176 if (device->hid->ll_driver->power) { 176 error = hid_hw_power(device->hid, PM_HINT_FULLON);
177 error = device->hid->ll_driver->power(device->hid, 177 if (error < 0) {
178 PM_HINT_FULLON); 178 --device->open;
179 if (error < 0) { 179 goto exit_err;
180 --device->open;
181 goto exit_err;
182 }
183 } 180 }
184 error = device->hid->ll_driver->open(device->hid); 181
182 error = hid_hw_open(device->hid);
185 if (error < 0) { 183 if (error < 0) {
186 if (device->hid->ll_driver->power) 184 hid_hw_power(device->hid, PM_HINT_NORMAL);
187 device->hid->ll_driver->power(device->hid,
188 PM_HINT_NORMAL);
189 --device->open; 185 --device->open;
190 goto exit_err; 186 goto exit_err;
191 } 187 }
@@ -231,10 +227,8 @@ static int roccat_release(struct inode *inode, struct file *file)
231 if (!--device->open) { 227 if (!--device->open) {
232 /* removing last reader */ 228 /* removing last reader */
233 if (device->exist) { 229 if (device->exist) {
234 if (device->hid->ll_driver->power) 230 hid_hw_power(device->hid, PM_HINT_NORMAL);
235 device->hid->ll_driver->power(device->hid, 231 hid_hw_close(device->hid);
236 PM_HINT_NORMAL);
237 device->hid->ll_driver->close(device->hid);
238 } else { 232 } else {
239 kfree(device); 233 kfree(device);
240 } 234 }
@@ -370,7 +364,7 @@ void roccat_disconnect(int minor)
370 device_destroy(roccat_class, MKDEV(roccat_major, minor)); 364 device_destroy(roccat_class, MKDEV(roccat_major, minor));
371 365
372 if (device->open) { 366 if (device->open) {
373 device->hid->ll_driver->close(device->hid); 367 hid_hw_close(device->hid);
374 wake_up_interruptible(&device->wait); 368 wake_up_interruptible(&device->wait);
375 } else { 369 } else {
376 kfree(device); 370 kfree(device);