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: 4199601 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2908A9F32B for ; Mon, 19 May 2014 06:19:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0B02B20274 for ; Mon, 19 May 2014 06:19:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 245E42025B for ; Mon, 19 May 2014 06:19:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752773AbaESGSI (ORCPT ); Mon, 19 May 2014 02:18:08 -0400 Received: from mail-wg0-f51.google.com ([74.125.82.51]:49367 "EHLO mail-wg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752771AbaESGSF (ORCPT ); Mon, 19 May 2014 02:18:05 -0400 Received: by mail-wg0-f51.google.com with SMTP id x13so7228456wgg.34 for ; Sun, 18 May 2014 23:18:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=OLt15/fCC7ESi+g74rHcDY4vK3aPNm0ghKKuka9yfnQ=; b=VUA6rWrlcD4BOU32xO1OUF29FR9bBgUktol3gdPjEFVYY5QkybPBaNxAWxS3r8MEe1 +KbWKbJ6Mo8YGRoIV/VjB7xp3WeG0Ij9LLCRGCJiEQ1qXcrN4doR6BMNLAT++tbjPO2x tx31fG9qdzI+gySnWDzU/ijISzn9wVsZVL/xz3kQGbYaT2Fn+0hU9v/CXfzVvq9CI7XT /sGkL4OrHdhCFvBp9rXr9WT3XDGRfnSUHhdf8lMqtxmVtk0wNK1+hiaQaFTQS90w2r+t a2LAn0r2s+brACGjvpP46IWddF92OIdkBNb+roiLBc1E4BWUAxrBy+8nByE0JKVW3sMH XLBg== X-Gm-Message-State: ALoCoQmso9dLwoTm2QsyDMBAS1JqATryWdRoP77bG4AN+nUugnPt+AcARSPQgcEI9LAhuaLkKnN8 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }