From patchwork Tue Sep 18 18:21:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1474171 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id B8880DF24C for ; Tue, 18 Sep 2012 18:28:19 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TE2Ud-0007lQ-0g; Tue, 18 Sep 2012 18:25:55 +0000 Received: from mail-bk0-f73.google.com ([209.85.214.73]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TE2TO-0007K1-QI for linux-arm-kernel@lists.infradead.org; Tue, 18 Sep 2012 18:24:43 +0000 Received: by bkwj4 with SMTP id j4so6005bkw.0 for ; Tue, 18 Sep 2012 11:24:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=vgE4J8boJZAqIoWreAPfxT7IF2o89C365lrv15ZqLN4=; b=ZqBzoifiuJtTS8hV7YTIJYi9NqFtWcfRfubUZl79gwnjsgBfyh9xHUSFJSJRCQuwvw rpOvPdEUFcwhvlwruw6XNkkDQ5TXbTI/FwcCq5o69nLHu6OZ0rSrUzzpMWijZgSTyR1X WVppxt/knWMfsRHAb2vIyvRj6r+addYLIpuOvYIsXL5j2IASNyRKDXzbolS4lH/LjeuG uDSEWX2NW2Zp6/dLJoSnjhuoQL52KZERb0lJLr57BshASm5eIcqhLSybzOdDCIXrrnau U3WfWk/LtmSMmv0eXKTfHK+SiIRxhl6DifrMlz1MtcvbieCsMKJ3cU9K+0vhymwlm5Ha kbAA== Received: by 10.180.107.199 with SMTP id he7mr186098wib.1.1347992673564; Tue, 18 Sep 2012 11:24:33 -0700 (PDT) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id hm1si33983wib.3.2012.09.18.11.24.33 (version=TLSv1/SSLv3 cipher=AES128-SHA); Tue, 18 Sep 2012 11:24:33 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 4D3B720004E; Tue, 18 Sep 2012 11:24:33 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 8C953161D2F; Tue, 18 Sep 2012 11:24:32 -0700 (PDT) From: Simon Glass To: LKML , linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/7] PM / Domains: add generic function 'pm_genpd_of_add_device_by_name' Date: Tue, 18 Sep 2012 11:21:53 -0700 Message-Id: <1347992519-6904-2-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1347992519-6904-1-git-send-email-sjg@chromium.org> References: <1347992519-6904-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQk+f+sX2bJJoi0zRkRiawMwByuaj+CPDzqEIwzawTAFGcSmvJvn1rdz8hw6F0VWADKbWJJYKlejMS9qXrpuM5yuWIstsw0xom2jJHCQPqWhaisFzvctccKqpyuHm14A+ZFnaDoT0VViKCaxD9xaZpOcjFCJbKI8QmkzEXQ5F/YXND6Obsh50auM28af+0S66VX0qnPwZHlZ3Xcr2FviN/w9YuCDgg== X-Spam-Note: CRM114 invocation failed X-Spam-Score: -3.1 (---) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-3.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.214.73 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Simon Glass , "kgene.kim" , Prathyush K , Ben Dooks , Srinivas KANDAGATLA X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Prathyush K A new function pm_genpd_of_add_device_by_name is added to the pm_domain file. This function takes three parameters - target device to be added to genpd, a device node and the name of the property. This function reads the "propname" property from the device node and finds the corresponding genpd device node. The target device is then added to this genpd by calling __pm_genpd_of_add_device. of_property_read_u32(dev_node, propname, &val); genpd_node = of_find_node_by_phandle(val); __pm_genpd_of_add_device(genpd_node, dev, NULL); Signed-off-by: Prathyush K Signed-off-by: Simon Glass Tested-by: Prathyush Kalashwaram --- include/linux/pm_domain.h | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 30f794e..c733ece 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -137,6 +137,18 @@ static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, return __pm_genpd_add_device(genpd, dev, NULL); } +static inline int pm_genpd_of_add_device_by_name( + struct device_node *dev_node, + struct device *dev, + char *propname) +{ + u32 val; + struct device_node *genpd_node; + of_property_read_u32(dev_node, propname, &val); + genpd_node = of_find_node_by_phandle(val); + return __pm_genpd_of_add_device(genpd_node, dev, NULL); +} + static inline int pm_genpd_of_add_device(struct device_node *genpd_node, struct device *dev) { @@ -184,6 +196,13 @@ static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, { return -ENOSYS; } +static inline int pm_genpd_of_add_device_by_name( + struct device_node *dev_node, + struct device *dev, + char *propname) +{ + return -ENOSYS; +} static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd, struct device *dev) {