From patchwork Thu Sep 16 15:08:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 185612 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8GF8nDP020311 for ; Thu, 16 Sep 2010 15:08:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754297Ab0IPPIs (ORCPT ); Thu, 16 Sep 2010 11:08:48 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:42547 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753469Ab0IPPIr convert rfc822-to-8bit (ORCPT ); Thu, 16 Sep 2010 11:08:47 -0400 Received: by pzk34 with SMTP id 34so361107pzk.19 for ; Thu, 16 Sep 2010 08:08:46 -0700 (PDT) Received: by 10.114.58.19 with SMTP id g19mr3834002waa.73.1284649726729; Thu, 16 Sep 2010 08:08:46 -0700 (PDT) Received: from localhost (c-24-18-179-55.hsd1.wa.comcast.net [24.18.179.55]) by mx.google.com with ESMTPS id d39sm4598530wam.4.2010.09.16.08.08.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 16 Sep 2010 08:08:43 -0700 (PDT) From: Kevin Hilman To: Linus Walleij , Nishanth Menon Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 1/4] OMAP: introduce OPP layer for device-specific OPPs Organization: Deep Root Systems, LLC References: <1284587799-9637-1-git-send-email-khilman@deeprootsystems.com> <1284587799-9637-2-git-send-email-khilman@deeprootsystems.com> Date: Thu, 16 Sep 2010 08:08:41 -0700 In-Reply-To: (Linus Walleij's message of "Thu, 16 Sep 2010 14:19:59 +0200") Message-ID: <87sk19eneu.fsf@deeprootsystems.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 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.3 (demeter1.kernel.org [140.211.167.41]); Thu, 16 Sep 2010 15:08:49 +0000 (UTC) diff --git a/arch/arm/mach-omap2/opp3xxx_data.c b/arch/arm/mach-omap2/opp3xxx_data.c index e337aeb..f3f9ae4 100644 --- a/arch/arm/mach-omap2/opp3xxx_data.c +++ b/arch/arm/mach-omap2/opp3xxx_data.c @@ -23,6 +23,7 @@ #include #include +#include static struct omap_opp_def __initdata omap34xx_opp_def_list[] = { /* MPU OPP1 */ @@ -114,7 +115,22 @@ int __init omap3_pm_init_opp_table(void) opp_def = omap3_opp_def_list; for (i = 0; i < omap3_opp_def_size; i++) { - r = opp_add(opp_def++); + struct omap_hwmod *oh; + struct device *dev; + + if (!opp_def->hwmod_name) { + pr_err("%s: missing name of omap_hwmod, ignoring.\n", __func__); + return -EINVAL; + } + oh = omap_hwmod_lookup(opp_def->hwmod_name); + if (!oh || !oh->od) { + pr_warn("%s: no hwmod or odev for %s, cannot add OPPs.\n", + __func__, opp_def->hwmod_name); + return -EINVAL; + } + dev = &oh->od->pdev.dev; + + r = opp_add(dev, opp_def++); if (r) pr_err("unable to add OPP %ld Hz for %s\n", opp_def->freq, opp_def->hwmod_name); diff --git a/arch/arm/plat-omap/include/plat/opp.h b/arch/arm/plat-omap/include/plat/opp.h index 9af8c83..82cfdd6 100644 --- a/arch/arm/plat-omap/include/plat/opp.h +++ b/arch/arm/plat-omap/include/plat/opp.h @@ -75,7 +75,7 @@ struct omap_opp *opp_find_freq_floor(struct device *dev, unsigned long *freq); struct omap_opp *opp_find_freq_ceil(struct device *dev, unsigned long *freq); -int opp_add(const struct omap_opp_def *opp_def); +int opp_add(struct device *dev, const struct omap_opp_def *opp_def); int opp_enable(struct omap_opp *opp); diff --git a/arch/arm/plat-omap/opp.c b/arch/arm/plat-omap/opp.c index b26326b..f5295ca 100644 --- a/arch/arm/plat-omap/opp.c +++ b/arch/arm/plat-omap/opp.c @@ -21,7 +21,6 @@ #include #include -#include /** * struct omap_opp - OMAP OPP description structure @@ -58,7 +57,6 @@ struct omap_opp { struct device_opp { struct list_head node; - struct omap_hwmod *oh; struct device *dev; struct list_head opp_list; @@ -291,29 +289,12 @@ static void omap_opp_populate(struct omap_opp *opp, * * This function adds an opp definition to the opp list and returns status. */ -int opp_add(const struct omap_opp_def *opp_def) +int opp_add(struct device *dev, const struct omap_opp_def *opp_def) { - struct omap_hwmod *oh; - struct device *dev = NULL; struct device_opp *tmp_dev_opp, *dev_opp = NULL; struct omap_opp *opp, *new_opp; - struct platform_device *pdev; struct list_head *head; - /* find the correct hwmod, and device */ - if (!opp_def->hwmod_name) { - pr_err("%s: missing name of omap_hwmod, ignoring.\n", __func__); - return -EINVAL; - } - oh = omap_hwmod_lookup(opp_def->hwmod_name); - if (!oh || !oh->od) { - pr_warn("%s: no hwmod or odev for %s, cannot add OPPs.\n", - __func__, opp_def->hwmod_name); - return -EINVAL; - } - pdev = &oh->od->pdev; - dev = &oh->od->pdev.dev; - /* Check for existing list for 'dev' */ list_for_each_entry(tmp_dev_opp, &dev_opp_list, node) { if (dev == tmp_dev_opp->dev) { @@ -331,8 +312,7 @@ int opp_add(const struct omap_opp_def *opp_def) return -ENOMEM; } - dev_opp->oh = oh; - dev_opp->dev = &oh->od->pdev.dev; + dev_opp->dev = dev; INIT_LIST_HEAD(&dev_opp->opp_list); list_add(&dev_opp->node, &dev_opp_list);