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=-12.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,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 75717C433E9 for ; Thu, 3 Sep 2020 14:56:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4371320658 for ; Thu, 3 Sep 2020 14:56:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="ijyPN0EP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729283AbgICO4X (ORCPT ); Thu, 3 Sep 2020 10:56:23 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:46044 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728897AbgICOKa (ORCPT ); Thu, 3 Sep 2020 10:10:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1599142230; x=1630678230; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=yAlQCfI87sxPe78LUN486EmZ8/vrFT3DkpttqgEbkLI=; b=ijyPN0EPSe3TjOeYckG3ElMMsev/2BkEozYMr/k1jgEf3eOJVflQnT0o MHe6PkPAZn+58+BYWaCicpn7Ox/qm1QCLQSPak/vQZ+d04SjYnXeFrwdi TOKIX2NpPhrs/zHCt+8xmqVBtJC7FQRdowzGiU9kxY41RttxCQ8g2Hp3g Kr+geJOCrZKNALEbyO2E2r8iukpwl7IJJMwe+ldVnniaB9Ykrq2aM8QGz omU2MkSbXCmjOcBI+MgZRazLOwB5A/FZdKhui1SEUIyjAhkhXZRXOtLcU +rWeHW8qkgzR/+TjH+Bzmi6D0PHrsNo8FiPHcC+/DiQEIhg2sFF1bgHh2 w==; IronPort-SDR: fg+MNFt/hACS4QNbg/H6mQOCtEp4dzqSAZUSVAvmahPMw5Qyd0tkbuTD8auWo12N6Helz72fXD cvf0wTwnnYCBBIAaJvsAHb83XO/9jwSjDEYSrrA9jJh4TYKkRaY6DihEyqAHPfVtKq0l8gU4Mn UlIFHeICeyPaoVSqMySs/ZwYZFQssTBXHEsI38n8gQ1Gp1es9jZyUsE7QTgEZREIxJ1vFs814/ ITTqronlWeJLAXiBsulEHiSJJabTct4sTB2qHvuxLJqqjYOI5n6Wh4+QqMGLM56YqPXIDSA8aL 2dk= X-IronPort-AV: E=Sophos;i="5.76,386,1592895600"; d="scan'208";a="87817699" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 Sep 2020 06:47:16 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 3 Sep 2020 06:46:32 -0700 Received: from soft-dev15.microsemi.net (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Thu, 3 Sep 2020 06:47:10 -0700 From: Lars Povlsen To: Guenter Roeck CC: Lars Povlsen , Jean Delvare , Microchip Linux Driver Support , , , Subject: [PATCH] hwmon: sparx5: Fix initial reading of temperature Date: Thu, 3 Sep 2020 15:47:04 +0200 Message-ID: <20200903134704.8949-1-lars.povlsen@microchip.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org If the temperature is read before the internal calibration is completed, the driver returns -EIO. Instead it should return -EAGAIN to encourage repeating the operation. Signed-off-by: Lars Povlsen --- drivers/hwmon/sparx5-temp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/sparx5-temp.c b/drivers/hwmon/sparx5-temp.c index 1a2b1026b026..98be48e3a22a 100644 --- a/drivers/hwmon/sparx5-temp.c +++ b/drivers/hwmon/sparx5-temp.c @@ -56,7 +56,7 @@ static int s5_read(struct device *dev, enum hwmon_sensor_types type, case hwmon_temp_input: stat = readl_relaxed(hwmon->base + TEMP_STAT); if (!(stat & TEMP_STAT_VALID)) - return -EIO; + return -EAGAIN; value = stat & TEMP_STAT_TEMP; /* * From register documentation: -- 2.27.0 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=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 69288C433E2 for ; Thu, 3 Sep 2020 13:48:30 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2E6FA2071B for ; Thu, 3 Sep 2020 13:48:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="gqgWTmOp"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="UltIK/pT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E6FA2071B Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=ZJnkIWZ9ISELidTxm5QKodc2W/amfW6pyBE0xGWsvVI=; b=gqgWTmOpGlnPTGFDH4FN35oDtD X4ZBP1GUg8Duj0h4iIDNM63JhQGLHmY2cJ0L8Tvhymq+hOr3FdQv4FP5JOHz2CWtg1mt9+I0xfFJv 7n4Hbs7F1Z4nvGbGGi70jadfVYQGI1Qw7cuN4AogX6IvNM8RxdxrwPYcP6DtzQd7+92mEpZZZ6Za0 JdEB1KvjKu7x1onPLIoB6ZBba0KIZPcYKoA64fMWOW9sExUh3x86RSZlNpmNJHJ9fhY0XeqvvHpnf mGQqy74B6vsLkpdX4uHx/titlJYFS+u158gDjC/JJWIbj7/O8LLJ1++b0ktJUql65iE1pBpMSvGm7 1UVhDHMQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDpaB-0001Fh-Ud; Thu, 03 Sep 2020 13:47:19 +0000 Received: from esa2.microchip.iphmx.com ([68.232.149.84]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDpa9-0001F4-2h for linux-arm-kernel@lists.infradead.org; Thu, 03 Sep 2020 13:47:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1599140837; x=1630676837; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=yAlQCfI87sxPe78LUN486EmZ8/vrFT3DkpttqgEbkLI=; b=UltIK/pT6UwZv9jpM+SxgGSCBOn0mR76dOtJjhIqBsfQmuhk7Mw0YUVW Z3xY4z/WwaZxgi/HRhMrkfNvQspenTVkOz0PMwt9MJiD0W9mJNtjRYTO7 HNvSt19HJ+uGKUuJtnjD6W+h7PB+yd8LzPE+hPfGqdhIxWfmGkhL0Ygqg Dcn+QLDAYRagzVPvJi2hVf8csaH7P0eG2SZBkFRFJoa3NvUscWuZPQibo 0JVHxfYZJ7WmTpEBdB2irG7NKbQpHFiT7biNSfpZlvL2gQHupHULGGs3n TNmnzSiP72ggP6M11vaLfl0HWNRqkWNoXQi9xycPJfo/OrwfCOnzHzuv2 Q==; IronPort-SDR: fg+MNFt/hACS4QNbg/H6mQOCtEp4dzqSAZUSVAvmahPMw5Qyd0tkbuTD8auWo12N6Helz72fXD cvf0wTwnnYCBBIAaJvsAHb83XO/9jwSjDEYSrrA9jJh4TYKkRaY6DihEyqAHPfVtKq0l8gU4Mn UlIFHeICeyPaoVSqMySs/ZwYZFQssTBXHEsI38n8gQ1Gp1es9jZyUsE7QTgEZREIxJ1vFs814/ ITTqronlWeJLAXiBsulEHiSJJabTct4sTB2qHvuxLJqqjYOI5n6Wh4+QqMGLM56YqPXIDSA8aL 2dk= X-IronPort-AV: E=Sophos;i="5.76,386,1592895600"; d="scan'208";a="87817699" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 Sep 2020 06:47:16 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 3 Sep 2020 06:46:32 -0700 Received: from soft-dev15.microsemi.net (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Thu, 3 Sep 2020 06:47:10 -0700 From: Lars Povlsen To: Guenter Roeck Subject: [PATCH] hwmon: sparx5: Fix initial reading of temperature Date: Thu, 3 Sep 2020 15:47:04 +0200 Message-ID: <20200903134704.8949-1-lars.povlsen@microchip.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200903_094717_260153_BFFE873F X-CRM114-Status: GOOD ( 12.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hwmon@vger.kernel.org, Jean Delvare , linux-kernel@vger.kernel.org, Microchip Linux Driver Support , Lars Povlsen , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If the temperature is read before the internal calibration is completed, the driver returns -EIO. Instead it should return -EAGAIN to encourage repeating the operation. Signed-off-by: Lars Povlsen --- drivers/hwmon/sparx5-temp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/sparx5-temp.c b/drivers/hwmon/sparx5-temp.c index 1a2b1026b026..98be48e3a22a 100644 --- a/drivers/hwmon/sparx5-temp.c +++ b/drivers/hwmon/sparx5-temp.c @@ -56,7 +56,7 @@ static int s5_read(struct device *dev, enum hwmon_sensor_types type, case hwmon_temp_input: stat = readl_relaxed(hwmon->base + TEMP_STAT); if (!(stat & TEMP_STAT_VALID)) - return -EIO; + return -EAGAIN; value = stat & TEMP_STAT_TEMP; /* * From register documentation: -- 2.27.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel