From nobody Sat Feb 7 20:41:10 2026 Received: from out-177.mta1.migadu.com (out-177.mta1.migadu.com [95.215.58.177]) (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 AD34A272813 for ; Tue, 2 Dec 2025 11:50:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764676247; cv=none; b=UD8fwYYsKwyNAQYo1aljzOPu2D/jholiZnlPur/ELOjKRbKgak4sCV4d6u7o+bPYvdzzXjGuP9bqyU9lTErf68/hY+tkleqWtQkUNnvGC6rQds6Ohv1EHZA8OV12jHgdRj/twbJegEmuSDXqNUGrCTagDVzElrdvK1R7wFd1xOg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764676247; c=relaxed/simple; bh=yBi+nP/opDiWlOt8Eq/LFEECBJLf3VrAWsvOWSBTk7g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Xfrx5IgEcuAfjMTz5WIN7HFRDk+lsyz2lc3PqkwjLkPBDDtFZLWRJLDQp4GQqlUau7quycC23IuNoM+rgvPjvO6RmsiPfJwv9oY95W4gHE5Paxsww5e88G8PcM0J/98Ucx6FTBMdiw3XGpaO5uz7mNOchLErJhBcnWqsJlhV1A8= 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=XclRLEbV; arc=none smtp.client-ip=95.215.58.177 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="XclRLEbV" 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=1764676243; 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=uu0oTM2zB/ypMQp9kI3DuIVgZil2XGchs7rGpG8lU8Y=; b=XclRLEbVUeZs1+CKRrHJczUEjULJqLBTOLo+O1R0/lE978awlvuKsVgp25QrM+LPoR52RQ Ueq1HW+boWJnbDYgwspYnSoq2Htkk/JVm0bf+uB9wPkWHfiFfdtRIAZHdYxgNxiEcs6nrs BllDDDfB6ot39ecUw7uv1mq2kIge+dg= From: Thorsten Blum To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Orson Zhai , Baolin Wang , Chunyan Zhang Cc: Thorsten Blum , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] thermal: sprd: Use min instead of clamp in sprd_thm_temp_to_rawdata Date: Tue, 2 Dec 2025 12:50:33 +0100 Message-ID: <20251202115034.375174-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" Clamping 'val' to itself is unnecessary and the expression can be simplified by using min() instead. Casting SPRD_THM_RAW_DATA_HIGH to u32 is also redundant and can be removed. Signed-off-by: Thorsten Blum Reviewed-by: Baolin Wang --- drivers/thermal/sprd_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c index 44fa45f74da7..d683fcb0f8ab 100644 --- a/drivers/thermal/sprd_thermal.c +++ b/drivers/thermal/sprd_thermal.c @@ -201,7 +201,7 @@ static int sprd_thm_temp_to_rawdata(int temp, struct sp= rd_thermal_sensor *sen) */ val =3D (temp + sen->cal_offset) / sen->cal_slope; =20 - return clamp(val, val, (u32)(SPRD_THM_RAW_DATA_HIGH - 1)); + return min(val, SPRD_THM_RAW_DATA_HIGH - 1); } =20 static int sprd_thm_read_temp(struct thermal_zone_device *tz, int *temp) --=20 Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4