From patchwork Thu May 26 05:57:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 68670 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp227942qge; Wed, 25 May 2016 22:57:35 -0700 (PDT) X-Received: by 10.67.13.144 with SMTP id ey16mr11241436pad.147.1464242255463; Wed, 25 May 2016 22:57:35 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y66si4279170pfy.63.2016.05.25.22.57.35; Wed, 25 May 2016 22:57:35 -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; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752665AbcEZF5e (ORCPT + 14 others); Thu, 26 May 2016 01:57:34 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:33704 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752586AbcEZF5d (ORCPT ); Thu, 26 May 2016 01:57:33 -0400 Received: by mail-pf0-f177.google.com with SMTP id b124so27463568pfb.0 for ; Wed, 25 May 2016 22:57:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=zagEASf8OmJdm1trKdZo20pOwlNAhwr1OQvSfsTz+yo=; b=FKhiV4zyAD6x7BHAH0A79xC1ty9thL7ESEELTd4UdVtbfhc0cYIikCIkFCh9BdPMSm ogIbVicanlQrqRFV67Q+xeRf+TLvFfSegM33u09fvAvZLiyjxHe0M4JrgT5VkLVJhH+6 PmPszn76lYhfOa1O2qQugTnpDMUWL/gNAgUvQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=zagEASf8OmJdm1trKdZo20pOwlNAhwr1OQvSfsTz+yo=; b=Uk/MAc2fxmoZTOk/vyE0R9LZmU7bl6ZN7zhIUMMaxCwgFP2y6hFi5xdiZz3bHhNF8h Ve42Ys7ftuXjB46HEXQpEk8IcGq3cBYcTEQo4aexKVShCH3LjP3Elp4Up7QeZTQWL3HC 3o4YYDEMVqgpP3r7l9a3RRw0NTuWpowaUELx7Bya+6wC+sdGHIGfjjUldhVRt8ds4Kg/ c6Pu8nGDU6vO0Q3RYuvhht+ic7F91MlMihHQ/4p8J6S4tK2AZBvSJAFec7fndfSP6g58 yNK8UapGP98IZzL3PQkglQ/5Mh+kIIvqeLvyf/RasJXaErIJv1SLUdKu0isgETYMcxWp /+4g== X-Gm-Message-State: ALyK8tIHb8AVORoo7CJCPd4tI0gRXogR7aGnOYlTGNtUZu5tuUzu/DAwYapNXLEA4lopev4z X-Received: by 10.98.157.4 with SMTP id i4mr11412946pfd.31.1464242252875; Wed, 25 May 2016 22:57:32 -0700 (PDT) Received: from localhost ([122.172.42.124]) by smtp.gmail.com with ESMTPSA id h16sm2659597pfj.0.2016.05.25.22.57.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 May 2016 22:57:32 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org Subject: [PATCH] cpufreq: Use clamp_val() Date: Thu, 26 May 2016 11:27:24 +0530 Message-Id: X-Mailer: git-send-email 2.7.1.410.g6faf27b Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Use clamp_val() instead of open coding it. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 2.7.1.410.g6faf27b -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 0b5cf0e4bd4f..6ddb12c0f6fb 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1963,10 +1963,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, return -ENODEV; /* Make sure that target_freq is within supported range */ - if (target_freq > policy->max) - target_freq = policy->max; - if (target_freq < policy->min) - target_freq = policy->min; + clamp_val(target_freq, policy->min, policy->max); pr_debug("target for CPU %u: %u kHz, relation %u, requested %u kHz\n", policy->cpu, target_freq, relation, old_target_freq);