From patchwork Thu Jan 21 11:17:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 367811 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp471889jam; Thu, 21 Jan 2021 03:22:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzF1SRtT7VT5Kr6eBeed5V1WV3zwkmdsmkMG6P4bgsx9kp3x6C5zzJLQEAE+Q5NL5uxXJ3g X-Received: by 2002:a17:907:b01:: with SMTP id h1mr8769870ejl.450.1611228127525; Thu, 21 Jan 2021 03:22:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611228127; cv=none; d=google.com; s=arc-20160816; b=bZeZQVc/4Enx4cA+savtrzEGiK2nMa2RUC3p4ZXyMgP/br6DBzury6rMadek4PWdR/ uilYD9AMK8BFVZTK+sFQyZNsRysqQLRLa4RVKwcn1hUcl0anMTqBWbeFBI4+ITZ6e2O2 e7pi8myIHnMJzcFRiID3pvKPb38YS8rDrXw/939/snc75fZXshet9tIJutUpzToCEXH2 ZyAsTzFPUhQlcqyunrgNde0mkqLF1Og7NUsvAv8cz+KASDW61ca5WGkjKdFEauU2Ykv1 /HP7lCThX//naOzcoIIuFv95SOF5LRGldGukY0DEGCVd191rJi46sunLRAKV4gwb0vPi dcAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=t5BvkMjuaVY08gUJbMK2zLQ+31ycbwXJT/Kur/3Z95w=; b=qZNd4oqCK2h9kUYTIH1IzMl1aWLKr5ZcEmp2zCeOuH+UaYJStsisquUROvM5eNvyUW JsC4EXth2pvDXhyLZb+Stg8zQGJxW8/FlXQ0MffpQ5hx3QqSFJT3D+qD2Z5KNSfywVAY vMo9Qe6N7TBEJPBAPTxbK/ErUUbhwzY6KYiHGT68yqNv/NTjDlkX2HyOUXVsVlpbTU3J yPpTSjioiF2eg1ddjrKKVuMwhi047DwrYlJtuq3BLoMs6HM967cz1EH04ooH5sX6T5Wn F0Nl/dPi4kNDOLH3E52zF1BYMtMjz3eJSyb6mPMaYCXSZdBj+ohiyDYUYEQTO9MQbWkt vQFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F1sJbjeF; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h6si1753700ejq.244.2021.01.21.03.22.07; Thu, 21 Jan 2021 03:22:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F1sJbjeF; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729908AbhAULUp (ORCPT + 7 others); Thu, 21 Jan 2021 06:20:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728846AbhAULUn (ORCPT ); Thu, 21 Jan 2021 06:20:43 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6184CC061793 for ; Thu, 21 Jan 2021 03:18:48 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id y8so1097787plp.8 for ; Thu, 21 Jan 2021 03:18:48 -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 :mime-version:content-transfer-encoding; bh=t5BvkMjuaVY08gUJbMK2zLQ+31ycbwXJT/Kur/3Z95w=; b=F1sJbjeFjLx44rMNM9VXJT1VmL0MJFDwx3vGHr2mL8qHmnto11WjN8OD6D0Tyl/3vP yxjF81dLQrtt3ea+reaI7O2lR4kp3WgLQ2E6yT65oolB8vJLDeETZLwZ8AT+H4p8KKFM eVMKCCkc3lJqxoLslpyYIPktsJtfe5IAPrM3JkeG+gRiiPJgp7Ea+eeujptT99yVRHvE 3w0lz9qDfeIR6CqQj7nyk17ZQYSS2gaCG++MImOdhNGYBOSZMr3IFxb3hxWFMP1rpLwi t0cbvWkGBBmFxH5Ts7PPu2urw4C14l638fkduz4HQve/esYKhJsb+KyPYqvVC6MIXtUr 81tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=t5BvkMjuaVY08gUJbMK2zLQ+31ycbwXJT/Kur/3Z95w=; b=gqbFlJtBRRVDsJ3Oy6LfxIlVwNOGIAzrmS1DnP9sd6iroI8F++tQhKlqh4Z9GaK+zT x3D750cZzfskAQo/YHSKuHAunQ7j78M7R3wiCLCB363myOhSYmRi9eKzjunTHbm1ZR2r 9YpRa+t/WRT8nKubIJTTLW5N81TX0ubxAOF6UCHf9zK8EA8biVkZPD+ZM1+vZ3Ip9yPc 2kTe40podliXwxCfOrJq8TNVoXeYhXfcudzWWRFjcpDJG/EJip3J5LDnurCFr44JkT4p +lunT/3IBl+l57znNk25u7DUUwWJDsso5VqbkBHlkVKdrBFK4kdktkGqGLLmVbEjx8Vn 6Y6A== X-Gm-Message-State: AOAM531YTxTFihx6HSDIm5W6WChbnpmqf8di1g9UvD6JcILPK+kdswEI VtvFHUDuL6yElUnkJieaJ3BUSA== X-Received: by 2002:a17:90a:9eb:: with SMTP id 98mr4799013pjo.40.1611227927908; Thu, 21 Jan 2021 03:18:47 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id d22sm5661965pjv.11.2021.01.21.03.18.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 03:18:47 -0800 (PST) From: Viresh Kumar To: Dmitry Osipenko , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Sibi Sankar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 02/13] opp: No need to check clk for errors Date: Thu, 21 Jan 2021 16:47:42 +0530 Message-Id: <26fe0df01647061cee8278af64a86610d65711f6.1611227342.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Clock is not optional for users who call into dev_pm_opp_set_rate(). Remove the unnecessary checks. While at it also drop the local variable for clk and use opp_table->clk instead. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) -- 2.25.0.rc1.19.g042ed3e048af diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 9ec8e42981d0..cb5b67ccf5cf 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -987,7 +987,6 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) struct opp_table *opp_table; unsigned long freq, old_freq, temp_freq; struct dev_pm_opp *old_opp, *opp; - struct clk *clk; int ret; opp_table = _find_opp_table(dev); @@ -1001,19 +1000,11 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) goto put_opp_table; } - clk = opp_table->clk; - if (IS_ERR(clk)) { - dev_err(dev, "%s: No clock available for the device\n", - __func__); - ret = PTR_ERR(clk); - goto put_opp_table; - } - - freq = clk_round_rate(clk, target_freq); + freq = clk_round_rate(opp_table->clk, target_freq); if ((long)freq <= 0) freq = target_freq; - old_freq = clk_get_rate(clk); + old_freq = clk_get_rate(opp_table->clk); /* Return early if nothing to do */ if (opp_table->enabled && old_freq == freq) { @@ -1031,7 +1022,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) * equivalent to a clk_set_rate() */ if (!_get_opp_count(opp_table)) { - ret = _generic_set_opp_clk_only(dev, clk, freq); + ret = _generic_set_opp_clk_only(dev, opp_table->clk, freq); goto put_opp_table; } @@ -1071,7 +1062,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) opp->supplies); } else { /* Only frequency scaling */ - ret = _generic_set_opp_clk_only(dev, clk, freq); + ret = _generic_set_opp_clk_only(dev, opp_table->clk, freq); } /* Scaling down? Configure required OPPs after frequency */