From patchwork Tue Oct 1 13:33:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep KarkadaNagesha X-Patchwork-Id: 2970051 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F2BB7BFF0B for ; Tue, 1 Oct 2013 13:32:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B7F9203F3 for ; Tue, 1 Oct 2013 13:32:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4843E2041B for ; Tue, 1 Oct 2013 13:32:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753377Ab3JANcs (ORCPT ); Tue, 1 Oct 2013 09:32:48 -0400 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:36899 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752765Ab3JANcp (ORCPT ); Tue, 1 Oct 2013 09:32:45 -0400 Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.34]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id r91DWbkl007353; Tue, 1 Oct 2013 14:32:40 +0100 (BST) From: Sudeep KarkadaNagesha To: cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org Cc: Sudeep.KarkadaNagesha@arm.com, Sudeep KarkadaNagesha , Nishanth Menon , "Rafael J. Wysocki" , Viresh Kumar Subject: [PATCH v2 3/5] PM / OPP: check for existing OPP list when initialising from device tree Date: Tue, 1 Oct 2013 14:33:00 +0100 Message-Id: <1380634382-15609-4-git-send-email-Sudeep.KarkadaNagesha@arm.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1380634382-15609-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> References: <1380634382-15609-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> 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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 are 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: Nishanth Menon Cc: "Rafael J. Wysocki" Cc: Viresh Kumar Signed-off-by: Sudeep KarkadaNagesha Acked-by: Viresh Kumar 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 bb6ff64..05b2ebf 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -709,9 +709,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 */