Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8945551ybi; Wed, 10 Jul 2019 02:06:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwS9m/FIrdQOpTLseKUI7OFI75I6YwkzdxHFHCevRFB1Tu0+S+zkb5S9oNX5p76PnSwZ2Dj X-Received: by 2002:a17:90a:2247:: with SMTP id c65mr5533952pje.24.1562749596461; Wed, 10 Jul 2019 02:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562749596; cv=none; d=google.com; s=arc-20160816; b=jF6DQDPQm1U8yg4Tyts5dJYIc5cAyEolp4zoA3ps5luHqOfFCggdZkO1JUGHHoeKCt FhDUgWMckr0B45Qe9FuWK2purlCC0QcLaBJ9AptzQLCv4p/NX6MmbXh1aaU+QH4AyBCL GDmqivCX5VpsuITuBuWyNhooKHbaJHuiAtj6JEfzMEvEtAmqag6qpsjPJruKf2ZXPKUk 6BKOOgLsf6q2hx098jcB1LSVc9XS49p9KDzsQIkzugP9PpEJCHjvaWDTjosJxr6ZwtVA d8ToHpVTCQRMN/uhZVA6ftx/IWonbBYaxm/5iXq7YMIyjePGnn0n1wAvEUolQxlmcGO8 em1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:mime-version:user-agent:date :message-id:organization:autocrypt:openpgp:from:references:cc:to :subject:dkim-signature; bh=7MWupzFbKlgq6at8POZatbL7RO57j91izxngdnHzFF8=; b=TdZgLqoAeAIVRfhR13Edg5GIYtu0Nr3/ddvYOVlx5+zaTnCqnBzCz17CZ+UJGlAHR7 WQlqOgBZNkr+A2OXfMZ81vEgRtBF7fwMH2evfs3vG+fji9lbxgIhetGTYUUMtOzLgcmu GKVyHERU9Rk5M98eGJ2s+Qu7G7pa9FAFYTM6m3C72aR9/hmVW6pixKHFKAxnRDjPSgb9 89Zmqh7Y0jYsqda+pwMhmbG8fV2dWQfR8/aEMsnSA6P4LL1c/6ArXe9pKEmNzFJMQGCn UjkS5MyBOvJApUT4SeooXKwqrp2wiGUQiYB9XYlofEKp0OQk9V56jCrK45ZjTfijlSzK gzAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yadro.com header.s=mta-01 header.b=oGObuqhY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yadro.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d67si1608881pgc.62.2019.07.10.02.06.20; Wed, 10 Jul 2019 02:06:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@yadro.com header.s=mta-01 header.b=oGObuqhY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yadro.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727662AbfGJJGA (ORCPT + 99 others); Wed, 10 Jul 2019 05:06:00 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:39082 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726580AbfGJJF7 (ORCPT ); Wed, 10 Jul 2019 05:05:59 -0400 X-Greylist: delayed 508 seconds by postgrey-1.27 at vger.kernel.org; Wed, 10 Jul 2019 05:05:57 EDT Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 33068404CB; Wed, 10 Jul 2019 08:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:in-reply-to:mime-version:user-agent :date:date:message-id:organization:from:from:references:subject :subject:received:received:received; s=mta-01; t=1562749046; x= 1564563447; bh=LhWEa2Id3LIYjkm9wZEFKYi5Dtn9EgTe/6BhUhNP2Sw=; b=o GObuqhYQ7J4gMv+t5L6pTJyA3R5RIoCdh4eg0zOiIhFqSN3T0fQ15iQbHBOQHzK/ LJnWLJfmZyCRTJCSa4bS1Z5u6U6ElB5XXpUEk05pMkYD7RCIxPVdt0Q1doKv9In7 VdrmbtpP5l5ubk+x/NMlRvi7umNR6BGYy7WT8W02OM= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6E_ZYmdHbjt7; Wed, 10 Jul 2019 11:57:26 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 77BB341209; Wed, 10 Jul 2019 11:57:26 +0300 (MSK) Received: from [172.17.14.197] (172.17.14.197) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Wed, 10 Jul 2019 11:57:25 +0300 Subject: Re: [PATCH] hwmon (occ): Add temp sensor value check To: Joel Stanley CC: Guenter Roeck , , Eddie James , Lei YU , References: <20190710072606.4849-1-joel@jms.id.au> From: Alexander Amelkin Openpgp: preference=signencrypt Autocrypt: addr=a.amelkin@yadro.com; prefer-encrypt=mutual; keydata= mQINBFj0jdkBEADhQF4vZuu9vFfzxchRQtU/ys62Z13HTaYK/VCQKzPnm2mf593Il61FP9WV 0Srt4t4yumiXK7NhHeqktN/YZjYDYVr9l+vZpNydOHpDjk7xjPgb0KkoFCo7bcQ2/e4AtLTQ XGoWIKv983vWlphPCG1Jof5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F8XVKdyRqK9afWbMaxFzOWGp9pNtcmIvfmyE0M6LPLgUb33jek/Ngup/RN7CjZ NCjOc2HTID99uBkYyLEcOYb+bycAReswjrv3a49ZBmmGKJZ+aAm0t6Zo6ekTdUtvlIrVYvRs UWWj4HdCaD+BMvSqcDZgyQESLI9nfEGuWtVqdi2QlZZeQT7W+RH4lihHKTdzOsVC93o4h6og ZvgOJ/0g1SP3la88RWONejHxVbGzBOyNjkH71CFujnAfuVuuhkJaN8PY/CS56sKMREKJOy0L vouE7eSU4bp13GK1xsnbWcDQpyzTsCsP9taqQmeld8Hw1yuPamc6fdpKNyPHyN20vzh20f0C QUMAjh3Vym12aKhyRan08VNEaLOKiyya6+i9c3Z3LiWUEqTSzELCkesb68UQVtE6/CXPM2P/ vs3EQuLFXBC/rD9lurT0kG99xElAbKjHLer5NSw2WA2vQXaFadGNDyHI32Yt2cAqWzZtVqmN ESE0npJ5eeAcVWPHjhCwL8phZCDtfxJMy2cqYS8QLIBGfQTIHMQAgqBbpq9FLXCn008tvaTr KijxDkPtWeXDLbMgH1kA46gTPJWxsm0c45w7c3aXhXl4hOgXp+iWDTOT83tJU0zoD9hYlpZf dTYsE5wSxM06T2l/MILupCNZ7A== Organization: YADRO Message-ID: Date: Wed, 10 Jul 2019 11:57:25 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190710072606.4849-1-joel@jms.id.au> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nrdfzVufGHCEucwqkkiYbemcIzvnNchnH" X-Originating-IP: [172.17.14.197] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --nrdfzVufGHCEucwqkkiYbemcIzvnNchnH Content-Type: multipart/mixed; boundary="2dQYpAQWAa888nHozIP3eb5YJVbiYgjlr"; protected-headers="v1" From: Alexander Amelkin To: Joel Stanley Cc: Guenter Roeck , linux-hwmon@vger.kernel.org, Eddie James , Lei YU , linux-kernel@vger.kernel.org Message-ID: Subject: Re: [PATCH] hwmon (occ): Add temp sensor value check References: <20190710072606.4849-1-joel@jms.id.au> In-Reply-To: <20190710072606.4849-1-joel@jms.id.au> --2dQYpAQWAa888nHozIP3eb5YJVbiYgjlr Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US Thanks, Joel! JFYI, Alexander Soldatov has left the YADRO team some time ago, so his e-= mail @yadro.com isn't valid anymore. Should anyone have any questions regarding this patch, feel free to email= me. With best regards, Alexander Amelkin, Leading BMC Software Engineer, YADRO https://yadro.com 10.07.2019 10:26, Joel Stanley wrote: > From: Alexander Soldatov > > The occ driver supports two formats for the temp sensor value. > > The OCC firmware for P8 supports only the first format, for which > no range checking or error processing is performed in the driver. > Inspecting the OCC sources for P8 reveals that OCC may send > a special value 0xFFFF to indicate that a sensor read timeout > has occurred, see > > https://github.com/open-power/occ/blob/master_p8/src/occ/cmdh/cmdh_fsp_= cmds.c#L395 > > That situation wasn't handled in the driver. This patch adds invalid > temp value check for the sensor data format 1 and handles it the same > way as it is done for the format 2, where EREMOTEIO is reported for > this case. > > Fixes: 54076cb3b5ff ("hwmon (occ): Add sensor attributes and register h= wmon device") > Signed-off-by: Alexander Soldatov > Signed-off-by: Alexander Amelkin > Reviewed-by: Alexander Amelkin > Reviewed-by: Eddie James > Signed-off-by: Joel Stanley > --- > drivers/hwmon/occ/common.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c > index cccf91742c1a..a7d2b16dd702 100644 > --- a/drivers/hwmon/occ/common.c > +++ b/drivers/hwmon/occ/common.c > @@ -241,6 +241,12 @@ static ssize_t occ_show_temp_1(struct device *dev,= > val =3D get_unaligned_be16(&temp->sensor_id); > break; > case 1: > + /* > + * If a sensor reading has expired and couldn't be refreshed, > + * OCC returns 0xFFFF for that sensor. > + */ > + if (temp->value =3D=3D 0xFFFF) > + return -EREMOTEIO; > val =3D get_unaligned_be16(&temp->value) * 1000; > break; > default: --2dQYpAQWAa888nHozIP3eb5YJVbiYgjlr-- --nrdfzVufGHCEucwqkkiYbemcIzvnNchnH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJdJah1AAoJEOiTWHtbdBeN25oQALdidpJJ0OPk2zG00XUGJssP nVfissnr3GF0AsBTtIMuLqziS75dPq1OY/uW36+EOKdazXOMH0rkD3llhd1i9Wl3 8CJ04XpOE+eNRcGe77SBcxEwyh0+71A9KiIm3lG2tRb0k8O29Adx9//gJ+rGziwg Z+Qb9uYttU7jTp7ojqRyoRs71w7b4zstE0AmQTg5tyqEt0hbtUBgnD/sNpsxIvMk +PxJ7o6LaP++AOZR5XBLFtanXgjIxKKdmeGc3RayyWh0IYd5KuERaqFBqICKhPXE kmntiIcs99vFzu6lwVp3Y6qxcYEWl5aohIlWEycip7MtTeaUk1v5rRqTFeGVN1SQ hdo0cfboSzT2s/sDg5ky8Qq0+ycANdRaoMYWoZoo7kldWBKGg2YsGAT89WQOXrZb Ce8LaMJOqxS6EKWXTt3gaIlwAR3vSrVJrK++h20dePfYoXfPE0cS/BvHL71DzG4O 5XlkIw5G1MTAn0cAkC48vcSw+9fZRNGXXNQY0avVlfstG+b3fVLQO5WRNhiChLJw Ex/L8W2RH7TvTMlycxOtjzKjhjJ/1O5moe1f3MG29D1ywVY/OsgILkLZkZx3AVLZ XBOmmD79lVyWouDq9n30ahVvy+k2CYap8q4vbe9D/ykujjI453USC+XwR8DW8i/n ZxnvnTJCkp69jYRbQlad =lmWr -----END PGP SIGNATURE----- --nrdfzVufGHCEucwqkkiYbemcIzvnNchnH--