From patchwork Mon Jun 15 11:57:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 49849 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 61134205DE for ; Mon, 15 Jun 2015 11:58:10 +0000 (UTC) Received: by lbbti3 with SMTP id ti3sf25045499lbb.1 for ; Mon, 15 Jun 2015 04:58:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=6aZZiQVoHfeM/vp09FuhVCj6Lx4PIdDeNeSlMErTBDc=; b=PnkRUCCIhjLSV9pi/9UW1rd9qyJ5w+YodvJVVe+eGbAg9rVHGr1f/9twC1rn8RHoco POA+vyNp0r0SNQZg4QyPV4NwDcks4KG7RHi4fNGXj8HJ68ojqr51f3fDLWLJb6gyADTG wYvG1GymiDem9v0zln1wpbCXzilPu+ONXoI71kPpz2zv11h5//iRraq8ikz0mAKMH35b CLaDXugnHR+zGrf5C7RXjQ7SC2k0MDl4CX76INCYccRXIlSA3nTO0PDrjoZIY/jFic5P DGpWoQC+iIWgJcA22gOxABdl91do5seCKFwQY14ChjXZyvOKMRN62irtzNbIRQMHjx1B cWBA== X-Gm-Message-State: ALoCoQl/RJbXc0WCN2a3rARHt8SMpxm5TIISjwUixUcLRep6Zwf1LLwZx2A8sz84V74bgJfvJUI4 X-Received: by 10.194.142.205 with SMTP id ry13mr29541413wjb.2.1434369488434; Mon, 15 Jun 2015 04:58:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.7.67 with SMTP id da3ls982792lad.49.gmail; Mon, 15 Jun 2015 04:58:08 -0700 (PDT) X-Received: by 10.152.87.33 with SMTP id u1mr3621905laz.35.1434369488273; Mon, 15 Jun 2015 04:58:08 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id t1si10322856lbk.72.2015.06.15.04.58.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jun 2015 04:58:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by lbbti3 with SMTP id ti3so14427317lbb.1 for ; Mon, 15 Jun 2015 04:58:08 -0700 (PDT) X-Received: by 10.112.41.196 with SMTP id h4mr26778561lbl.36.1434369488139; Mon, 15 Jun 2015 04:58:08 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1363525lbb; Mon, 15 Jun 2015 04:58:07 -0700 (PDT) X-Received: by 10.68.142.42 with SMTP id rt10mr47584190pbb.27.1434369486326; Mon, 15 Jun 2015 04:58:06 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gu10si258184pbc.26.2015.06.15.04.58.05; Mon, 15 Jun 2015 04:58:06 -0700 (PDT) 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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753934AbbFOL6E (ORCPT + 11 others); Mon, 15 Jun 2015 07:58:04 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:36278 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753329AbbFOL6E (ORCPT ); Mon, 15 Jun 2015 07:58:04 -0400 Received: by pabqy3 with SMTP id qy3so64237469pab.3 for ; Mon, 15 Jun 2015 04:58:03 -0700 (PDT) X-Received: by 10.70.63.104 with SMTP id f8mr48090999pds.49.1434369483538; Mon, 15 Jun 2015 04:58:03 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id ll6sm12037478pbc.28.2015.06.15.04.58.02 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 15 Jun 2015 04:58:02 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , rob.herring@linaro.org, nm@ti.com Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, arnd.bergmann@linaro.org, broonie@kernel.org, mike.turquette@linaro.org, sboyd@codeaurora.org, Sudeep.Holla@arm.com, viswanath.puttagunta@linaro.org, l.stach@pengutronix.de, thomas.petazzoni@free-electrons.com, linux-arm-kernel@lists.infradead.org, ta.omasab@gmail.com, kesavan.abhilash@gmail.com, khilman@linaro.org, santosh.shilimkar@oracle.com, Viresh Kumar Subject: [PATCH 02/10] OPP: Create _remove_device_opp() for freeing dev_opp Date: Mon, 15 Jun 2015 17:27:28 +0530 Message-Id: X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This will be used from multiple places later. Lets create a separate routine for that. Signed-off-by: Viresh Kumar --- drivers/base/power/opp.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index 8c3fd57975fb..7895fdd64192 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -449,6 +449,22 @@ static void _kfree_device_rcu(struct rcu_head *head) } /** + * _remove_device_opp() - Removes a device OPP table + * @dev_opp: device OPP table to be removed. + * + * Removes/frees device OPP table it it doesn't contain any OPPs. + */ +static void _remove_device_opp(struct device_opp *dev_opp) +{ + if (!list_empty(&dev_opp->opp_list)) + return; + + list_del_rcu(&dev_opp->node); + call_srcu(&dev_opp->srcu_head.srcu, &dev_opp->rcu_head, + _kfree_device_rcu); +} + +/** * _kfree_opp_rcu() - Free OPP RCU handler * @head: RCU head */ @@ -481,11 +497,7 @@ static void _opp_remove(struct device_opp *dev_opp, list_del_rcu(&opp->node); call_srcu(&dev_opp->srcu_head.srcu, &opp->rcu_head, _kfree_opp_rcu); - if (list_empty(&dev_opp->opp_list)) { - list_del_rcu(&dev_opp->node); - call_srcu(&dev_opp->srcu_head.srcu, &dev_opp->rcu_head, - _kfree_device_rcu); - } + _remove_device_opp(dev_opp); } /**