From patchwork Wed Dec 7 10:37:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 87010 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp245005qgi; Wed, 7 Dec 2016 02:42:41 -0800 (PST) X-Received: by 10.84.178.7 with SMTP id y7mr147010381plb.147.1481107361036; Wed, 07 Dec 2016 02:42:41 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si23497934pgi.172.2016.12.07.02.42.40; Wed, 07 Dec 2016 02:42:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753122AbcLGKmi (ORCPT + 13 others); Wed, 7 Dec 2016 05:42:38 -0500 Received: from mail-pg0-f47.google.com ([74.125.83.47]:32998 "EHLO mail-pg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752581AbcLGKmf (ORCPT ); Wed, 7 Dec 2016 05:42:35 -0500 Received: by mail-pg0-f47.google.com with SMTP id 3so160850660pgd.0 for ; Wed, 07 Dec 2016 02:41:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=bwzPLdXkuSl1nCwZTldgoaX0Rg8DNzWuEGIkDknnjxU=; b=ExRO5ImIcGNuVG4e67ucMUoUnxd2ulXZUWd0UDS6qxtCK/NSzjIob65Jt9ILBSp9ou h6c3uxRIdztjTVwEktT2KvXVCABUcqmVoRxcBA170i2YcIzgqX0jgwqbZYBbLisWFpwM iTqFxqNBNjrrrqQ4qeKurn3gqFyA8Yo5C8pnU= 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=bwzPLdXkuSl1nCwZTldgoaX0Rg8DNzWuEGIkDknnjxU=; b=aWa9KFjppApx2kihzIjd0Ki7Pbc3MN5SYukMX7O0Y9Aq/61dHnf8Zfr4DLge7vy6cF pB3nA8ccEDA2VxbEJKjNm/FsSz2De6/MFz/xwBgPpnsUYjPQ4rKIg5TY1M2gB/Lxw+Vk Fs+Aq+rdq3fhGXSrh+3lNg9TdpK+FZcxdXDsgNCzwsSgUneMnxGpye/1inZbKYIA/tmw VSp+2tCF/Eqr8Q6XHYRvifQkIFITGBMvKMQuGVWAPnpMbR9qOITI+78OlmukVhJ5vy2T AMJqq5wpOFQ/svNakXKXE8If9uArkldzqkMk/JUYUUxTJmrHzmOwB3Dl4xu42b/yutlc 1eqA== X-Gm-Message-State: AKaTC01bUcFo5d+c4GJgj0pqhtb1nYqsUHrJOb04rhOIT6OoGz7cCluVjnwmov4T7la00jSh X-Received: by 10.84.136.135 with SMTP id 7mr146515813pll.40.1481107305803; Wed, 07 Dec 2016 02:41:45 -0800 (PST) Received: from localhost ([122.172.43.83]) by smtp.gmail.com with ESMTPSA id r2sm41481446pfi.67.2016.12.07.02.41.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Dec 2016 02:41:45 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot , Viresh Kumar Subject: [PATCH 10/12] PM / OPP: Simplify _opp_set_availability() Date: Wed, 7 Dec 2016 16:07:48 +0530 Message-Id: <8ca1aa7a452c7ffe8d54ebac93c3139ad692f185.1481106919.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b 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 As we don't use RCU locking anymore, there is no need to replace an earlier OPP node with a new one. Just update the existing one. Signed-off-by: Viresh Kumar --- drivers/base/power/opp/core.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) -- 2.7.1.410.g6faf27b -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Stephen Boyd diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c index b5e9600058c2..6a1374fafe75 100644 --- a/drivers/base/power/opp/core.c +++ b/drivers/base/power/opp/core.c @@ -1511,20 +1511,15 @@ static int _opp_set_availability(struct device *dev, unsigned long freq, bool availability_req) { struct opp_table *opp_table; - struct dev_pm_opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV); + struct dev_pm_opp *tmp_opp, *opp = ERR_PTR(-ENODEV); int r = 0; - /* keep the node allocated */ - new_opp = kmalloc(sizeof(*new_opp), GFP_KERNEL); - if (!new_opp) - return -ENOMEM; - /* Find the opp_table */ opp_table = _find_opp_table(dev); if (IS_ERR(opp_table)) { r = PTR_ERR(opp_table); dev_warn(dev, "%s: Device OPP not found (%d)\n", __func__, r); - goto free_opp; + return r; } mutex_lock(&opp_table->lock); @@ -1545,32 +1540,20 @@ static int _opp_set_availability(struct device *dev, unsigned long freq, /* Is update really needed? */ if (opp->available == availability_req) goto unlock; - /* copy the old data over */ - *new_opp = *opp; - - /* plug in new node */ - new_opp->available = availability_req; - list_replace(&opp->node, &new_opp->node); - kfree(opp); + opp->available = availability_req; /* Notify the change of the OPP availability */ if (availability_req) blocking_notifier_call_chain(&opp_table->head, OPP_EVENT_ENABLE, - new_opp); + opp); else blocking_notifier_call_chain(&opp_table->head, - OPP_EVENT_DISABLE, new_opp); - - mutex_unlock(&opp_table->lock); - dev_pm_opp_put_opp_table(opp_table); - return 0; + OPP_EVENT_DISABLE, opp); unlock: mutex_unlock(&opp_table->lock); dev_pm_opp_put_opp_table(opp_table); -free_opp: - kfree(new_opp); return r; }