Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp974299yba; Thu, 16 May 2019 11:59:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/zm2TnTdfNsKbzYoBD9m+iVEGh/AC8PkdmTRylODlWcvTSqWH0ZznH7cG7j5YZgGf89Ew X-Received: by 2002:a65:4907:: with SMTP id p7mr51971661pgs.288.1558033155235; Thu, 16 May 2019 11:59:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558033155; cv=none; d=google.com; s=arc-20160816; b=N/GqsFp2wKa9F+pQrnVh12vo/ibQUWmv7LGAU8iSqHCK8J6jY/7tgRYdKI+wAvY7xB AhV/VZ93YSVROdYosR1nA/jiD2SMBrovYN0rM+fru97NogoEYHg76OCJqxgdplSLlwM8 g3qDYCQOZUF3KhRF4/A+OQKQQQ8g3E5zM8aVNOqMI8rdMusE6ulrIi9Q5Zozy2kefUei cHIRspsqBdM3Fgpukxx8PanJ17buzCQpWZyx6plW082BIDibaeizXg3JH+YWM91T/Fj2 gCfCD4NcO3E7L+va/fom6LP8Rfy5tN8RP33gT5cGUmlY7ukB4WKQxPpPcKU5NDiVkiE+ 7RGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=rrGlTyg4XJrCjk7zo+Wrsd+XH074LHjGtQBQcTuoJf8=; b=t5dkoPf1FdxsJWCjlFhXzrH2sl8Y16WV0imMHOj4+TG7kzUNToCuViAUlIZ34kwWwT lQKaoWzG6K9y3gokQNK2EROeg6aYlaY/Xyuv7L2s5YCexiZUJcd08a49yyYhFRvg1ZPF +/tCj54MHBBVtV7wHAL8s4RAwmmURKOU6apTQU31LHEElD8larUqUAaSQ360V0mKJX2D DCBwFwYC6wv1urIhC2yqBUiYRAyNBeWn1RgwvEpij+BhcxfYOJWCoe3Wps+ZYbL0dQc4 VJL7nQ4bFYd8UJTgtf67rGaIpezDkabA73hZzXq7Tmx/iN+HKKgrLRWpjMNYvfrvzS6t Wdhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=e6Rkx2rE; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si5872840pgg.348.2019.05.16.11.58.59; Thu, 16 May 2019 11:59:15 -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=@gmail.com header.s=20161025 header.b=e6Rkx2rE; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729041AbfEPSK7 (ORCPT + 99 others); Thu, 16 May 2019 14:10:59 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:36731 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726314AbfEPSK7 (ORCPT ); Thu, 16 May 2019 14:10:59 -0400 Received: by mail-io1-f67.google.com with SMTP id e19so3366769iob.3; Thu, 16 May 2019 11:10:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=rrGlTyg4XJrCjk7zo+Wrsd+XH074LHjGtQBQcTuoJf8=; b=e6Rkx2rEJlR6Pl2yJlIYa/FZ2zIzhZ5FqSoNux6pGC2cWT4VG3VtLz0dC5EFO+ax7A fnQ487yNANJ4O3ukMIjS/hevihf6hMlG7XZiS0NrWZO5kEc4q5O0oEVjmpxG0OZCY6V5 jp53iKg3oyxCYy/xDgCqzVCQtwOz2SS08UbDDQU/grZbTGPJsiebIM3zJ/GlhCEaiUAD 0TI/2THjAlSnQDJwcCVgMXgPh+COK2Et6tK9Rq4XMzIt/5XZz9bqaxvHyv/QiPi/sOdb IPh1Za3RIy24L4KLOQVCjvobjLNRpFwByWSFLzJLaNrUcxcQ0RPZ7WmYiqUvcLHgMkT8 WOMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=rrGlTyg4XJrCjk7zo+Wrsd+XH074LHjGtQBQcTuoJf8=; b=b+1CETYyolkvuNcOvAeSM/ERwzR+IYUzfIcrdeBa9L44MCZ49YVIWdaIUdnwSuP3sT ejOjWoO7TSsqXUnIHIBNqVF0/+Fu2BwnDA8YkPvkqS+dM2vXy5yE+aAcR9m6iI9zr9ab 2KXephf6f98r1fhRFomLVec9O5+RJrFqdz/qHqzwC2XldissUEvdgMiPPY6E0Y7MMir5 uUTxS2Qarj9I/UflDUBDaPqzZ4XTthHTRFm1serHD1vUFKdoNmjtAV/dF+xm9y729o+v O742vBFoltMwo56BdxB/Zh0op4zMBOuiSCgdCy0IqxJcmj1kuU2mFsgrOTen8n+fwJRD UWCw== X-Gm-Message-State: APjAAAVKIB8rPAwhmAp+8gWn0TGA9tw4Jxq+USvzAZSXDgkeZvthEGnx /dooZa9WnR0shFXJBv9MBJpyUWPmnRgkI1t/0qQ= X-Received: by 2002:a5d:9616:: with SMTP id w22mr1735164iol.40.1558030258541; Thu, 16 May 2019 11:10:58 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <20190516150252.hf4u3bloo37chy6q@flea> From: Frank Lee Date: Fri, 17 May 2019 02:10:47 +0800 Message-ID: Subject: Re: [PATCH 2/3] thermal: sun50i: add thermal driver for h6 To: Maxime Ripard 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 16, 2019 at 11:03 PM Maxime Ripard wrote: > > 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? I think get_temp should not be bloacked. Yangtao > > Maxime > > -- > Maxime Ripard, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com