From patchwork Mon Mar 10 10:13:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 25955 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f199.google.com (mail-qc0-f199.google.com [209.85.216.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DF2792054B for ; Mon, 10 Mar 2014 10:13:30 +0000 (UTC) Received: by mail-qc0-f199.google.com with SMTP id e16sf17038800qcx.2 for ; Mon, 10 Mar 2014 03:13: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:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=Puv3nntVVDh2HbZdWhWgC2TD0GF+lBIyOdRXuW+ZpcQ=; b=bk915R48yuPYpero0yIWxrvX9Hu/Twunt65IH8E71krAebGC1CT9sPtldmb0Em0j95 59OYsKMMlBcFRCZFW/ayx+HNUNxxazNV05hdPer6inyOMbslcTqp/ccmtzMi2gSICdWQ NdAr6eKEA4AUR78O2NyTU4TqLfQuPByf77Wberq7yIE/fXt00T+S+/t8iCQDtt/89u36 6NBOKViFMfGMlwrJGTKDW1FKCqeRP2b2qRZg1OP9Rua5NCNoM955blX60b/38ck8NOnT Lo9tA8k8lDbaPG7H6MJCFVd3pWPKAMwzY2R72k+MUxSj8vB138lKgKn/O5xe4jJz7tjE DdFg== X-Gm-Message-State: ALoCoQk4Vy6PyUFSsy4wRcaVMtImTj5Jc1phKsvTjrxJrMxCjB1rW/d7mQuYMfJuPYeoK4nnYwl7 X-Received: by 10.58.170.6 with SMTP id ai6mr12079309vec.7.1394446410697; Mon, 10 Mar 2014 03:13:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.34.233 with SMTP id l96ls1431628qgl.90.gmail; Mon, 10 Mar 2014 03:13:30 -0700 (PDT) X-Received: by 10.52.15.132 with SMTP id x4mr1374471vdc.31.1394446410609; Mon, 10 Mar 2014 03:13:30 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id cp10si4581332ved.20.2014.03.10.03.13.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Mar 2014 03:13:30 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id sa20so6683285veb.36 for ; Mon, 10 Mar 2014 03:13:30 -0700 (PDT) X-Received: by 10.220.161.8 with SMTP id p8mr21735116vcx.4.1394446410514; Mon, 10 Mar 2014 03:13:30 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp108016vck; Mon, 10 Mar 2014 03:13:30 -0700 (PDT) X-Received: by 10.66.139.169 with SMTP id qz9mr39718910pab.16.1394446409573; Mon, 10 Mar 2014 03:13:29 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yp10si16315009pab.40.2014.03.10.03.13.29; Mon, 10 Mar 2014 03:13:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of cpufreq-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752365AbaCJKN2 (ORCPT + 6 others); Mon, 10 Mar 2014 06:13:28 -0400 Received: from mail-pb0-f54.google.com ([209.85.160.54]:34522 "EHLO mail-pb0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751975AbaCJKN0 (ORCPT ); Mon, 10 Mar 2014 06:13:26 -0400 Received: by mail-pb0-f54.google.com with SMTP id ma3so7028129pbc.41 for ; Mon, 10 Mar 2014 03:13:26 -0700 (PDT) X-Received: by 10.66.155.133 with SMTP id vw5mr39532512pab.124.1394446406371; Mon, 10 Mar 2014 03:13:26 -0700 (PDT) Received: from localhost ([122.166.179.52]) by mx.google.com with ESMTPSA id e6sm63095350pbg.4.2014.03.10.03.13.22 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 10 Mar 2014 03:13:25 -0700 (PDT) From: Viresh Kumar To: rjw@rjwysocki.net Cc: linaro-kernel@lists.linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, joshc@codeaurora.org, robherring2@gmail.com, Viresh Kumar Subject: [PATCH] cpufreq: SPEAr: Instantiate as platform_driver Date: Mon, 10 Mar 2014 15:43:18 +0530 Message-Id: <92837e0c0ed734bb82d3c7d78f58beb31b4e0c1f.1394446335.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e Sender: cpufreq-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: cpufreq@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , As multiplatform build is being adopted by more and more ARM platforms, initcall function should be used very carefully. For example, when SPEAr cpufreq driver is enabled on a kernel booted on a non-SPEAr board, we will get following boot time error: spear_cpufreq: Invalid cpufreq_tbl To eliminate this undesired the effect, the patch changes SPEAr driver to have it instantiated as a platform_driver. Then it will only run on platforms that create the platform_device "spear-cpufreq". This patch also creates platform node for SPEAr13xx boards. Reported-by: Josh Cartwright Signed-off-by: Viresh Kumar Acked-by: Viresh Kumar --- arch/arm/mach-spear/spear1310.c | 1 + arch/arm/mach-spear/spear1340.c | 1 + drivers/cpufreq/spear-cpufreq.c | 13 +++++++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-spear/spear1310.c b/arch/arm/mach-spear/spear1310.c index 7ad0030..824b12a 100644 --- a/arch/arm/mach-spear/spear1310.c +++ b/arch/arm/mach-spear/spear1310.c @@ -28,6 +28,7 @@ static void __init spear1310_dt_init(void) { of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + platform_device_register_simple("spear-cpufreq", -1, NULL, 0); } static const char * const spear1310_dt_board_compat[] = { diff --git a/arch/arm/mach-spear/spear1340.c b/arch/arm/mach-spear/spear1340.c index 3fb6834..7b6bff7 100644 --- a/arch/arm/mach-spear/spear1340.c +++ b/arch/arm/mach-spear/spear1340.c @@ -143,6 +143,7 @@ static void __init spear1340_dt_init(void) { of_platform_populate(NULL, of_default_bus_match_table, spear1340_auxdata_lookup, NULL); + platform_device_register_simple("spear-cpufreq", -1, NULL, 0); } static const char * const spear1340_dt_board_compat[] = { diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c index 410b54a..4cfdcff 100644 --- a/drivers/cpufreq/spear-cpufreq.c +++ b/drivers/cpufreq/spear-cpufreq.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -166,7 +167,7 @@ static struct cpufreq_driver spear_cpufreq_driver = { .attr = cpufreq_generic_attr, }; -static int spear_cpufreq_driver_init(void) +static int spear_cpufreq_probe(struct platform_device *pdev) { struct device_node *np; const struct property *prop; @@ -234,7 +235,15 @@ out_put_node: of_node_put(np); return ret; } -late_initcall(spear_cpufreq_driver_init); + +static struct platform_driver spear_cpufreq_platdrv = { + .driver = { + .name = "spear-cpufreq", + .owner = THIS_MODULE, + }, + .probe = spear_cpufreq_probe, +}; +module_platform_driver(spear_cpufreq_platdrv); MODULE_AUTHOR("Deepak Sikri "); MODULE_DESCRIPTION("SPEAr CPUFreq driver");