From patchwork Wed Oct 8 07:48:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Turquette X-Patchwork-Id: 5051941 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5508CC11AB for ; Wed, 8 Oct 2014 07:50:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 79F0F201FE for ; Wed, 8 Oct 2014 07:49:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 94FA2201BC for ; Wed, 8 Oct 2014 07:49:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754584AbaJHHt4 (ORCPT ); Wed, 8 Oct 2014 03:49:56 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:48570 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754599AbaJHHtb (ORCPT ); Wed, 8 Oct 2014 03:49:31 -0400 Received: by mail-pa0-f50.google.com with SMTP id kx10so8616754pab.37 for ; Wed, 08 Oct 2014 00:49:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UtC1SqJ+jD1P5VPDUdTrRPaGvyx3Fcdqv4SicNoQ72I=; b=VLF1XWTIncjby9FjiVU07CQHUOG+5VyER7bXNTeH1njAszDTe1Gu5FEDTZcYHve7ra 0eqgQPKDxtol/GEu6Jh0/ESyGSs32SNnRk1rpwVAhp5VCET+UeW0hy1fDdJF4t3Lw4Ge KTFT6+/FA4M2+n3soEbpw2/bNP3EuC23SBtvqVPhiro++7CWVFBPfNl1mLhNXGzGUzmr oWlsxXVe2UeRbOos4dZ3uy4xQi++k9lAy1CwsEKeSjoCHWq6Y+cK4EDBjXg7Qt36DtAD QHoWSAfPxhwZrUgDv12B3MHt+DiHWQg+zsCfwaCWMle09QTX3Q5zhOu9qq8I2Au2QNFI Kcgg== X-Gm-Message-State: ALoCoQmJ020tDTuP6Diad/AUh9aR4s09tcjHsYzjQNJY1AVNbV5wBXmru5SNaECKVVHU0XYLY+kv X-Received: by 10.68.65.78 with SMTP id v14mr8509096pbs.75.1412754570788; Wed, 08 Oct 2014 00:49:30 -0700 (PDT) Received: from quantum.home (pool-108-47-66-231.lsanca.fios.verizon.net. [108.47.66.231]) by mx.google.com with ESMTPSA id on3sm15663577pdb.71.2014.10.08.00.49.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Oct 2014 00:49:30 -0700 (PDT) From: Mike Turquette To: viresh.kumar@linaro.org Cc: thomas.petazzoni@free-electrons.com, rjw@rjwysocki.net, linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, shawn.guo@linaro.org, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, spk.linux@gmail.com, pramod.gurav@smartplayin.com, rob.herring@linaro.org, ezequiel.garcia@free-electrons.com, tawfik@marvell.com, nadavh@marvell.com, alior@marvell.com, morten.rasmussen@arm.com, dietmar.eggemann@arm.com, vincent.guittot@linaro.org, nicolas.pitre@linaro.org, linux-kernel@vger.kernel.org, tuukka.tikkanen@linaro.org, Mike Turquette Subject: [PATCH 2/2] cpufreq: new function to query driver for flags Date: Wed, 8 Oct 2014 00:48:54 -0700 Message-Id: <1412754534-14068-3-git-send-email-mturquette@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1412754534-14068-1-git-send-email-mturquette@linaro.org> References: <1412754534-14068-1-git-send-email-mturquette@linaro.org> 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=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 There are cases for CPUfreq driver flags to be exposed outside of the CPUfreq core code. In particular the CPUFREQ_NO_SLEEP flag can be used by CPUfreq governors to optimize when and how they call that drivers .target callback. In fact this knowledge is a requirement for the on-going work to initiate cpu frequency transitions from the scheduler. This patch implements a simple function to return the CPUfreq driver flags. While currently the flags are a u8, that could grow at a future date and cpufreq_driver_get_flags returns an int. Additionally the function needs to return an error in case no driver is registered. Signed-off-by: Mike Turquette --- drivers/cpufreq/cpufreq.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 9b471b2..f3b9042 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1980,6 +1980,15 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, } EXPORT_SYMBOL_GPL(cpufreq_driver_target); +int cpufreq_driver_get_flags(void) +{ + if (!cpufreq_driver) + return -ENODEV; + + return cpufreq_driver->flags; +} +EXPORT_SYMBOL_GPL(cpufreq_driver_get_flags); + /* * when "event" is CPUFREQ_GOV_LIMITS */