Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2166972iof; Tue, 7 Jun 2022 21:58:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOYGdCaGxnhDF86IJnHQArDKc3s9aJomrhRkNTJuxSOxrY9m86dp1k8HuvWhsL79fTJege X-Received: by 2002:a17:902:e552:b0:163:6a5e:4e08 with SMTP id n18-20020a170902e55200b001636a5e4e08mr31978322plf.130.1654664334976; Tue, 07 Jun 2022 21:58:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654664334; cv=none; d=google.com; s=arc-20160816; b=jtmNfJUjjYfod1gq0oIT2fFKstPT/ZvF6rk+8XgbcfsNRhX8J37Irf7D/NaF4nx7Ah Gi8uLCixwdz6IatT89tyVR6Noq/zNQilJ9Sr4f9TWoOXNtaVBJxoHXH0KwQ1CAcI/0W4 1B+gMfnSS0Q31sllf9Ls+117gUx7MtycNek+X47tuiEwUtpBqoXHuCGzVxDBbuXeG/hz S44YluKgnsonxQ7vSDNlVf1Bh6YoD7U1xggP14AL1DTOFxDx5sVCqpCvpwjKS2esPXgL R07zHAei/GQISm42w3Oiio4leASbwFv4bjg435rr1KiI5WGAmT15Nl5F4GPT7JG/2ZN/ CMXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oEgodNW0AebUKXwlKSstMPTjqWTdCbkuX29ZNWcCke4=; b=pjBZV3tGnhfqgR9fVcui2VqFzczS4c5FV6v8uYju3Eich5fmi6veEdZdLH9eE4Gw/+ wtUjFTsiRrXANruU/v5TltnwWqwTwM0sGOjxWJJGME/0Zy2RY21UKrn+bc6wEPIFNP9X 2fsy0sfz6eG4F/+MltCefjD9dqpo7vk/iAbcYDtL1dPW+uYgxRosvCSTI0E9VVp81osG KOAQzRe/0AyGMx4GBJA9m65NvJ3sIoZkBTB8tp/ni4vV4pm/5vCeV1GWPBHoPQVsB4LD fjo/evPmK20HnwaTlky7ClKn45RFJmcdhFZ0klNYir6gfZQxGeCYgcCWTCBqBMnWST1r k0gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zLqxQ0RU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p22-20020a1709027ed600b001637d6a52e8si32914101plb.19.2022.06.07.21.58.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:58:54 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zLqxQ0RU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 89BF023EF95; Tue, 7 Jun 2022 21:27:26 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379990AbiFGVPE (ORCPT + 99 others); Tue, 7 Jun 2022 17:15:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376463AbiFGUQs (ORCPT ); Tue, 7 Jun 2022 16:16:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C2EB1CE7B8; Tue, 7 Jun 2022 11:29:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3E9F4B822C0; Tue, 7 Jun 2022 18:29:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA758C385A2; Tue, 7 Jun 2022 18:29:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654626551; bh=InK2P2719+ucxNiXUq5akHXves7w4RjNdOe6zfMyDME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zLqxQ0RUa5Zkzjm+qzHbbRWExW/fm6otGb91Y2yA8L0XsiKS1ZgEaJHj5ZcjTkTf6 pr/Yt0EWtW0giZQlgPoAMctyEZKuZAafEZBVQB3DGW+UHnRyt9VQflsGm2t03uXdws Fvjgoi1ppzrn8yzHxkOjcoftttBBYbJVLPjh/bLo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Wahren , Florian Fainelli , Daniel Lezcano , Sasha Levin Subject: [PATCH 5.17 418/772] thermal/drivers/bcm2711: Dont clamp temperature at zero Date: Tue, 7 Jun 2022 19:00:10 +0200 Message-Id: <20220607165001.324177732@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164948.980838585@linuxfoundation.org> References: <20220607164948.980838585@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefan Wahren [ Upstream commit 106e0121e243de4da7d634338089a68a8da2abe9 ] The thermal sensor on BCM2711 is capable of negative temperatures, so don't clamp the measurements at zero. Since this was the only use for variable t, drop it. This change based on a patch by Dom Cobley, who also tested the fix. Fixes: 59b781352dc4 ("thermal: Add BCM2711 thermal driver") Signed-off-by: Stefan Wahren Acked-by: Florian Fainelli Link: https://lore.kernel.org/r/20220412195423.104511-1-stefan.wahren@i2se.com Signed-off-by: Daniel Lezcano Signed-off-by: Sasha Levin --- drivers/thermal/broadcom/bcm2711_thermal.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/broadcom/bcm2711_thermal.c index 1ec57d9ecf53..e9bef5c3414b 100644 --- a/drivers/thermal/broadcom/bcm2711_thermal.c +++ b/drivers/thermal/broadcom/bcm2711_thermal.c @@ -38,7 +38,6 @@ static int bcm2711_get_temp(void *data, int *temp) int offset = thermal_zone_get_offset(priv->thermal); u32 val; int ret; - long t; ret = regmap_read(priv->regmap, AVS_RO_TEMP_STATUS, &val); if (ret) @@ -50,9 +49,7 @@ static int bcm2711_get_temp(void *data, int *temp) val &= AVS_RO_TEMP_STATUS_DATA_MSK; /* Convert a HW code to a temperature reading (millidegree celsius) */ - t = slope * val + offset; - - *temp = t < 0 ? 0 : t; + *temp = slope * val + offset; return 0; } -- 2.35.1