Skip to contentSkip to conversation

HID: hidraw: fix power sequence when closing device

PATCH Applied Dmitry Torokhov 4 participants 4 messages Sep 20, 2017 – Oct 2, 2017 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: hidraw: fix power sequence when closing device

We should not try to bring HID device out of full power state before calling hid_hw_close(), so that transport driver operates on powered up device (making this inverse of the opening sequence).

---
 drivers/hid/hidraw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hidraw.c +1 -1
index ec530454e6f6..5fbe0f81ab2e 100644
@@ -337,8 +337,8 @@ static void drop_ref(struct hidraw *hidraw, int exists_bit)
 			kfree(hidraw);
 		} else {
 			/* close device for last reader */
-			hid_hw_power(hidraw->hid, PM_HINT_NORMAL);
 			hid_hw_close(hidraw->hid);
+			hid_hw_power(hidraw->hid, PM_HINT_NORMAL);
 		}
 	}
 }
Signature · 5 lines
2.14.1.821.g8fa685d3b7-goog


-- 
Dmitry
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Dmitry Torokhov

We should not try to bring HID device out of full power state before calling hid_hw_close(), so that transport driver operates on powered up device (making this inverse of the opening sequence).

Quoted 24 lines
---
 drivers/hid/hidraw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hidraw.c +1 -2
index ec530454e6f6..5fbe0f81ab2e 100644
@@ -337,8 +337,8 @@ static void drop_ref(struct hidraw *hidraw, int exists_bit)
                        kfree(hidraw);
                } else {
                        /* close device for last reader */
-                       hid_hw_power(hidraw->hid, PM_HINT_NORMAL);
                        hid_hw_close(hidraw->hid);
+                       hid_hw_power(hidraw->hid, PM_HINT_NORMAL);
                }
        }
 }
--

2.14.1.821.g8fa685d3b7-goog

--
Dmitry

Reviewed-by on v1 1/1
#2 lore raw
In reply to Dmitry Torokhov

Hi Dmitry,

Quoted 5 lines · Dmitry Torokhov

We should not try to bring HID device out of full power state before calling hid_hw_close(), so that transport driver operates on powered up device (making this inverse of the opening sequence).

Signature · 7 lines
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
[email protected]
Chromium OS Project
[email protected]
maintainer Applied
#3 lore raw
In reply to Dmitry Torokhov
Quoted 5 lines · Dmitry Torokhov

We should not try to bring HID device out of full power state before calling hid_hw_close(), so that transport driver operates on powered up device (making this inverse of the opening sequence).

Applied to for-4.14/upstream-fixes. Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs