From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 857E0CA9EB9 for ; Sat, 26 Oct 2019 13:33:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 58F0720867 for ; Sat, 26 Oct 2019 13:33:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572096795; bh=xxhDib96CAuu+qgU+FNLwIap1P+MIxRuHXvs11dU7e0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NEzvFNcGjTPLPbAE7nQj0ScgcROzz7J9egmG08yMvGQPEkLkMS6dKdPkBbgpj81ds kZGSzbPPAzXR1I+JDJxsD4CqmYmcrMfFGBBAMjqDsFjZiQl1alVwTZmA/m+c3CWrZa oxYZCUFv5hDAOkyF7vhNTctBUXcpK6u6GP8Dh8Fw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727704AbfJZNSJ (ORCPT ); Sat, 26 Oct 2019 09:18:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:39748 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727641AbfJZNSE (ORCPT ); Sat, 26 Oct 2019 09:18:04 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E25BB21D80; Sat, 26 Oct 2019 13:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572095883; bh=xxhDib96CAuu+qgU+FNLwIap1P+MIxRuHXvs11dU7e0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MUhogE7LAVlFErCmLPPwC7cq2+Hr9qme7OmmxrAxnBLhKnp9trIG+y0s7FY4yf4as F5C+KavuB/iZoNFOaKzK3E+M5bURh7T+ceh3HeZ2rdtXY5J0RSqBo6XmgOy9fkRi1p xX+QG8c9HRcUB+mvP4AYvzJsyS15ivRrSS7yip0Q= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Igor Russkikh , =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= , Igor Russkikh , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.3 69/99] net: aquantia: temperature retrieval fix Date: Sat, 26 Oct 2019 09:15:30 -0400 Message-Id: <20191026131600.2507-69-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191026131600.2507-1-sashal@kernel.org> References: <20191026131600.2507-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Igor Russkikh [ Upstream commit 06b0d7fe7e5ff3ba4c7e265ef41135e8bcc232bb ] Chip temperature is a two byte word, colocated internally with cable length data. We do all readouts from HW memory by dwords, thus we should clear extra high bytes, otherwise temperature output gets weird as soon as we attach a cable to the NIC. Fixes: 8f8940118654 ("net: aquantia: add infrastructure to readout chip temperature") Tested-by: Holger Hoffstätte Signed-off-by: Igor Russkikh Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- .../net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c index da726489e3c8d..7bc51f8d6f2fc 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c @@ -337,7 +337,7 @@ static int aq_fw2x_get_phy_temp(struct aq_hw_s *self, int *temp) /* Convert PHY temperature from 1/256 degree Celsius * to 1/1000 degree Celsius. */ - *temp = temp_res * 1000 / 256; + *temp = (temp_res & 0xFFFF) * 1000 / 256; return 0; } -- 2.20.1