From patchwork Tue Jul 30 18:00:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep KarkadaNagesha X-Patchwork-Id: 2835824 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 E87B59F7D6 for ; Tue, 30 Jul 2013 18:00:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7BA620356 for ; Tue, 30 Jul 2013 18:00:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 718B620354 for ; Tue, 30 Jul 2013 18:00:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756085Ab3G3SA0 (ORCPT ); Tue, 30 Jul 2013 14:00:26 -0400 Received: from service87.mimecast.com ([91.220.42.44]:53286 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755926Ab3G3SAY (ORCPT ); Tue, 30 Jul 2013 14:00:24 -0400 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Tue, 30 Jul 2013 19:00:22 +0100 Received: from e103737-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 30 Jul 2013 19:00:19 +0100 From: Sudeep KarkadaNagesha To: cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org Cc: Sudeep.KarkadaNagesha@arm.com, Sudeep KarkadaNagesha , Rob Herring , Pawel Moll , Mark Rutland , Stephen Warren , "Rafael J. Wysocki" , Nishanth Menon Subject: [RFC PATCH 2/2] PM / OPP: check for existing OPP list when initialising from device tree Date: Tue, 30 Jul 2013 19:00:17 +0100 Message-Id: <1375207217-4433-3-git-send-email-Sudeep.KarkadaNagesha@arm.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1375207217-4433-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> References: <1375207217-4433-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> X-OriginalArrivalTime: 30 Jul 2013 18:00:19.0982 (UTC) FILETIME=[A7A3D2E0:01CE8D4E] X-MC-Unique: 113073019002203101 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.4 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 From: Sudeep KarkadaNagesha CPUs are registered as devices and their OPPs can be initialised from the device tree. Whenever CPUs can be hotplugged out, the corresponding cpu devices are not removed. As a result all their OPPs remain intact even when they are offlined. But when they are hotplugged back-in, the cpufreq along with other cpu related subsystem gets re-initialised. Since its almost same as secondary cpu being brought up, no special consideration is taken in the hotplug path. This may result in cpufreq trying to initialise the OPPs again though the cpu device already contains the OPPs. This patch checks if there exist an OPP list associated with the device, before attempting to initialise it. Cc: Rob Herring Cc: Pawel Moll Cc: Mark Rutland Cc: Stephen Warren Cc: "Rafael J. Wysocki" Cc: Nishanth Menon Signed-off-by: Sudeep KarkadaNagesha Acked-by: Nishanth Menon --- drivers/base/power/opp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index 9ac3c93..8a9d138 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -708,9 +708,15 @@ int of_init_opp_table(struct device *dev) { const struct property *prop; struct device_node *opp_node; + struct device_opp *dev_opp; const __be32 *val; int nr; + /* Check for existing list for 'dev' */ + dev_opp = find_device_opp(dev); + if (!IS_ERR(dev_opp)) + return -EEXIST; /* Device OPP already initialized */ + opp_node = of_parse_phandle(dev->of_node, "operating-points-phandle", 0); if (!opp_node) /* if no OPP phandle, search for OPPs in current node */