From patchwork Wed Sep 18 10:58:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep KarkadaNagesha X-Patchwork-Id: 2905461 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 C291C9F1BF for ; Wed, 18 Sep 2013 11:01:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A673F20340 for ; Wed, 18 Sep 2013 11:01:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 35F2420326 for ; Wed, 18 Sep 2013 11:01:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751823Ab3IRLBr (ORCPT ); Wed, 18 Sep 2013 07:01:47 -0400 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:60645 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751818Ab3IRLBr (ORCPT ); Wed, 18 Sep 2013 07:01:47 -0400 Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.49]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id r8IAvvkl012051; Wed, 18 Sep 2013 11:57:59 +0100 (BST) From: Sudeep KarkadaNagesha To: linux-pm@vger.kernel.org, devicetree@vger.kernel.org Cc: Sudeep.KarkadaNagesha@arm.com, Sudeep KarkadaNagesha , "Rafael J. Wysocki" , Nishanth Menon Subject: [PATCH 3/3] PM / OPP: check for existing OPP list when initialising from device tree Date: Wed, 18 Sep 2013 11:58:13 +0100 Message-Id: <1379501893-12669-4-git-send-email-Sudeep.KarkadaNagesha@arm.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1379501893-12669-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> References: <1379501893-12669-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: "Rafael J. Wysocki" Cc: Nishanth Menon Signed-off-by: Sudeep KarkadaNagesha --- 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 a450e2f..0ebd884 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 */