Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2540727pxb; Tue, 9 Mar 2021 05:18:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJyqyswU60pWlDNDamVBQajykdj5xqeYRhUlIV7rjlSYeZsmouAy62UZBRyQBaOmb+ueHuox X-Received: by 2002:a17:907:75d9:: with SMTP id jl25mr19886509ejc.452.1615295892501; Tue, 09 Mar 2021 05:18:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615295892; cv=none; d=google.com; s=arc-20160816; b=YWVc9a1NSs0EsPfBEBeKY6Aa2VVSRPBhLLgNAms8Q4PpM2FwC5vEnCBlqD38dHMsN2 s6R7PSq941OYnU7x7PODgTNCYw+fjACZgOf9bqHK3uZ4xUi5oLpsH0vGsAJ7vnCdN9iV Z1lNejXJHvO3RtBaxWFuqfLWSzNQfFAYyO4L7YdXpzTAzDCZKEkyzSijogDpabfjuVNN Wdslnz5Oj9QiimyUfny0nd0MEsjCdhmLuOuMkYdymwsZxcdQwJ+gJcvp7Vmz879oph12 dbTe68eW9bzIOLfnuLr2rJ70zSZeCzjYnAECKLgJ+yjosUlphW5D2w90/G7f499UrDx9 L7uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=pwSU7Owhlm98wIaQ62vyRtVk9iYg4X+kN6mh8Jubw3o=; b=f+sosRXQeb1Xc6lHKhaobNvr3wLyIEWMha0MXGwoQ7/OMqJ/N+DvzBy0QhwQpJ8pq7 DonTriTb+nY8fbeWDMaGecU8GoUWUXRXsF+PAml7nvr6TMakzRj1tpRxdbTCRjxZOGUQ ECIQuUyguLkpNdt2bvtLISTz+9AGoHPF7UJuESgdtlGauaTnDhy/m0hFZi0FDGeWAbM1 WQRmUL68UFTJTleZHCUZ4T2kQjRfKDfFe3g3SIBXB8zu36DJk3C9HuhUgIdMqK820MFE cJzz+eAwm+AUHRb6quVPw8cK3qbyg5zz/SsxRkP5aBmz19WE6jb2HYeYNlPgwlwGKbOY bmuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t25si9198616ejf.502.2021.03.09.05.17.48; Tue, 09 Mar 2021 05:18:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231535AbhCINNQ (ORCPT + 99 others); Tue, 9 Mar 2021 08:13:16 -0500 Received: from inva021.nxp.com ([92.121.34.21]:58250 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230473AbhCINMo (ORCPT ); Tue, 9 Mar 2021 08:12:44 -0500 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 256B3200FA9; Tue, 9 Mar 2021 14:12:43 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id F15C2200FC7; Tue, 9 Mar 2021 14:12:36 +0100 (CET) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 1372240310; Tue, 9 Mar 2021 14:12:28 +0100 (CET) From: Dong Aisheng To: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: dongas86@gmail.com, kernel@pengutronix.de, shawnguo@kernel.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, abel.vesa@nxp.com, Dong Aisheng Subject: [PATCH 04/11] PM / devfreq: bail out early if no freq changes in devfreq_set_target Date: Tue, 9 Mar 2021 20:58:46 +0800 Message-Id: <1615294733-22761-17-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1615294733-22761-1-git-send-email-aisheng.dong@nxp.com> References: <1615294733-22761-1-git-send-email-aisheng.dong@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's unnecessary to set the same freq again and run notifier calls. Signed-off-by: Dong Aisheng --- drivers/devfreq/devfreq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index bf3047896e41..6e80bf70e7b3 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -358,6 +358,9 @@ static int devfreq_set_target(struct devfreq *devfreq, unsigned long new_freq, else cur_freq = devfreq->previous_freq; + if (new_freq == cur_freq) + return 0; + freqs.old = cur_freq; freqs.new = new_freq; devfreq_notify_transition(devfreq, &freqs, DEVFREQ_PRECHANGE); @@ -374,7 +377,7 @@ static int devfreq_set_target(struct devfreq *devfreq, unsigned long new_freq, * and DEVFREQ_POSTCHANGE because for showing the correct frequency * change order of between devfreq device and passive devfreq device. */ - if (trace_devfreq_frequency_enabled() && new_freq != cur_freq) + if (trace_devfreq_frequency_enabled()) trace_devfreq_frequency(devfreq, new_freq, cur_freq); freqs.new = new_freq; -- 2.25.1