From patchwork Thu Aug 11 15:06:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 1057652 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7BF7VLo012910 for ; Thu, 11 Aug 2011 15:08:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752448Ab1HKPHh (ORCPT ); Thu, 11 Aug 2011 11:07:37 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:54736 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751521Ab1HKPHg (ORCPT ); Thu, 11 Aug 2011 11:07:36 -0400 Received: by mail-ww0-f44.google.com with SMTP id 5so2142166wwf.1 for ; Thu, 11 Aug 2011 08:07:35 -0700 (PDT) Received: by 10.227.24.146 with SMTP id v18mr8184123wbb.84.1313075255863; Thu, 11 Aug 2011 08:07:35 -0700 (PDT) Received: from localhost.localdomain (103.67-66-87.adsl-dyn.isp.belgacom.be [87.66.67.103]) by mx.google.com with ESMTPS id el9sm1620388wbb.24.2011.08.11.08.07.32 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 11 Aug 2011 08:07:34 -0700 (PDT) From: jean.pihet@newoldbits.com To: Mark Brown , Kevin Hilman , markgross@thegnar.org, Linux PM mailing list , linux-omap@vger.kernel.org, "Rafael J. Wysocki" , Paul Walmsley , Magnus Damm , Todd Poynor Cc: Jean Pihet Subject: [PATCH 03/15] PM QoS: code re-organization Date: Thu, 11 Aug 2011 17:06:40 +0200 Message-Id: <1313075212-8366-4-git-send-email-j-pihet@ti.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1313075212-8366-1-git-send-email-j-pihet@ti.com> References: <1313075212-8366-1-git-send-email-j-pihet@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 11 Aug 2011 15:08:11 +0000 (UTC) From: Jean Pihet Move around the PM QoS misc devices management code for better readability. Signed-off-by: Jean Pihet Acked-by:markgross --- kernel/power/qos.c | 45 +++++++++++++++++++++++---------------------- 1 files changed, 23 insertions(+), 22 deletions(-) diff --git a/kernel/power/qos.c b/kernel/power/qos.c index 61275f2..fa9a090 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c @@ -190,28 +190,6 @@ static void update_target(struct pm_qos_object *o, struct plist_node *node, NULL); } -static int register_pm_qos_misc(struct pm_qos_object *qos) -{ - qos->pm_qos_power_miscdev.minor = MISC_DYNAMIC_MINOR; - qos->pm_qos_power_miscdev.name = qos->name; - qos->pm_qos_power_miscdev.fops = &pm_qos_power_fops; - - return misc_register(&qos->pm_qos_power_miscdev); -} - -static int find_pm_qos_object_by_minor(int minor) -{ - int pm_qos_class; - - for (pm_qos_class = 0; - pm_qos_class < PM_QOS_NUM_CLASSES; pm_qos_class++) { - if (minor == - pm_qos_array[pm_qos_class]->pm_qos_power_miscdev.minor) - return pm_qos_class; - } - return -1; -} - /** * pm_qos_request - returns current system wide qos expectation * @pm_qos_class: identification of which qos value is requested @@ -364,6 +342,29 @@ int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier) } EXPORT_SYMBOL_GPL(pm_qos_remove_notifier); +/* User space interface to PM QoS classes via misc devices */ +static int register_pm_qos_misc(struct pm_qos_object *qos) +{ + qos->pm_qos_power_miscdev.minor = MISC_DYNAMIC_MINOR; + qos->pm_qos_power_miscdev.name = qos->name; + qos->pm_qos_power_miscdev.fops = &pm_qos_power_fops; + + return misc_register(&qos->pm_qos_power_miscdev); +} + +static int find_pm_qos_object_by_minor(int minor) +{ + int pm_qos_class; + + for (pm_qos_class = 0; + pm_qos_class < PM_QOS_NUM_CLASSES; pm_qos_class++) { + if (minor == + pm_qos_array[pm_qos_class]->pm_qos_power_miscdev.minor) + return pm_qos_class; + } + return -1; +} + static int pm_qos_power_open(struct inode *inode, struct file *filp) { long pm_qos_class;