From patchwork Tue Mar 24 13:40:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 6079031 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 937169F399 for ; Tue, 24 Mar 2015 13:43:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C7B3D20225 for ; Tue, 24 Mar 2015 13:43:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 88A64201FE for ; Tue, 24 Mar 2015 13:43:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752642AbbCXNmu (ORCPT ); Tue, 24 Mar 2015 09:42:50 -0400 Received: from mga01.intel.com ([192.55.52.88]:32710 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752593AbbCXNmq (ORCPT ); Tue, 24 Mar 2015 09:42:46 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 24 Mar 2015 06:42:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,458,1422950400"; d="scan'208";a="696940917" Received: from ahunter-desktop.fi.intel.com ([10.237.72.97]) by fmsmga002.fm.intel.com with ESMTP; 24 Mar 2015 06:42:43 -0700 From: Adrian Hunter To: Ulf Hansson Cc: linux-mmc , "Rafael J. Wysocki" , Len Brown , Pavel Machek , Kevin Hilman , Tomeu Vizoso , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 1/4] PM / QoS: Add pm_qos_cancel_request_lazy() that doesn't sleep Date: Tue, 24 Mar 2015 15:40:37 +0200 Message-Id: <1427204440-3533-2-git-send-email-adrian.hunter@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427204440-3533-1-git-send-email-adrian.hunter@intel.com> References: <1427204440-3533-1-git-send-email-adrian.hunter@intel.com> Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Add pm_qos_cancel_request_lazy() which is convenient for contexts that may not sleep. Signed-off-by: Adrian Hunter --- include/linux/pm_qos.h | 2 ++ kernel/power/qos.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 7b3ae0c..f44d353 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -126,6 +126,8 @@ void pm_qos_update_request(struct pm_qos_request *req, s32 new_value); void pm_qos_update_request_timeout(struct pm_qos_request *req, s32 new_value, unsigned long timeout_us); +void pm_qos_cancel_request_lazy(struct pm_qos_request *req, + unsigned int timeout_us); void pm_qos_remove_request(struct pm_qos_request *req); int pm_qos_request(int pm_qos_class); diff --git a/kernel/power/qos.c b/kernel/power/qos.c index 97b0df7..ac131cb 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c @@ -517,6 +517,26 @@ void pm_qos_update_request_timeout(struct pm_qos_request *req, s32 new_value, } /** + * pm_qos_cancel_request_lazy - cancels an existing qos request lazily. + * @req : handle to list element holding a pm_qos request to use + * @timeout_us: the delay before cancelling this qos request in usecs. + * + * After timeout_us, this qos request is cancelled. + */ +void pm_qos_cancel_request_lazy(struct pm_qos_request *req, + unsigned int timeout_us) +{ + if (!req) + return; + if (WARN(!pm_qos_request_active(req), + "%s called for unknown object.", __func__)) + return; + + schedule_delayed_work(&req->work, usecs_to_jiffies(timeout_us)); +} +EXPORT_SYMBOL_GPL(pm_qos_cancel_request_lazy); + +/** * pm_qos_remove_request - modifies an existing qos request * @req: handle to request list element *