From patchwork Mon Jul 27 03:20: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: 51478 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 patches.linaro.org (Postfix) with ESMTPS id 1F56E22DA5 for ; Mon, 27 Jul 2015 03:21:10 +0000 (UTC) Received: by lbvb1 with SMTP id b1sf22895516lbv.3 for ; Sun, 26 Jul 2015 20:21:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to:user-agent:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=5IKrAUmHLXUwB6oqXcxlnVwrQJ3ZZbWqD+Gh020khpM=; b=OdJgsz4FDoAQLiL15r/5f2OJkqlODb8sZZzqu0SPl5v+y0WEeG+nx3HEFsTBO89p3y Jr0BiXONRy8mFA9gJGnpdcoVSLPPonPkF4kE2bFQT8/Vz+SmwD+7fiWMFfOw1rZ3ePbS B9yxZCt/+eMpeFhNmt/BuBib8HUoOZ4SCnfBM3GtfL/iGJLi/BAffVLh1QdZxovbuVOZ Cj1MXFZ4rt3thj59YxIJqRDApI+BhDnrqXK0w87Qrlgl7A2IffwqjcMc2BcAFCned7Up wtDmtyUnuuSQ+CbxVTvGlDLwvfKzFKPWe/xfQXq2aNbs81MdqFuV4WXO7J1cSGJBP2Kk 9Wwg== X-Gm-Message-State: ALoCoQlz2zJ5OBuJGMHYx5A/Pt38jl+acDBcdIBQRqLOZjvTiI4P/iRJlAAsgh9vF4cSy2CpoNQe X-Received: by 10.112.160.39 with SMTP id xh7mr11336498lbb.22.1437967268409; Sun, 26 Jul 2015 20:21:08 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.234 with SMTP id w10ls513766lag.41.gmail; Sun, 26 Jul 2015 20:21:08 -0700 (PDT) X-Received: by 10.112.143.136 with SMTP id se8mr24826244lbb.101.1437967268263; Sun, 26 Jul 2015 20:21:08 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id wj1si14157366lbb.170.2015.07.26.20.21.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Jul 2015 20:21:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbbyj8 with SMTP id yj8so44823074lbb.0 for ; Sun, 26 Jul 2015 20:21:08 -0700 (PDT) X-Received: by 10.152.4.163 with SMTP id l3mr25347279lal.35.1437967268125; Sun, 26 Jul 2015 20:21: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.7.198 with SMTP id l6csp1285824lba; Sun, 26 Jul 2015 20:21:06 -0700 (PDT) X-Received: by 10.66.141.109 with SMTP id rn13mr62689352pab.127.1437967266070; Sun, 26 Jul 2015 20:21:06 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c3si29856840pat.105.2015.07.26.20.21.05; Sun, 26 Jul 2015 20:21: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 S1755141AbbG0DVE (ORCPT + 12 others); Sun, 26 Jul 2015 23:21:04 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:34340 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754972AbbG0DVC (ORCPT ); Sun, 26 Jul 2015 23:21:02 -0400 Received: by pacan13 with SMTP id an13so44576176pac.1 for ; Sun, 26 Jul 2015 20:21:02 -0700 (PDT) X-Received: by 10.66.162.198 with SMTP id yc6mr63412658pab.74.1437967262072; Sun, 26 Jul 2015 20:21:02 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id fi7sm26398881pdb.25.2015.07.26.20.21.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 26 Jul 2015 20:21:01 -0700 (PDT) Date: Mon, 27 Jul 2015 08:50:58 +0530 From: Viresh Kumar To: Stephen Boyd Cc: Rafael Wysocki , rob.herring@linaro.org, nm@ti.com, thomas.petazzoni@free-electrons.com, kesavan.abhilash@gmail.com, linaro-kernel@lists.linaro.org, ta.omasab@gmail.com, khilman@linaro.org, linux-pm@vger.kernel.org, viswanath.puttagunta@linaro.org, santosh.shilimkar@oracle.com, broonie@kernel.org, mike.turquette@linaro.org, Sudeep.Holla@arm.com, arnd.bergmann@linaro.org, linux-arm-kernel@lists.infradead.org, l.stach@pengutronix.de Subject: Re: [PATCH 07/10] opp: Add OPP sharing information to OPP library Message-ID: <20150727032058.GI19944@linux> References: <2e1c7fcc1fb62f73c82bd57d196d054ba2607a55.1434369079.git.viresh.kumar@linaro.org> <55A986DD.3010104@codeaurora.org> <20150718063304.GD11802@linux> <55AD33F3.4000302@codeaurora.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <55AD33F3.4000302@codeaurora.org> User-Agent: Mutt/1.5.21 (2010-09-15) 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.171 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: , On 20-07-15, 10:46, Stephen Boyd wrote: > >+static struct device_opp *_managed_opp(const struct device_node *np) > >+{ > >+ struct device_opp *dev_opp; > >+ > >+ list_for_each_entry_rcu(dev_opp, &dev_opp_list, node) > >+ if (dev_opp->np == np) { > >+ /* > >+ * Multiple devices can point to the same OPP table and > >+ * so will have same node-pointer, np. > >+ * > >+ * But the OPPs will be considered as shared only if the > >+ * OPP table contains a "opp-shared" property. > >+ */ > >+ if (dev_opp->shared_opp) > >+ return dev_opp; > >+ else > >+ return NULL; > >+ > > The janitors will probably find this and say that it could be > simplified to an if () and a return without the else. And I am trying to make the janitors happy with this: diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index eb920e3f115b..8c81784fe473 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -168,7 +168,7 @@ static struct device_opp *_managed_opp(const struct device_node *np) { struct device_opp *dev_opp; - list_for_each_entry_rcu(dev_opp, &dev_opp_list, node) + list_for_each_entry_rcu(dev_opp, &dev_opp_list, node) { if (dev_opp->np == np) { /* * Multiple devices can point to the same OPP table and @@ -177,11 +177,9 @@ static struct device_opp *_managed_opp(const struct device_node *np) * But the OPPs will be considered as shared only if the * OPP table contains a "opp-shared" property. */ - if (dev_opp->shared_opp) - return dev_opp; - else - return NULL; + return dev_opp->shared_opp ? dev_opp : NULL; } + } return NULL; }