From patchwork Wed Dec 10 04:15:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 42084 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E9381260BE for ; Wed, 10 Dec 2014 04:16:24 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id l18sf1391692wgh.10 for ; Tue, 09 Dec 2014 20:16:24 -0800 (PST) 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=DEFiL0gV3L9b5EJK4WN/B5GuSmAnS3xneKpmQYrI+Rs=; b=EoM+eniaqtUDes6ZbdDfbAsyq5yzeBREfMEazTy/+aDtX28qann8XuJJB34WqEwo44 NKlrJUG53J6M0XXUwy7oh3zHLflx/0BSLNcwLsokveDzDuC03BV7EdY+PFplIFKlGba6 CAOMek1s36ZxssuQ3aukuhVv/NhpS6RA23riMMTGwh5JdG3wA/Yw+xzKddrXHYF435Zs 76pzW3eGNoIn/4NsMV8awND/tB+40k8r+FxAJjxuHCkAsbTS0RUnWlMK1k+e6lfxodFw pcw9qxcleGIrueYRXmLaKl6lKL9e9GQh5PqbTwsm5A3B/FyQY63CKSmEQvNjsMGshcMF 58Pg== X-Gm-Message-State: ALoCoQn1bYHQvTYkG+kjHeNl8VALsvoFFEhpyak1DYXYXoCLqvPkVQYTSk762scmWWqxpFw0U06y X-Received: by 10.112.168.70 with SMTP id zu6mr263218lbb.8.1418184984221; Tue, 09 Dec 2014 20:16:24 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.37 with SMTP id 5ls83704laz.81.gmail; Tue, 09 Dec 2014 20:16:24 -0800 (PST) X-Received: by 10.112.171.199 with SMTP id aw7mr1896241lbc.40.1418184984078; Tue, 09 Dec 2014 20:16:24 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id bc1si3292398lbc.80.2014.12.09.20.16.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Dec 2014 20:16:23 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id gd6so1766984lab.1 for ; Tue, 09 Dec 2014 20:16:23 -0800 (PST) X-Received: by 10.112.14.69 with SMTP id n5mr1923819lbc.34.1418184983898; Tue, 09 Dec 2014 20:16:23 -0800 (PST) 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.184.201 with SMTP id ew9csp834708lbc; Tue, 9 Dec 2014 20:16:23 -0800 (PST) X-Received: by 10.70.130.174 with SMTP id of14mr3509391pdb.90.1418184981781; Tue, 09 Dec 2014 20:16:21 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ei12si4749825pdb.165.2014.12.09.20.16.21 for ; Tue, 09 Dec 2014 20:16:21 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755336AbaLJEQS (ORCPT + 12 others); Tue, 9 Dec 2014 23:16:18 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:46314 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755310AbaLJEQR (ORCPT ); Tue, 9 Dec 2014 23:16:17 -0500 Received: by mail-pa0-f41.google.com with SMTP id rd3so1989070pab.0 for ; Tue, 09 Dec 2014 20:16:17 -0800 (PST) X-Received: by 10.70.96.145 with SMTP id ds17mr3470395pdb.88.1418184976981; Tue, 09 Dec 2014 20:16:16 -0800 (PST) Received: from localhost ([122.166.92.172]) by mx.google.com with ESMTPSA id yw1sm2791569pbb.52.2014.12.09.20.16.15 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 09 Dec 2014 20:16:16 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar Subject: [PATCH 3/5] opp: reuse find_device_opp() instead of duplicating code Date: Wed, 10 Dec 2014 09:45:33 +0530 Message-Id: X-Mailer: git-send-email 2.2.0 In-Reply-To: <0a31e317c90f601f77cc21b80455633928c70c96.1418184737.git.viresh.kumar@linaro.org> References: <0a31e317c90f601f77cc21b80455633928c70c96.1418184737.git.viresh.kumar@linaro.org> In-Reply-To: <0a31e317c90f601f77cc21b80455633928c70c96.1418184737.git.viresh.kumar@linaro.org> References: <0a31e317c90f601f77cc21b80455633928c70c96.1418184737.git.viresh.kumar@linaro.org> 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.215.42 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: , Reuse find_device_opp() in opp_set_availability() instead of duplicating code. Signed-off-by: Viresh Kumar --- drivers/base/power/opp.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index fa065d6e1731..525ffb202d77 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -597,7 +597,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_remove); static int opp_set_availability(struct device *dev, unsigned long freq, bool availability_req) { - struct device_opp *tmp_dev_opp, *dev_opp = ERR_PTR(-ENODEV); + struct device_opp *dev_opp; struct dev_pm_opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV); int r = 0; @@ -611,12 +611,7 @@ static int opp_set_availability(struct device *dev, unsigned long freq, mutex_lock(&dev_opp_list_lock); /* Find the device_opp */ - list_for_each_entry(tmp_dev_opp, &dev_opp_list, node) { - if (dev == tmp_dev_opp->dev) { - dev_opp = tmp_dev_opp; - break; - } - } + dev_opp = find_device_opp(dev); if (IS_ERR(dev_opp)) { r = PTR_ERR(dev_opp); dev_warn(dev, "%s: Device OPP not found (%d)\n", __func__, r);