From patchwork Tue May 27 11:50:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 30963 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f71.google.com (mail-qg0-f71.google.com [209.85.192.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7D527203C3 for ; Tue, 27 May 2014 11:53:19 +0000 (UTC) Received: by mail-qg0-f71.google.com with SMTP id a108sf22401969qge.10 for ; Tue, 27 May 2014 04:53:19 -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=6nuH6TvCazAEwRxVokuiKU4nGEI+YDlVryI16EnMMn8=; b=jR79lh3JcLv9x+pNAIyq4XCFIMIeiR6kIZ5bQmvvPXWJDCRdKVDl6BON6vUAhWHwCQ WI2RSRkbRnHN75CzUWBHkjx373o0Q7Bi801dOgLdyapx4gYhpe3g/T2HBb9Mg0MxnKwD WPSVnswop0yn7FLPR7pmhzCqhjDzdfdJsB0hAMKVJmzFGg+Sr5nRqTV6s4vDB5LB2cqz 8P4Ii8BV/Iq4CAnTCu0vtK1FS/2tvIZhtqcHg1GqOSPfvZARtdFUsN3mYnw6vHm06mN1 TtHjEubFtdOGilBgizAUniXHP9mcvSe4hJoSEuGrF0t5834kYyjPJ7dqauEiIbjjTHFR fMmw== X-Gm-Message-State: ALoCoQnME3kwvmceig+Gv4ckdI4+pZSA+UJaNOZs/6lfBA/QweVpX0LAsCIVSQRE05BV28+7mAwx X-Received: by 10.236.165.230 with SMTP id e66mr11448133yhl.6.1401191599331; Tue, 27 May 2014 04:53:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.109.247 with SMTP id l110ls2781937qgf.90.gmail; Tue, 27 May 2014 04:53:19 -0700 (PDT) X-Received: by 10.221.29.137 with SMTP id ry9mr26635879vcb.6.1401191599250; Tue, 27 May 2014 04:53:19 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id im7si4393435vec.38.2014.05.27.04.53.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 May 2014 04:53:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.172 as permitted sender) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id oz11so10575142veb.3 for ; Tue, 27 May 2014 04:53:19 -0700 (PDT) X-Received: by 10.52.14.72 with SMTP id n8mr152428vdc.73.1401191599172; Tue, 27 May 2014 04:53: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 ib8csp112595vcb; Tue, 27 May 2014 04:53:18 -0700 (PDT) X-Received: by 10.68.247.131 with SMTP id ye3mr36082537pbc.40.1401191598321; Tue, 27 May 2014 04:53:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fi4si18351451pbb.193.2014.05.27.04.53.17 for ; Tue, 27 May 2014 04:53:17 -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 S1752372AbaE0LxA (ORCPT + 27 others); Tue, 27 May 2014 07:53:00 -0400 Received: from mail-pb0-f48.google.com ([209.85.160.48]:43985 "EHLO mail-pb0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752335AbaE0Lw5 (ORCPT ); Tue, 27 May 2014 07:52:57 -0400 Received: by mail-pb0-f48.google.com with SMTP id rr13so9090293pbb.7 for ; Tue, 27 May 2014 04:52:56 -0700 (PDT) X-Received: by 10.68.134.198 with SMTP id pm6mr36246180pbb.9.1401191576800; Tue, 27 May 2014 04:52:56 -0700 (PDT) Received: from localhost ([223.227.245.64]) by mx.google.com with ESMTPSA id xk3sm22983555pbb.65.2014.05.27.04.52.49 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 27 May 2014 04:52:56 -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, nm@ti.com, chander.kashyap@linaro.org, pavel@ucw.cz, len.brown@intel.com, sudeep.holla@arm.com, Viresh Kumar , Greg Kroah-Hartman , Amit Daniel Kachhap , Kukjin Kim , Shawn Guo Subject: [PATCH V4 4/8] driver/core: cpu: initialize opp table Date: Tue, 27 May 2014 17:20:53 +0530 Message-Id: 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.128.172 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: , Drivers expecting CPU's OPPs from device tree initialize OPP table themselves by calling of_init_opp_table() and there is nothing driver specific in that. They all do it in the same redundant way. It would be better if we can get rid of redundancy by initializing CPU OPPs from CPU core code for all CPUs (that have a "operating-points" property defined in their node). This patch calls of_init_opp_table() right after CPU device is registered in register_cpu(). of_init_opp_table() also has a dummy implementation which simply returns -ENOSYS when CONFIG_OPP or CONFIG_OF isn't supported by some platform. 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 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 006b1bc..790183f 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "base.h" @@ -349,10 +350,12 @@ 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) - per_cpu(cpu_sys_devices, num) = &cpu->dev; - if (!error) - register_cpu_under_node(num, cpu_to_node(num)); + if (error) + return error; + + per_cpu(cpu_sys_devices, num) = &cpu->dev; + register_cpu_under_node(num, cpu_to_node(num)); + of_init_opp_table(&cpu->dev); return error; }