From patchwork Tue Mar 31 16:14:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 6131801 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E44509F1BE for ; Tue, 31 Mar 2015 16:18:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 295CB2010E for ; Tue, 31 Mar 2015 16:18:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 96BC8201C0 for ; Tue, 31 Mar 2015 16:18:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753044AbbCaQPz (ORCPT ); Tue, 31 Mar 2015 12:15:55 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:34192 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752961AbbCaQPx (ORCPT ); Tue, 31 Mar 2015 12:15:53 -0400 Received: by wixo5 with SMTP id o5so11770674wix.1; Tue, 31 Mar 2015 09:15:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=kuCS7nTexHhU7L3shFRqQUTbclSW1VfZoug6QazdjZc=; b=JduVjBE/vhcfXH9HMXvQmft18hKEybCzcAJRgJa95ixZUMcnMSItvPZpBAmSmhCU53 r3jq/wFkJtN6A7BBTPaAduiqP9+KTEKvctDXhyJFJl7lxIo1U5v4loesHzx/2/yGEsbX WiFdjp0TC8LwWWrSiSIwyDpXP9NYALObdWnn1gc/UXUoz2h+29WsADDzr1tPaoNZapum wJDaRnd+EPqiY4xHrtf+OMTCLYNZn9oc8C0Hi5LxPYPQBeq198PJLKBPoyUkHB6aUTCi Hkfs4tIKtwTRkzr1fTa8aOXeNMJFboThCtzdPQw4ASDXW4dIW2nezM9wU/9tkA1vr/ch mpJQ== X-Received: by 10.194.120.230 with SMTP id lf6mr74343559wjb.78.1427818551554; Tue, 31 Mar 2015 09:15:51 -0700 (PDT) Received: from cizrna.lan ([109.72.12.56]) by mx.google.com with ESMTPSA id lx10sm20984796wjb.17.2015.03.31.09.15.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Mar 2015 09:15:50 -0700 (PDT) From: Tomeu Vizoso To: linux-pm@vger.kernel.org Cc: Tomeu Vizoso , Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] Input: Implement dev_pm_ops.prepare() Date: Tue, 31 Mar 2015 18:14:47 +0200 Message-Id: <1427818501-10201-4-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.3.4 In-Reply-To: <1427818501-10201-1-git-send-email-tomeu.vizoso@collabora.com> References: <1427818501-10201-1-git-send-email-tomeu.vizoso@collabora.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Have it return 1 in both input_dev_type and input_class (for evdev handlers) so that input devices that are runtime-suspended won't be suspended when the system goes to a sleep state. This can make resume times considerably shorter because these devices don't need to be resumed when the system is awaken. Signed-off-by: Tomeu Vizoso --- drivers/input/input.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/input/input.c b/drivers/input/input.c index cc357f1..cbbd391 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -1741,12 +1741,22 @@ static int input_dev_poweroff(struct device *dev) return 0; } +static int input_dev_prepare(struct device *dev) +{ + return 1; +} + static const struct dev_pm_ops input_dev_pm_ops = { .suspend = input_dev_suspend, .resume = input_dev_resume, .freeze = input_dev_freeze, .poweroff = input_dev_poweroff, .restore = input_dev_resume, + .prepare = input_dev_prepare, +}; + +static const struct dev_pm_ops input_class_pm_ops = { + .prepare = input_dev_prepare, }; #endif /* CONFIG_PM */ @@ -1767,6 +1777,9 @@ static char *input_devnode(struct device *dev, umode_t *mode) struct class input_class = { .name = "input", .devnode = input_devnode, +#ifdef CONFIG_PM_SLEEP + .pm = &input_class_pm_ops, +#endif }; EXPORT_SYMBOL_GPL(input_class);