From patchwork Wed Aug 17 19:39:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 1074862 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7HJeXHR022493 for ; Wed, 17 Aug 2011 19:40:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752679Ab1HQTkc (ORCPT ); Wed, 17 Aug 2011 15:40:32 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:41207 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752386Ab1HQTkb (ORCPT ); Wed, 17 Aug 2011 15:40:31 -0400 Received: by mail-wy0-f174.google.com with SMTP id 24so914733wyg.19 for ; Wed, 17 Aug 2011 12:40:31 -0700 (PDT) Received: by 10.216.46.208 with SMTP id r58mr4454320web.78.1313610030921; Wed, 17 Aug 2011 12:40:30 -0700 (PDT) Received: from localhost.localdomain (238.66-66-87.adsl-dyn.isp.belgacom.be [87.66.66.238]) by mx.google.com with ESMTPS id u55sm993262wec.14.2011.08.17.12.40.28 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 17 Aug 2011 12:40:30 -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 3/7] PM QoS: code re-organization Date: Wed, 17 Aug 2011 21:39:21 +0200 Message-Id: <1313609965-6568-4-git-send-email-j-pihet@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1313609965-6568-1-git-send-email-j-pihet@ti.com> References: <1313609965-6568-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 (demeter2.kernel.org [140.211.167.43]); Wed, 17 Aug 2011 19:40:33 +0000 (UTC) From: Jean Pihet Move around the PM QoS misc devices management code for better readability. Signed-off-by: Jean Pihet --- 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 aa52c44..788c4cf 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c @@ -188,28 +188,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 @@ -362,6 +340,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;