From patchwork Mon Aug 10 06:31:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 52135 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 5CF6722919 for ; Mon, 10 Aug 2015 06:32:49 +0000 (UTC) Received: by labia3 with SMTP id ia3sf35788489lab.1 for ; Sun, 09 Aug 2015 23:32:48 -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=uxtDaIl2X3frdEYH5cXeQKzIXeyUSj4kRlvCRrEXhts=; b=Uw+IyiapIvHkDyT3G7124Sy3R+CWzaV5BM6J0a0UJmLQcEg6wh5EhJa//Vjk7ZM5Q+ dgzfXFcHEsDVC7fAYumTWCbNpILWQfdEUiMT8xvHqjmYs2YYaoaXOgdxWt9vvq91AAPC LCd2aZNfdGjIL0Ikzvmeu5VX7hJJUlyMWwiUAztHJUGBF+f1w35HBEmyHpYEKymGJz7F FfAuLwdbcWmbr2K1AMgkpJn+Gww6lBlswzoJ/fn4417vM4HM6kaZrlMhXmlQ4qtHSqma 9maS2AhQqfUH7dCyr5TreCMz2cB+TdvBYZka76YW7k/segMQJcpXyKXdEZPsNmZxvfur /tpQ== X-Gm-Message-State: ALoCoQnMSGYBGIl4W5zYgJeTP4JAvgR2BeQ5dAuBAVIcRYZaru9Csp0UPpszjHKIpDK1SBQLYXQ1 X-Received: by 10.112.148.101 with SMTP id tr5mr5808770lbb.13.1439188368292; Sun, 09 Aug 2015 23:32:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.139 with SMTP id o11ls731295lal.80.gmail; Sun, 09 Aug 2015 23:32:48 -0700 (PDT) X-Received: by 10.152.4.163 with SMTP id l3mr19054501lal.35.1439188368141; Sun, 09 Aug 2015 23:32:48 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id vz3si13432609lbb.102.2015.08.09.23.32.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Aug 2015 23:32:48 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbpo9 with SMTP id po9so89637960lbb.2 for ; Sun, 09 Aug 2015 23:32:48 -0700 (PDT) X-Received: by 10.112.140.68 with SMTP id re4mr18740552lbb.72.1439188367914; Sun, 09 Aug 2015 23:32:47 -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.7.198 with SMTP id l6csp1746521lba; Sun, 9 Aug 2015 23:32:47 -0700 (PDT) X-Received: by 10.67.5.162 with SMTP id cn2mr41366570pad.7.1439188366903; Sun, 09 Aug 2015 23:32:46 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pa5si31673691pac.22.2015.08.09.23.32.45; Sun, 09 Aug 2015 23:32:46 -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 S1753593AbbHJGco (ORCPT + 12 others); Mon, 10 Aug 2015 02:32:44 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:34316 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753572AbbHJGck (ORCPT ); Mon, 10 Aug 2015 02:32:40 -0400 Received: by pdbfa8 with SMTP id fa8so27809128pdb.1 for ; Sun, 09 Aug 2015 23:32:40 -0700 (PDT) X-Received: by 10.70.91.143 with SMTP id ce15mr20161405pdb.104.1439188360043; Sun, 09 Aug 2015 23:32:40 -0700 (PDT) Received: from localhost ([223.227.137.11]) by smtp.gmail.com with ESMTPSA id xe5sm12263181pab.17.2015.08.09.23.32.35 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 09 Aug 2015 23:32:39 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , nm@ti.com, sboyd@codeaurora.org Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, khilman@linaro.org, Viresh Kumar , Greg Kroah-Hartman , Len Brown , linux-kernel@vger.kernel.org (open list), Pavel Machek Subject: [PATCH 2/6] PM / OPP: restructure _of_init_opp_table_v2() Date: Mon, 10 Aug 2015 12:01:58 +0530 Message-Id: <804c420eb23e70448c3c2c93f867a0eab3536bfd.1439187821.git.viresh.kumar@linaro.org> 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.176 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: , 'dev_opp' will always be NULL in _of_init_opp_table_v2() after creating OPPs for a device. There is no point comparing it against NULL there. Restructure code a bit to make it more efficient. Signed-off-by: Viresh Kumar --- drivers/base/power/opp.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index 1daaa1a418a2..c9747fb192b1 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -1295,20 +1295,19 @@ static int _of_init_opp_table_v2(struct device *dev, if (WARN_ON(!count)) goto out; - if (!ret) { - if (!dev_opp) { - dev_opp = _find_device_opp(dev); - if (WARN_ON(!dev_opp)) - goto out; - } - - dev_opp->np = opp_np; - dev_opp->shared_opp = of_property_read_bool(opp_np, - "opp-shared"); - } else { + if (ret) { of_free_opp_table(dev); + goto out; } + dev_opp = _find_device_opp(dev); + if (WARN_ON(!dev_opp)) + goto out; + + dev_opp->np = opp_np; + dev_opp->shared_opp = of_property_read_bool(opp_np, + "opp-shared"); + out: return ret; }