From patchwork Mon May 19 06:29:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 30364 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 15401203AB for ; Mon, 19 May 2014 06:29:34 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id rp18sf15199093iec.6 for ; Sun, 18 May 2014 23:29:34 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=ujOFnD1IRUhKMV3mFiYW3QVrh8RcUWepyO5gCzCPCqI=; b=dGcyS7bR/JQ7pJs80zedTyMZk/35cuqDRZsiKdZx4klCkrek4dHyAD5/Xe4tRgkwvI HsnN+Caw+qSnut1g4MCu4Rz5OBQQ1jcz3yk2/kXU38KHyHcEClK2amrPIFrVtKYusj7Q nhuLlVUTVOMt5X0vMZklBv+6h3pIyZPNX+wrzHGkzISCue2PrUpaOv1ewd97WtCeeyUW InZLb+zj1/iwpGKZNLOzRZ7l/tdEUU3mtlV2GS74sxfgcwxTSzPXsiDzxHzogZ2bdX5Q aFipzdrq0xWW5We1E2HZhhw9viZ1D7CWQV904L+A0mV3BiEi88zybBCbhS4RnBuWUpgA AJdg== X-Gm-Message-State: ALoCoQko+0DlQ5+Fl4xTCT89qVegDdGWb084GBFd7VrhkfK/sakGzMNKXLXPXzzvxfkIhMpKrtKl X-Received: by 10.182.246.7 with SMTP id xs7mr4823593obc.15.1400480974118; Sun, 18 May 2014 23:29:34 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.180 with SMTP id w49ls1569656qge.3.gmail; Sun, 18 May 2014 23:29:34 -0700 (PDT) X-Received: by 10.58.116.1 with SMTP id js1mr16740981veb.29.1400480974019; Sun, 18 May 2014 23:29:34 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id xv9si3673176vcb.188.2014.05.18.23.29.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 18 May 2014 23:29:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id ld13so8926765vcb.40 for ; Sun, 18 May 2014 23:29:33 -0700 (PDT) X-Received: by 10.58.246.132 with SMTP id xw4mr15140363vec.2.1400480973929; Sun, 18 May 2014 23:29:33 -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 ib8csp224348vcb; Sun, 18 May 2014 23:29:33 -0700 (PDT) X-Received: by 10.68.200.133 with SMTP id js5mr40380935pbc.138.1400480973192; Sun, 18 May 2014 23:29:33 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ib4si1858045pad.70.2014.05.18.23.29.32; Sun, 18 May 2014 23:29:32 -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 S1753288AbaESG3Y (ORCPT + 27 others); Mon, 19 May 2014 02:29:24 -0400 Received: from mail-we0-f171.google.com ([74.125.82.171]:50291 "EHLO mail-we0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753258AbaESG3V (ORCPT ); Mon, 19 May 2014 02:29:21 -0400 Received: by mail-we0-f171.google.com with SMTP id w62so5056446wes.16 for ; Sun, 18 May 2014 23:29:20 -0700 (PDT) X-Received: by 10.180.11.239 with SMTP id t15mr11015696wib.25.1400480960380; Sun, 18 May 2014 23:29:20 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id vp5sm12837776wjc.31.2014.05.18.23.29.14 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 18 May 2014 23:29:19 -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 Resend] driver/core: cpu: initialize opp table Date: Mon, 19 May 2014 11:59:11 +0530 Message-Id: X-Mailer: git-send-email 2.0.0.rc2 In-Reply-To: <60d825e8bfe01f8a5ff98fffaf51ffbf04c7d175.1400480033.git.viresh.kumar@linaro.org> References: <60d825e8bfe01f8a5ff98fffaf51ffbf04c7d175.1400480033.git.viresh.kumar@linaro.org> 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.181 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 --- V1-V2: A colleague spotted some extra debug prints in my first mail :( Replace + pr_err("****%s: failed to init OPP table for cpu%d, err: %d\n", with + pr_err("%s: failed to init OPP table for cpu%d, err: %d\n", 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..74ce944 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; }