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.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 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 D325EC43461 for ; Fri, 4 Sep 2020 08:34:38 +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 94F30206C9 for ; Fri, 4 Sep 2020 08:34:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="o4WlK9XN"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="Ye0jnIN5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94F30206C9 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:In-Reply-To:Subject:To: From:References:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=isFMnB4h6u3XuxZUR8sfqBr+GQTqScfORZEDrmJXxl4=; b=o4WlK9XNQ0OAal5VRLbBDVTUE Pe3wyDjOeLgZxujJcsb515DmLHm81eyflyQ0Avr+kjPS2ulRobYHjCf0ol4T6AoS/6tI7ySM0XSlL ZKIxS0pPzMKHrO4MZ53pmJVc9ImKFNamurvWW06uetBz0Mkr8H23OtscDhDak2r6rl1C/Zzl+nAXL 8I+DiUa5lh0XSeRt8dVg3nZm/NxUH+2kW6XsKNUFgdQum0fKuLqL/Kq2VUsO4et+DkAJ9mIdFNudZ fSSxWNeJC5vTa7eKG3bmiG4ngS9Yv3eDaf1who+fzTyJl3iKhQrM2QZ/6IvkK8vx9W1g5Wpg9iDqh Jl4clvK3g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kE7A1-00015o-AV; Fri, 04 Sep 2020 08:33:29 +0000 Received: from esa5.microchip.iphmx.com ([216.71.150.166]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kE79y-000151-8Q for linux-arm-kernel@lists.infradead.org; Fri, 04 Sep 2020 08:33:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1599208407; x=1630744407; h=references:from:to:cc:subject:in-reply-to:date: message-id:mime-version; bh=q7FxclsURvMFLB4KzgyOyXIzenqxhAB++84k34J/Njo=; b=Ye0jnIN5PWTVAPw17+cLx+7Dvm/bH0h9iCI8QBEn0zcU6mcB3d335W38 glGU3Ihh+3uYmtcfG1Nqp9V4g1u7rksqy3o4Epgy3bM0apRm7nmJPnUe1 h2rsw3LKHM2nfDa3GoCzyNnI+ufkRNlLe6YEriA0V2884Tkj/1sSU4zWZ R+w1YUz1Taa7sx1Z0wqhLhQvr84xHEp3Tw/mpNh/AREYro5ZSYBrjIMn8 tJ2UYA1zNiGIJNSshrvuY+fVyNH+mGDRuI/SKyDYoEHUjs2ZEnKUse9YX sYkfsOFxpzPmipC/u+WUNbtkctKbFTfpwwUqU9/XmgObfe5seXbez4Llx w==; IronPort-SDR: jBtz3COpuZ437EHW3+7MUlyGi+NWPaovslUEAsagCbvg/mLBURmJpyg+dbwcAe5KQ4MRlIpd/V F3f4YSULETNBQGYmyiCF0IZBiPu7qQTc1P1WJibgBf30aUwr2mi3BPjIHZr6tWu1n/xs2RzpB7 bLLTRb+n73doHDJxyT+Yz6tjwUTXZgv6++7uVO4zAtRQYkqZnqmmDRnOqEmwKH19OOxNhRUj8W 4zMYKfs81bTQQ5rVezkOCwPcTR/wM3MAu7mnOVUM1WJTJ3kNigNaWUroohVM4K/g7WYiOd19Va gaM= X-IronPort-AV: E=Sophos;i="5.76,389,1592895600"; d="scan'208";a="89822923" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Sep 2020 01:33:25 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 4 Sep 2020 01:33:13 -0700 Received: from soft-dev15.microsemi.net.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3 via Frontend Transport; Fri, 4 Sep 2020 01:33:11 -0700 References: <20200903134704.8949-1-lars.povlsen@microchip.com> <8ca270c9-5561-3176-61cf-7a9fbee10d1f@roeck-us.net> From: Lars Povlsen To: Guenter Roeck Subject: Re: [PATCH] hwmon: sparx5: Fix initial reading of temperature In-Reply-To: <8ca270c9-5561-3176-61cf-7a9fbee10d1f@roeck-us.net> Date: Fri, 4 Sep 2020 10:33:11 +0200 Message-ID: <87v9guvt4o.fsf@soft-dev15.microsemi.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200904_043326_508338_65B12551 X-CRM114-Status: GOOD ( 18.78 ) 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 , Daniel Lezcano , linux-kernel@vger.kernel.org, Microchip Linux Driver Support , Lars Povlsen , Amit Kucheria , Zhang Rui , 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 Guenter Roeck writes: > On 9/3/20 6:47 AM, Lars Povlsen wrote: >> 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; > > The problem is that this may result in a hard loop and effectively hang the system, > or at least the calling process. It may be better to return -ENODATA in this situation. > Guenther, Thank you for your response. The motivation for the patch was as I tried to use thermal support to control a fan, and I noticed an initial quip from thermal_core.c:update_temperature() - it will throw a dev_warn() for anything else than an "EAGAIN". The EAGAIN also seems to be used by several other hwmon drivers in similar situations. The bottom line is that I would like to get rid of the warning message. Changing the error code to ENODATA does not fix what I am trying to accomplish. Do you have any suggestions on how to achieve the objective? Sincerely, ---Lars > Guenter > >> value = stat & TEMP_STAT_TEMP; >> /* >> * From register documentation: >> -- >> 2.27.0 >> -- Lars Povlsen, Microchip _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel