From patchwork Mon May 19 06:17:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 30359 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f197.google.com (mail-qc0-f197.google.com [209.85.216.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 43F11203AB for ; Mon, 19 May 2014 06:18:20 +0000 (UTC) Received: by mail-qc0-f197.google.com with SMTP id w7sf19875788qcr.4 for ; Sun, 18 May 2014 23:18:20 -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:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=2g15U6HUwDHAYdWz5HJwKzHOnly/0xPy7EfEI2Hf+xo=; b=HEVK4uP2/nXNUG0Pe/fVz66mffWOns/H67DzkF+vPafrRoAVWXitX/+ruGJ64/4pIf giUn8O8Bs3AG3m/ysCAlRv+dL5b8+N8RTqoNbRKVkfPQ4SAK8UKt5BvJdLFGpIk0lVvk Sqbbq3dOxlE8Eh/dAXVZ1AdHjOjDCcj9DkDzPN9JWncxuT5yt2HOrO4lFas9K6KKgjQ9 Q7e4UijL1dw7E3CPDKn+cs0ktCUgLQ/IJHm4ohjdoRI8WCdZn2k1yXrg/048kcW/pAQe up65B89Tc5RXki7J1RHLfLiH4X/WKnrjMRJtpVS6IHKl7R2hCRkz/56e0KFafFze7wmv hhfA== X-Gm-Message-State: ALoCoQkyG4THPMDaWPwXmiWcJlatVBgaXPjNgzV006IGEHB4cnppjmWZMK21IYOgbsMGL6FiP0qu X-Received: by 10.236.140.42 with SMTP id d30mr15095033yhj.2.1400480299987; Sun, 18 May 2014 23:18:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.100.179 with SMTP id s48ls1501589qge.17.gmail; Sun, 18 May 2014 23:18:19 -0700 (PDT) X-Received: by 10.58.161.101 with SMTP id xr5mr4737865veb.36.1400480299895; Sun, 18 May 2014 23:18:19 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id z14si3666894vcf.100.2014.05.18.23.18.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 18 May 2014 23:18:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id if17so8939154vcb.22 for ; Sun, 18 May 2014 23:18:19 -0700 (PDT) X-Received: by 10.52.99.168 with SMTP id er8mr10839236vdb.26.1400480299795; Sun, 18 May 2014 23:18:19 -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.221.72 with SMTP id ib8csp223347vcb; Sun, 18 May 2014 23:18:19 -0700 (PDT) X-Received: by 10.66.232.166 with SMTP id tp6mr40407582pac.127.1400480298937; Sun, 18 May 2014 23:18:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yn4si18189083pac.38.2014.05.18.23.18.18; Sun, 18 May 2014 23:18:18 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752809AbaESGSJ (ORCPT + 27 others); Mon, 19 May 2014 02:18:09 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:45963 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752772AbaESGSF (ORCPT ); Mon, 19 May 2014 02:18:05 -0400 Received: by mail-wi0-f174.google.com with SMTP id r20so3530262wiv.1 for ; Sun, 18 May 2014 23:18:04 -0700 (PDT) X-Received: by 10.194.48.80 with SMTP id j16mr27333735wjn.44.1400480284211; Sun, 18 May 2014 23:18:04 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id ho2sm13255591wib.15.2014.05.18.23.17.58 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 18 May 2014 23:18:03 -0700 (PDT) From: Viresh Kumar To: rjw@rjwysocki.net Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, arvind.chauhan@arm.com, inderpal.s@samsung.com, pavel@ucw.cz, nm@ti.com, chander.kashyap@linaro.org, Viresh Kumar , Greg Kroah-Hartman , Amit Daniel Kachhap , Kukjin Kim , Shawn Guo , Sudeep Holla Subject: [PATCH 1/5] driver/core: cpu: initialize opp table Date: Mon, 19 May 2014 11:47:21 +0530 Message-Id: <60d825e8bfe01f8a5ff98fffaf51ffbf04c7d175.1400480033.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.0.0.rc2 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) 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: , All drivers expecting CPU's OPPs from device tree initialize OPP table using of_init_opp_table() and there is nothing driver specific in that. They all do it in the same way adding to code redundancy. It would be better if we can get rid of code redundancy by initializing CPU OPPs from core code for all CPUs that have a "operating-points" property defined in their node. This patch initializes OPPs as soon as CPU device is registered in register_cpu(). Cc: Greg Kroah-Hartman Cc: Amit Daniel Kachhap Cc: Kukjin Kim Cc: Shawn Guo Cc: Sudeep Holla Signed-off-by: Viresh Kumar --- drivers/base/cpu.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 006b1bc..c787b5b 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "base.h" @@ -349,11 +350,20 @@ int register_cpu(struct cpu *cpu, int num) if (cpu->hotpluggable) cpu->dev.groups = hotplugable_cpu_attr_groups; error = device_register(&cpu->dev); - if (!error) + if (!error) { per_cpu(cpu_sys_devices, num) = &cpu->dev; - if (!error) register_cpu_under_node(num, cpu_to_node(num)); + /* Initialize CPUs OPP table */ + if (of_node_get(cpu->dev.of_node)) { + error = of_init_opp_table(&cpu->dev); + if (error && error != -ENODEV) + pr_err("****%s: failed to init OPP table for cpu%d, err: %d\n", + __func__, num, error); + of_node_put(cpu->dev.of_node); + } + } + return error; }