Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1618033yba; Fri, 17 May 2019 02:18:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXcCvXvd+TtQRBykHsf+JaKZlAd8U0liGbTXQ2PKzUrxi1oxfcnPVm3XMY9py2RTOiBeK+ X-Received: by 2002:a63:1854:: with SMTP id 20mr53754010pgy.366.1558084684597; Fri, 17 May 2019 02:18:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558084684; cv=none; d=google.com; s=arc-20160816; b=HBZqkJ3PzPabg0Oc7lHfTRnxKeYrE8jITA8PJJV2gEZrADDZFlVjCFsmNjI8JhWtEC WRSDhMlQnE89hmMsB4oyciXhg5XHvFIMSYnAtubhFp5MO+M00FrTGJntEyIj0vdReUYG qWOA1fyxGCcBt7mcEVrLMojdiKGMnqv3E4s2+uuHO2PR7dNt4kCtmP0YRGiRd99ay9DG KdbVsW4ESaViclu2qh/zkqMZ6bgKhE3rmlYXuB6gpPmNSnpewciX6Qt5T+mIf+ageNO+ SYzSNWW3pelDtR0fUrjseM5tW815EoZE4DBVv2AqTtz8qr9IAhR0AyDpiG6NKDZp5kMF SuEQ== 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:cc :to:from:date; bh=WA9Je5qHBQ57M+8e8gQClXiHlF1u7LL7msoAAP9qc8E=; b=Nfx6AljP9p9KOsrVX34IDU0Hx3HP+U6ssg72sNAqjp0JKux5fa8qDAjf+s8Ek5GlED jOKNK56y+9XAfTaYuL4y6w/KB0nns2OVbDvcbFJow4R/pkQFhLhHrtPFzKcUINVFqmMw E+oUZUjb02s1iN3xCY61+8JU/nd2to4+yGzCgalqoEX318pHG/5+/EXU62uJcXsliPCI sHANNtoCgfvLA5ySlK12pixExHicMibp2ca8z/lDZ8W1mnHEKYFbeE7PpBxrmcdTCOQF +RE/q+BybzCH36xhAB+0u/Z3bZwsJsBptm553/ppEitDS6cb209gQlusnkUoM3FVmQKu 5JEQ== 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 a23si7280248plm.385.2019.05.17.02.17.49; Fri, 17 May 2019 02:18:04 -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 S1728326AbfEQHcF (ORCPT + 99 others); Fri, 17 May 2019 03:32:05 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:54647 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727361AbfEQHcE (ORCPT ); Fri, 17 May 2019 03:32:04 -0400 X-Originating-IP: 80.215.154.25 Received: from localhost (unknown [80.215.154.25]) (Authenticated sender: maxime.ripard@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 347BA40009; Fri, 17 May 2019 07:31:52 +0000 (UTC) Date: Fri, 17 May 2019 09:31:51 +0200 From: Maxime Ripard To: Frank Lee Cc: Mark Rutland , Daniel Lezcano , catalin.marinas@arm.com, will.deacon@arm.com, bjorn.andersson@linaro.org, Mauro Carvalho Chehab , paulmck@linux.ibm.com, stefan.wahren@i2se.com, Linux PM , Chen-Yu Tsai , Jagan Teki , Andy Gross , rui.zhang@intel.com, devicetree@vger.kernel.org, marc.w.gonzalez@free.fr, Eduardo Valentin , enric.balletbo@collabora.com, robh+dt@kernel.org, Jonathan.Cameron@huawei.com, Linux ARM , Greg Kroah-Hartman , Linux Kernel Mailing List , olof@lixom.net, David Miller Subject: Re: [PATCH 2/3] thermal: sun50i: add thermal driver for h6 Message-ID: <20190517073151.mz6hcmzubk7iqfre@flea> References: <20190512082614.9045-1-tiny.windzz@gmail.com> <20190512082614.9045-3-tiny.windzz@gmail.com> <20190512133930.t5txssl7mou2gljt@flea> <20190512214128.qjyys3vfpwdiacib@core.my.home> <20190516150252.hf4u3bloo37chy6q@flea> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lfvwzxrwqixjwfma" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --lfvwzxrwqixjwfma Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 17, 2019 at 02:10:47AM +0800, Frank Lee wrote: > > 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? > > I think get_temp should not be bloacked. Why not? Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --lfvwzxrwqixjwfma Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXN5jZwAKCRDj7w1vZxhR xRjwAQCF+RoytL/Gdpf15Jq+KQoPxEwYs/XaBIKW6ehF38tr0QD/T1i40/vfptIH f1vUZGQCwcHvI4eTbggzXinFNG1BsAM= =UQjS -----END PGP SIGNATURE----- --lfvwzxrwqixjwfma--