From patchwork Wed Sep 20 01:37:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 9960579 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BCC3E601E9 for ; Wed, 20 Sep 2017 01:37:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A818C28F53 for ; Wed, 20 Sep 2017 01:37:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A38E28F5C; Wed, 20 Sep 2017 01:37:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CDEC28F53 for ; Wed, 20 Sep 2017 01:37:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751009AbdITBhv (ORCPT ); Tue, 19 Sep 2017 21:37:51 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:34342 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750884AbdITBhu (ORCPT ); Tue, 19 Sep 2017 21:37:50 -0400 Received: by mail-pg0-f65.google.com with SMTP id u18so784547pgo.1; Tue, 19 Sep 2017 18:37:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=k9086i936vIonEYOvBxBfJROLEks3/bgR7K+X+z8zRA=; b=tR+VF4yUHt1Xn3IONiQigwK0i6tuhc1Nma10gKh/NFcpVcia7yaE/YXGlzKpmgtrl7 SDcH6ZpN5HaKKiF8IISXOqetvTLIqRO8FCyASvIzdLQY4/Nm06IvXzr0l6KcbYNQ49xN WWBI2An0Knaw59QjozfIF9iDA39/tPV+o55AMk2mkuRK5CNIxD68T8WYtkXvYoU4YBHs YkiXRGAwW7efts1ty5shB8lUtAefrwt9Wv4J2Gaa4uk7TXiwhO2NGYb2d02wn94Znd2z FAd9FBWNCrFPFZ3eZstM04atdnDhddpIO7g1htM6Sdp2PEkMcJdrXYdHm+b4dh2B3Fvy godg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=k9086i936vIonEYOvBxBfJROLEks3/bgR7K+X+z8zRA=; b=o9wBzRHajFKNAbn26kLvp07H2lH3EyxZ3YSJ8yihRQNsfl3lWg/9/gvn0GRBeF1DRq s4IqKMg+9jMNtIHjuiANgMpNTDm8OhO7hOFcQCeJGLh1m4AZwEdV2LWVtP6BrUm+ad+h 74fTswoud+OeseFq2VHguD44q4PqaWe+MPjyx1l7DdIu1zUxH2JjaNigGE+xmlVpp2GK 43x26ba23EvP8iROqHyYKWNL5duiTf4+NJpN4ezcdTPGjTwvB5Ufx+jIjSvYQpwUZpBT 6GXVQOQGA3G666rRahl19V94TkSqOfsh5xeyRuYYlCL8AmJACodNMwe7nMPFp8IFTeQT LBsg== X-Gm-Message-State: AHPjjUimVVK8IjkOMg0FXycHMoSAkJVXz/yeg7kfWM9+gpY1gx/IyHMv UkykaZPXWZA+VuUWRMdhKoM= X-Google-Smtp-Source: AOwi7QDZlIeNsek3MIWYPSYgU4VLwXHxrZITPkkZHzCLngXujFGg4TIztsTmRx8iUdpPBUjXFRXSWg== X-Received: by 10.99.160.100 with SMTP id u36mr526021pgn.22.1505871469655; Tue, 19 Sep 2017 18:37:49 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1611:48be:da35:72a9:d52f]) by smtp.gmail.com with ESMTPSA id d124sm4586090pfc.42.2017.09.19.18.37.48 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 19 Sep 2017 18:37:49 -0700 (PDT) Date: Tue, 19 Sep 2017 18:37:46 -0700 From: Dmitry Torokhov To: Jiri Kosina Cc: Benjamin Tissoires , Benson Leung , Oliver Neukum , Guenter Roeck , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] HID: hidraw: fix power sequence when closing device Message-ID: <20170920013746.GA33367@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Guenter Roeck Reviewed-by: Benson Leung --- 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); } } }