From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A805343D79 for ; Wed, 12 Nov 2025 17:21:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762968103; cv=none; b=pqn4NDfh8LETBrjEOl9RpjEH03xxeBWQz3Ikb/fr5xRm2boKCgS1PC7ixiZIG3YUfU08org0PlrI+CINKXiCUUk3uKG5C2qFIp8qpOt7uKvfQ0HV7pfAldwq0/cWw1nV1shqYjGBrDJoh++DZO2UmSYhZ3fgjTtxLMQOLGST8U8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762968103; c=relaxed/simple; bh=N5adIYAtdFqjBajODZDFHwOrJ7rnYtok6HIzFkiZyo8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OGZwuADhGMiFs1bBrpNIxP1YClh+rlN68ejDL/JgaOltG0nfAHOc73MSRARPxoidoB6WM7WOOXeoaryS3pkB0rIoTa7ivdE5fXwcvSsCIIDYDCrNqzQVAP7Y7VeYTtQbs30gqMwgMzH+FTjEds7UryFHPeUNvJoHnD2ReyySM+o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=UBRFJnus; arc=none smtp.client-ip=95.215.58.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="UBRFJnus" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1762968099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=jGs7Hv9KNWjSfl9ACuS3BD9nItk1f1HqEtWBU6SNvgo=; b=UBRFJnusMotR6GK+7LDYXvFe2NVdRm1AtZotjH2GkbguPKudCQW7xTV8MCmt5CCnYw/flw 1/HzqeBJyMByGy0LTToYCim0PfnWjfXQGQ4x9fuwgCQ/T+G2+xVUAi4cSZs2Trijh0A6e4 GxpLD8HxReL25xprxm6GzOAafIcFSTQ= From: Thorsten Blum To: Dmitry Osipenko , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Thierry Reding , Jonathan Hunter Cc: Thorsten Blum , linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND] PM / devfreq: tegra30: use min to simplify actmon_cpu_to_emc_rate Date: Wed, 12 Nov 2025 18:21:21 +0100 Message-ID: <20251112172121.3741-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-tegra@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Use min() to improve the readability of actmon_cpu_to_emc_rate() and remove any unnecessary curly braces. Reviewed-by: Dmitry Osipenko Signed-off-by: Thorsten Blum --- drivers/devfreq/tegra30-devfreq.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c index 4a4f0106ab9d..2c9813bd697e 100644 --- a/drivers/devfreq/tegra30-devfreq.c +++ b/drivers/devfreq/tegra30-devfreq.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -326,14 +327,9 @@ static unsigned long actmon_cpu_to_emc_rate(struct tegra_devfreq *tegra, unsigned int i; const struct tegra_actmon_emc_ratio *ratio = actmon_emc_ratios; - for (i = 0; i < ARRAY_SIZE(actmon_emc_ratios); i++, ratio++) { - if (cpu_freq >= ratio->cpu_freq) { - if (ratio->emc_freq >= tegra->max_freq) - return tegra->max_freq; - else - return ratio->emc_freq; - } - } + for (i = 0; i < ARRAY_SIZE(actmon_emc_ratios); i++, ratio++) + if (cpu_freq >= ratio->cpu_freq) + return min(ratio->emc_freq, tegra->max_freq); return 0; } -- 2.51.1