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=-11.3 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_SANE_1 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 8520EC43461 for ; Fri, 4 Sep 2020 16:40:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49E372073B for ; Fri, 4 Sep 2020 16:40:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YYMIgsum" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726270AbgIDQkx (ORCPT ); Fri, 4 Sep 2020 12:40:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725966AbgIDQkv (ORCPT ); Fri, 4 Sep 2020 12:40:51 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 167DEC061244; Fri, 4 Sep 2020 09:40:51 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id u128so4899344pfb.6; Fri, 04 Sep 2020 09:40:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=wxaOHZ/W1bVPPlxPYI5KsnVzXfiQ47igg0n361NfZVU=; b=YYMIgsumLdhBj/Uz4ivpuN1T8qckEYHF5ibmSzT6XM8nIJeoLtEfMPAwstTBRyx8ux XzRWyjQsIDt1vRYxng/Kb4Q4jaMy8HWc+0LYoEgbGY7qvRxh2MI7prC+4B7wX/LPK2Bf 5EhGX0jH48u9WUNq2eo7zEOYU9VhKlSaMTnLsojzC8CUnK9hogywvDpdQco0tdkSi6An LqFNvRaOo36VBS4w6mpwOM92+J5i1dolqU0jO3dmLbMzSj4uU1XZ71BYAV8Xyxttv4LY KAwcI569arZ6HeP++Atg/6h9k5GKUD7GIxKCFwHMLaxZbvocWcWn7SDBEWihIwZ/0nxn VjQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=wxaOHZ/W1bVPPlxPYI5KsnVzXfiQ47igg0n361NfZVU=; b=FasfeJF3U2l5dt9y8Y4Ba7301hU6v9D2pM3gtFkEvJBUvKALBWGQkOEg0wPOn4Hq4n ZSo4WknWA28vtC0nj8zqDKUtggZHiRb7cZo62wfgHocB7dlCs4VMI021g+bA2JQecCIP voJ6bu2dxhnRMBtxB1viNCKA4d6p026kkv6fobHPXeGo0WtRDLIZACFH69EYFe+1rLhH 9tp/TRK7g0DMztYw3iNImlcJXaB1zM6e3D+uI/UzivQCwOapEQjYt561l3LzDBXsiYIb DwfZehPlL0Bq802aPX1Trl5sGGWywc/+wFA6xjMuxTx5Wx8m+AVtcqxstxEfHU9dN0bj 6DmQ== X-Gm-Message-State: AOAM530vwSTT/FAXoiZyTvCbUjqrHtPbEPGjpj1nps8LsqiC8NKpVlDn sqbL+HCxA77wfVLzSC8+Om8= X-Google-Smtp-Source: ABdhPJyxnXlyyApI5AYlSrIq+cwIZjdS/B/NM81GNpsZ9HImOzNeZz5Q3xFV/SocTAxCWUFC6shKug== X-Received: by 2002:a63:f09:: with SMTP id e9mr7987808pgl.334.1599237650528; Fri, 04 Sep 2020 09:40:50 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id j19sm7105220pfi.51.2020.09.04.09.40.49 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Sep 2020 09:40:49 -0700 (PDT) Date: Fri, 4 Sep 2020 09:40:48 -0700 From: Guenter Roeck To: Lars Povlsen Cc: Jean Delvare , Microchip Linux Driver Support , linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] hwmon: sparx5: Fix initial reading of temperature Message-ID: <20200904164048.GA74175@roeck-us.net> References: <20200903134704.8949-1-lars.povlsen@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200903134704.8949-1-lars.povlsen@microchip.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org On Thu, Sep 03, 2020 at 03:47:04PM +0200, 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 Applied. I added a note stating that I would prefer -ENODATA, and why, but that this is not feasible due to thermal subsystem requirements. Thanks, Guenter > --- > drivers/hwmon/sparx5-temp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > -- > 2.27.0 > > 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: 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=-11.5 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_SANE_1 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 C2D58C433E2 for ; Fri, 4 Sep 2020 16:42:09 +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 763012064E for ; Fri, 4 Sep 2020 16:42:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NheIzk12"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YYMIgsum" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 763012064E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net 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:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MSFhmPNUw/AvD+Y0XvcDRHqookRFfVqmNExIaL07Snk=; b=NheIzk12OHuD9SvLYHZbY5VZI qaKlZYBZFTtqJm62QVobsHyAbgACFDdZI9kztxfXqFTYRPT6PGPj+lNdCpP4Ib6OCzCtr9qxUELIp 4o7xF0xa6QkTcu3P9aX9AWNHNIopLqbGUaRVYgaNHFxjVhUyZp8MUPv39FV93dDtgT5BJsA2Xc8p1 BhTwJZkhaM0fhjbaX3NP3V7uuSjW4xbPn3YdpWnVssMwLxrGjyRKw/lOc0bp2EQVUjiEWk9h9+ehM 8VYCrBcN8hFn6mksV3XyxZzo5sNjPw0OrRkzOlVIJVMfZlfrOOI0pEQhYOaz2ox/vAeqZGvsPrU0/ FUi20vktQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kEElj-0002ub-AQ; Fri, 04 Sep 2020 16:40:55 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kEElg-0002uD-Pq for linux-arm-kernel@lists.infradead.org; Fri, 04 Sep 2020 16:40:53 +0000 Received: by mail-pf1-x442.google.com with SMTP id m8so4912615pfh.3 for ; Fri, 04 Sep 2020 09:40:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=wxaOHZ/W1bVPPlxPYI5KsnVzXfiQ47igg0n361NfZVU=; b=YYMIgsumLdhBj/Uz4ivpuN1T8qckEYHF5ibmSzT6XM8nIJeoLtEfMPAwstTBRyx8ux XzRWyjQsIDt1vRYxng/Kb4Q4jaMy8HWc+0LYoEgbGY7qvRxh2MI7prC+4B7wX/LPK2Bf 5EhGX0jH48u9WUNq2eo7zEOYU9VhKlSaMTnLsojzC8CUnK9hogywvDpdQco0tdkSi6An LqFNvRaOo36VBS4w6mpwOM92+J5i1dolqU0jO3dmLbMzSj4uU1XZ71BYAV8Xyxttv4LY KAwcI569arZ6HeP++Atg/6h9k5GKUD7GIxKCFwHMLaxZbvocWcWn7SDBEWihIwZ/0nxn VjQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=wxaOHZ/W1bVPPlxPYI5KsnVzXfiQ47igg0n361NfZVU=; b=QgzdKw9+BUze3tJB/7e3D2wykgy2mzjSu1v0qlt8lJm3qvqfCaPnQ4rZoa74QsTlEB TgicVXEuFJ2iIxDgEUETDsdlj1I+PoYu264IQFl90olySgxqvM3tYw8fJ0fF/ciuYFay mqwDrXruIsTJeEv89q8TbRzd0M1hoW899yLY4ODiDHSIQkrCbMohtselQIRE5/D+Tbjx 9H3qaPY/OFjyezekiXtkvSSg8Jg633xKNoCzMEYxs/HswGi7A6qRQ/92NyhcFFlqJCaJ T1jOSBdrA7WAuz4t4bf8ZTE9j7QEVW7X0KRyPqebs+4wXcsDRs5nVs9sO9/TNJorSPQ4 ts1Q== X-Gm-Message-State: AOAM5339NuxkTh3w8m5Jr1daqzDMV/2sZGN6HpPd95kCDtrQ0BBnlpcK ERMbdL0YxFr013dPzir4gfY= X-Google-Smtp-Source: ABdhPJyxnXlyyApI5AYlSrIq+cwIZjdS/B/NM81GNpsZ9HImOzNeZz5Q3xFV/SocTAxCWUFC6shKug== X-Received: by 2002:a63:f09:: with SMTP id e9mr7987808pgl.334.1599237650528; Fri, 04 Sep 2020 09:40:50 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id j19sm7105220pfi.51.2020.09.04.09.40.49 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Sep 2020 09:40:49 -0700 (PDT) Date: Fri, 4 Sep 2020 09:40:48 -0700 From: Guenter Roeck To: Lars Povlsen Subject: Re: [PATCH] hwmon: sparx5: Fix initial reading of temperature Message-ID: <20200904164048.GA74175@roeck-us.net> References: <20200903134704.8949-1-lars.povlsen@microchip.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200903134704.8949-1-lars.povlsen@microchip.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200904_124052_841297_42467D62 X-CRM114-Status: GOOD ( 21.21 ) 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, linux-arm-kernel@lists.infradead.org, Microchip Linux Driver Support 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 On Thu, Sep 03, 2020 at 03:47:04PM +0200, 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 Applied. I added a note stating that I would prefer -ENODATA, and why, but that this is not feasible due to thermal subsystem requirements. Thanks, Guenter > --- > drivers/hwmon/sparx5-temp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > -- > 2.27.0 > > 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: _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel