linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: hidraw: fix power sequence when closing device
@ 2017-09-20  1:37 Dmitry Torokhov
  2017-09-20  1:45 ` Guenter Roeck
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2017-09-20  1:37 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: Benjamin Tissoires, Benson Leung, Oliver Neukum, Guenter Roeck,
	linux-input, linux-kernel

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 <dmitry.torokhov@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] HID: hidraw: fix power sequence when closing device
  2017-09-20  1:37 [PATCH] HID: hidraw: fix power sequence when closing device Dmitry Torokhov
@ 2017-09-20  1:45 ` Guenter Roeck
  2017-09-20  6:37 ` Benson Leung
  2017-10-02  9:46 ` Jiri Kosina
  2 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2017-09-20  1:45 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Jiri Kosina, Benjamin Tissoires, Benson Leung, Oliver Neukum,
	Guenter Roeck, linux-input, linux-kernel

On Tue, Sep 19, 2017 at 6:37 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> 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 <dmitry.torokhov@gmail.com>

Reviewed-by: Guenter Roeck <groeck@chromium.org>

> ---
>  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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] HID: hidraw: fix power sequence when closing device
  2017-09-20  1:37 [PATCH] HID: hidraw: fix power sequence when closing device Dmitry Torokhov
  2017-09-20  1:45 ` Guenter Roeck
@ 2017-09-20  6:37 ` Benson Leung
  2017-10-02  9:46 ` Jiri Kosina
  2 siblings, 0 replies; 4+ messages in thread
From: Benson Leung @ 2017-09-20  6:37 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Jiri Kosina, Benjamin Tissoires, Benson Leung, Oliver Neukum,
	Guenter Roeck, linux-input, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 539 bytes --]

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 <dmitry.torokhov@gmail.com>

Reviewed-by: Benson Leung <bleung@chromium.org>

-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] HID: hidraw: fix power sequence when closing device
  2017-09-20  1:37 [PATCH] HID: hidraw: fix power sequence when closing device Dmitry Torokhov
  2017-09-20  1:45 ` Guenter Roeck
  2017-09-20  6:37 ` Benson Leung
@ 2017-10-02  9:46 ` Jiri Kosina
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2017-10-02  9:46 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Benjamin Tissoires, Benson Leung, Oliver Neukum, Guenter Roeck,
	linux-input, linux-kernel

On Tue, 19 Sep 2017, 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 <dmitry.torokhov@gmail.com>

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

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-02  9:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-20  1:37 [PATCH] HID: hidraw: fix power sequence when closing device Dmitry Torokhov
2017-09-20  1:45 ` Guenter Roeck
2017-09-20  6:37 ` Benson Leung
2017-10-02  9:46 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).