Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3920706pxf; Mon, 22 Mar 2021 20:14:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpN5lYQB1mqKtsFK38DxMem0BxqVaQeRBdqCjq2zIYXc6RkRaLEQPp4e/u8SJP9lvX4EOs X-Received: by 2002:a17:906:4a05:: with SMTP id w5mr2678050eju.526.1616469266178; Mon, 22 Mar 2021 20:14:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616469266; cv=none; d=google.com; s=arc-20160816; b=SHuvseylEGfSuvt46Uk2tqTiY+XFVsKqx0G88Q4243U1eGH5kx5P8ZhPi9I7EWASTe utar8VlRV3Cn+EDcCyLsIB7/tsSBhv/1/MGHMUG9+tVaGMnUrfP9vjSIp58SNarz64OT 8CJqPnfyZcQjbHoWMoQU123NCHh/9bovwMIajcBow5ZGXKhsdoHER9OH/1wxchavJLdu H9VpMqJ92rfYGw6lc8+1vKyxuEr6TbTHfzkUZZvA+Fez+ffbC7QSxgrSgSIsF0oOeZej 4QIcwuQp5iGMyMv5mHeSKvO1owVR99e1XIIiON0C/DWDtHcdAFI4eOWTfdxV+AJcPJy2 1yEQ== 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=/hERblgwJMCcKnad2PyKgj3Tkk/f9jkJXpjuA7JnaQA=; b=refeVlsPiJFDrKT/s0IaFP/8K2jEOrHOoiburz7FDH/R/c59d8l0EDuSJa++fIXj3Q 5R+flWE9J2xMxpo39c/pKGvb96DfNWxFiEbZLAmPufjcwkA/lcZ2K6A9ajdsKT/CMjoN nDSslr3fBDKNoC5TLb19fTkWLVDZC3KJlJA32y5kE5DWzPWaqfQ9hgepaQbe8+UH0R3w cnq4ru4CrAiuML1hJe2Z1l/TWsuSZU5qMeTJyl6YJryztChKaLaylH/1noc1QcORYdhO 4XRdYCDn8jvnppm4ERrrFgrRG9N7S7RTw57eEaYjEFN7tpg4/Wsqg0HaDCx3zQohYlLb z5YQ== 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 y1si12306271eds.133.2021.03.22.20.14.04; Mon, 22 Mar 2021 20:14:26 -0700 (PDT) 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 S229614AbhCWDNI (ORCPT + 99 others); Mon, 22 Mar 2021 23:13:08 -0400 Received: from inva021.nxp.com ([92.121.34.21]:55372 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229865AbhCWDNG (ORCPT ); Mon, 22 Mar 2021 23:13:06 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id B2911201B09; Tue, 23 Mar 2021 04:13:05 +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 029D220011B; Tue, 23 Mar 2021 04:13:01 +0100 (CET) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 8377A4030B; Tue, 23 Mar 2021 04:12:54 +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 V2 4/6] PM / devfreq: bail out early if no freq changes in devfreq_set_target Date: Tue, 23 Mar 2021 10:59:17 +0800 Message-Id: <1616468359-14513-5-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1616468359-14513-1-git-send-email-aisheng.dong@nxp.com> References: <1616468359-14513-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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index b537fd9602cd..cacda7d1f858 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -403,13 +403,16 @@ static int devfreq_set_target(struct devfreq *devfreq, unsigned long new_freq, { struct devfreq_freqs freqs; unsigned long cur_freq; - int err = 0; + int err; if (devfreq->profile->get_cur_freq) devfreq->profile->get_cur_freq(devfreq->dev.parent, &cur_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); @@ -426,7 +429,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); devfreq_update_transitions(devfreq, cur_freq, new_freq, @@ -445,7 +448,7 @@ static int devfreq_set_target(struct devfreq *devfreq, unsigned long new_freq, if (devfreq->suspend_freq) devfreq->resume_freq = new_freq; - return err; + return 0; } /** -- 2.25.1