From nobody Mon Dec 1 22:04:03 2025 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (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 17154244684 for ; Sun, 30 Nov 2025 22:55:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764543329; cv=none; b=ClJ+njUpvInnldg8QdUPk7HWXE0wn66uNJ26DEtvUBYSi3C1uWFK8CO+hshbSpn5dTwYXRKFI74XLK7WOSSTKxMKKgJmvm1sHqAg7UWY2MrT5wgdQ38PPCCV5iec3kfPByxUtiJ0iGw1O0jQWnAkzXqpmaJzsmF+WK1Xjopa/bs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764543329; c=relaxed/simple; bh=iqGXw7/nlSwy7cUOgS9lavGIOvcajtj6ZI3/n851DF4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Yf46IU6Bj/QqJoNQTrLHNXGhmHNmeuP4OU/AkaAvsT2V6LUw9hTq5Du77a0VS/zSR6xcCAhXyfjoLdB3eDzMk/+VVERUYvcCbX3TkCu67fYWZGqWH2fg/fXO3ipQ2UAuorx79nNWyr9Q8IWkOQfsKXBOcl6GhZx+47t5EtJ/U7M= 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=Hq606jXL; arc=none smtp.client-ip=91.218.175.171 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="Hq606jXL" 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=1764543314; 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=Y3zi54fqg3Dk2cRhgMV9Qr4FUT5aZsi0jpnqIp0ID9w=; b=Hq606jXLAwrThWHNyJtMCpuwys4cwSkneu/YjuItjVgYvxPTx400OdaeCStqVB5tF65tXM WNAo/urFr5JOCp9gjtfb5vhfp9iMHHWH5PSqnGuYml7Y79S3qqOwo/dPWrBgfGpludcxcw 3IKOvpFJpIcfw8C3ujTlI9S3D1AxeYc= 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] thermal/drivers/brcmstb_thermal: Use max to simplify brcmstb_get_temp Date: Sun, 30 Nov 2025 23:54:58 +0100 Message-ID: <20251130225459.46241-1-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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. Signed-off-by: Thorsten Blum Reviewed-by: Florian Fainelli --- 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; } --=20 Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4