2017-09-20 01:37:52

by Dmitry Torokhov

[permalink] [raw]
Subject: [PATCH] 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).

Signed-off-by: Dmitry Torokhov <[email protected]>
---
drivers/hid/hidraw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index ec530454e6f6..5fbe0f81ab2e 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -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


2017-09-20 01:45:49

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH] HID: hidraw: fix power sequence when closing device

On Tue, Sep 19, 2017 at 6:37 PM, Dmitry Torokhov
<[email protected]> wrote:
> 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).
>
> Signed-off-by: Dmitry Torokhov <[email protected]>

Reviewed-by: Guenter Roeck <[email protected]>

> ---
> drivers/hid/hidraw.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
> index ec530454e6f6..5fbe0f81ab2e 100644
> --- a/drivers/hid/hidraw.c
> +++ b/drivers/hid/hidraw.c
> @@ -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

2017-09-20 06:37:44

by Benson Leung

[permalink] [raw]
Subject: Re: [PATCH] HID: hidraw: fix power sequence when closing device

Hi Dmitry,

On Tue, Sep 19, 2017 at 06:37:46PM -0700, Dmitry Torokhov wrote:
> 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).
>
> Signed-off-by: Dmitry Torokhov <[email protected]>

Reviewed-by: Benson Leung <[email protected]>

--
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
[email protected]
Chromium OS Project
[email protected]


Attachments:
(No filename) (520.00 B)
signature.asc (819.00 B)
Digital signature
Download all attachments