Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp730034yba; Thu, 16 May 2019 08:04:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqzA+uYpNar+NOKZh/cYvwKQeKHFHvc0c/S7ihNlCTiOTI+9mc5R6f1WauahjweftNaMOwq/ X-Received: by 2002:a65:430a:: with SMTP id j10mr5164819pgq.133.1558019080701; Thu, 16 May 2019 08:04:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558019080; cv=none; d=google.com; s=arc-20160816; b=nG8kFQ8h2dUV2tQrs+5pt14/y3ag/yQL5NeC+ayrYUVnL5oUdNv69NX6e6cubsm4N4 k2B1jtkvJy2rVzbSqmv0P042g6OYpb+R56fwXGzPvppvknseek1/2ZUXaopUkfVjeVYE zRvqHQp6z1W5zvPIZZGVPZ1HTjvqjNOlfnmU0GVvySIR0DFtIiq6eecu8ttgjE2rjsbB tkUSIknyWHuQKDalsDHJmi4nhsixBS4dw8CoF4DfUwIsfpX1PGQUclOEMEeq6ycEWJk7 N4RU+AorRXxYNGX3/BKS5hZg4NbhfCi6YnARGQvy4kDUPr66XApKs24MNmyGk0xPMrSB 6G+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:to :from:date; bh=7M6ffRjPKPqn3dFEyMcBLFG21xWOGXquwYdXJ3pTHio=; b=i0jlBiGqqrAPUXMZBJyxBW6dcxzP2R0rPMDnqDC3Cfs014+u32XtEFNJPWIpr7Ez02 RsRwh8zKnnsxFsGlJsqJDtnwdIhnSe1x7WfVQ+dcB+/McRecWLSUmsGZMHKecVxNGoc0 5FOXvTlAt/K8stlXMBnYrmzUMzW+Q3sU0pSeIDeNtxow4IocmYJYnoCDlVzrBz0B6JqT Qq8R+BFIKXagVNFH9MyV5Ebm2X2ufH+8a1yQ+Cx8EO19JhsCMvP8OgfKROxPXyFaHSUb YtLEP8KYVF1GjmSW5wMmLWhM53gn9OQhLaLTJ1vvow/pjIiFUYxEq+ZnFDwwq1tRNPNo maAw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si5389910plz.311.2019.05.16.08.04.16; Thu, 16 May 2019 08:04:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727121AbfEPPDF (ORCPT + 99 others); Thu, 16 May 2019 11:03:05 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:58399 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726687AbfEPPDE (ORCPT ); Thu, 16 May 2019 11:03:04 -0400 Received: from localhost (unknown [80.215.79.199]) (Authenticated sender: maxime.ripard@bootlin.com) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 1129E200018; Thu, 16 May 2019 15:02:52 +0000 (UTC) Date: Thu, 16 May 2019 17:02:52 +0200 From: Maxime Ripard To: Yangtao Li , mark.rutland@arm.com, daniel.lezcano@linaro.org, catalin.marinas@arm.com, will.deacon@arm.com, bjorn.andersson@linaro.org, mchehab+samsung@kernel.org, paulmck@linux.ibm.com, stefan.wahren@i2se.com, linux-pm@vger.kernel.org, wens@csie.org, jagan@amarulasolutions.com, andy.gross@linaro.org, rui.zhang@intel.com, devicetree@vger.kernel.org, marc.w.gonzalez@free.fr, edubezval@gmail.com, enric.balletbo@collabora.com, robh+dt@kernel.org, Jonathan.Cameron@huawei.com, linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, olof@lixom.net, davem@davemloft.net Subject: Re: [PATCH 2/3] thermal: sun50i: add thermal driver for h6 Message-ID: <20190516150252.hf4u3bloo37chy6q@flea> References: <20190512082614.9045-1-tiny.windzz@gmail.com> <20190512082614.9045-3-tiny.windzz@gmail.com> <20190512133930.t5txssl7mou2gljt@flea> <20190512214128.qjyys3vfpwdiacib@core.my.home> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7vj27y3kfhi2ktlo" Content-Disposition: inline In-Reply-To: <20190512214128.qjyys3vfpwdiacib@core.my.home> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --7vj27y3kfhi2ktlo Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Sun, May 12, 2019 at 11:41:28PM +0200, Ond=C5=99ej Jirman wrote: > > > +static int tsens_get_temp(void *data, int *temp) > > > +{ > > > + struct tsensor *s =3D data; > > > + struct tsens_device *tmdev =3D s->tmdev; > > > + int val; > > > + > > > + regmap_read(tmdev->regmap, tmdev->chip->temp_data_base + > > > + 0x4 * s->id, &val); > > > + > > > + if (unlikely(val =3D=3D 0)) > > > + return -EBUSY; > > > > I'm not sure why a val equals to 0 would be associated with EBUSY? > > Thermal zone driver can (will) call get_temp before we got the > first interrupt and the thermal data. In that case val will be 0. > > Resulting in: > > (val + offset) * scale =3D (-2794) * -67 =3D 187198 > > 187=C2=B0C and immediate shutdown during boot - based on cirtical > temperature being reached. > > Busy here means, get_temp does not yet have data. Thermal zone > driver just reports any error to dmesg output. Ah, that makes sense. I guess if we're switching to an interrupt-based driver, then we can just use a waitqueue, or is get_temp supposed to be atomic? Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --7vj27y3kfhi2ktlo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXN17nAAKCRDj7w1vZxhR xZVgAQDEhhE/FQspXxx58VLtzI/e0Kz9gZa92QnGGjDbVWxBTwEA1iAzA+XGbDtR 1TM7/Hc1lwDV+qLHJYnbwcFfq+6XBAg= =qzgC -----END PGP SIGNATURE----- --7vj27y3kfhi2ktlo--