From nobody Sun Apr 12 07:55:18 2026 Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183]) (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 51EDA368958 for ; Thu, 2 Apr 2026 16:56:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775149022; cv=none; b=Ad9jn+D+wm/rje6Vlp2c0wA5QP+f0w9GC74mZqn9VgF+PrVb5RFtcTuh62TH+DKB1erEb9YzoehhuXh/JtaSeJ+fyfpd6lyM2AX06ohfA67EOChOd0xQ1+4JCUfuVQ3U47cMCupaX/3DHquLIxV3jgSsUS3Stk5xCcITIkYfF5E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775149022; c=relaxed/simple; bh=TE1aEBQME/LPSM0BPcXb8Dh4e+xxL84n+t5+RDaQR7g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=lUMFdgy2bMNmYmttr/CovIEjLEAVR6uwAW9yGyazigfKmiTL2OzUka9nxdlIBcKSYNO2CS6X2b3dx6XxpE/Fs43H8rEs3tO+ctn9eIxEJtXgLpyug4LwpugdNHww+wU82gW64xgVf1J20U406fbjA0hG2ZCybGbjbG4ypj6X/ws= 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=vJftdmQi; arc=none smtp.client-ip=95.215.58.183 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="vJftdmQi" 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=1775149013; 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=+fL9n2jTiYjb2TnUsQWtFMCRrAem7LSQMh+WmdC022k=; b=vJftdmQic4VWzUsKGPrT8T6QYMBvkODNU+rNMbuogX5DPj3NIo7hKk8HN1F4WR2AiAX3Pa 9zOfobf+ZYRQhUTIhrGTFrSH+ghye6DlMNXYTbnr7iL3nCiGYmREfXCXpRwaPvFIvX7bbe ErZPAj/irahI+yAytr7RFbakCeYVx4k= From: Thorsten Blum To: Markus Mayer , Broadcom internal kernel review list , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Florian Fainelli Cc: Thorsten Blum , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND] thermal/drivers/brcmstb_thermal: Use max to simplify brcmstb_get_temp Date: Thu, 2 Apr 2026 18:56:18 +0200 Message-ID: <20260402165616.895305-3-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1478; i=thorsten.blum@linux.dev; h=from:subject; bh=TE1aEBQME/LPSM0BPcXb8Dh4e+xxL84n+t5+RDaQR7g=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDJnn5m/Q8ehU3rBYxPVh5VwtY+XNXw/vlzi2LWyeAz/D4 R/LP4rndpSyMIhxMciKKbI8mPVjhm9pTeUmk4idMHNYmUCGMHBxCsBETJYwMiw0mSDkfE1Vp3LV QrHPEk0Cj2Q6nJ/+8K5q5Lnzfu2+3A8M/5SrBA7MNFh033XXi8Luyu6vgqa7NNd/ureg5YVAYGH FJGYA X-Developer-Key: i=thorsten.blum@linux.dev; a=openpgp; fpr=1D60735E8AEF3BE473B69D84733678FD8DFEEAD4 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Use max() to simplify brcmstb_get_temp() and improve its readability. Since avs_tmon_code_to_temp() returns an int, change the data type of the local variable 't' from long to int. No functional changes. Reviewed-by: Florian Fainelli Signed-off-by: Thorsten Blum --- drivers/thermal/broadcom/brcmstb_thermal.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/b= roadcom/brcmstb_thermal.c index f46f2ddc174e..a9ffa596f7c0 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -154,7 +155,7 @@ static int brcmstb_get_temp(struct thermal_zone_device = *tz, int *temp) { struct brcmstb_thermal_priv *priv =3D thermal_zone_device_priv(tz); u32 val; - long t; + int t; =20 val =3D __raw_readl(priv->tmon_base + AVS_TMON_STATUS); =20 @@ -164,10 +165,7 @@ static int brcmstb_get_temp(struct thermal_zone_device= *tz, int *temp) val =3D (val & AVS_TMON_STATUS_data_msk) >> AVS_TMON_STATUS_data_shift; =20 t =3D avs_tmon_code_to_temp(priv, val); - if (t < 0) - *temp =3D 0; - else - *temp =3D t; + *temp =3D max(0, t); =20 return 0; }