From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752618AbbC0FXe (ORCPT ); Fri, 27 Mar 2015 01:23:34 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:57894 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751443AbbC0FX3 (ORCPT ); Fri, 27 Mar 2015 01:23:29 -0400 Date: Fri, 27 Mar 2015 06:23:18 +0100 From: Sascha Hauer To: amit daniel kachhap Cc: "linux-pm@vger.kernel.org" , Zhang Rui , Eduardo Valentin , "linux-kernel@vger.kernel.org" , Stephen Warren , Mikko Perttunen , kernel@pengutronix.de, linux-mediatek@lists.infradead.org, LAK Subject: Re: [PATCH 04/13] thermal: Fix not emulating critical temperatures Message-ID: <20150327052318.GO9742@pengutronix.de> References: <1427385240-6086-1-git-send-email-s.hauer@pengutronix.de> <1427385240-6086-5-git-send-email-s.hauer@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 06:14:26 up 10 days, 17:06, 31 users, load average: 0.06, 0.12, 0.13 User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Amit, On Fri, Mar 27, 2015 at 08:35:50AM +0530, amit daniel kachhap wrote: > Hi Sascha, > > > -#ifdef CONFIG_THERMAL_EMULATION > > - if (!tz->emul_temperature) > > - goto skip_emul; > > - > > - for (count = 0; count < tz->trips; count++) { > > - ret = tz->ops->get_trip_type(tz, count, &type); > > - if (!ret && type == THERMAL_TRIP_CRITICAL) { > > - ret = tz->ops->get_trip_temp(tz, count, &crit_temp); > > - break; > > - } > > - } > > - > > - if (ret) > > - goto skip_emul; > > > > - if (*temp < crit_temp) > I guess this check is confusing. Actually instead of returning > emulating temperature it is returning actual temperature. But the > important thing to look here is that actual temperature is higher than > critical temperature. So this check prevents the user from suppressing > the critical temperature and hence prevents from burning up the chip. Indeed the check is confusing, but now it makes perfectly sense. I'll look at the patch again and maybe turn into a patch just adding a comment to clarify this. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | From mboxrd@z Thu Jan 1 00:00:00 1970 From: s.hauer@pengutronix.de (Sascha Hauer) Date: Fri, 27 Mar 2015 06:23:18 +0100 Subject: [PATCH 04/13] thermal: Fix not emulating critical temperatures In-Reply-To: References: <1427385240-6086-1-git-send-email-s.hauer@pengutronix.de> <1427385240-6086-5-git-send-email-s.hauer@pengutronix.de> Message-ID: <20150327052318.GO9742@pengutronix.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Amit, On Fri, Mar 27, 2015 at 08:35:50AM +0530, amit daniel kachhap wrote: > Hi Sascha, > > > -#ifdef CONFIG_THERMAL_EMULATION > > - if (!tz->emul_temperature) > > - goto skip_emul; > > - > > - for (count = 0; count < tz->trips; count++) { > > - ret = tz->ops->get_trip_type(tz, count, &type); > > - if (!ret && type == THERMAL_TRIP_CRITICAL) { > > - ret = tz->ops->get_trip_temp(tz, count, &crit_temp); > > - break; > > - } > > - } > > - > > - if (ret) > > - goto skip_emul; > > > > - if (*temp < crit_temp) > I guess this check is confusing. Actually instead of returning > emulating temperature it is returning actual temperature. But the > important thing to look here is that actual temperature is higher than > critical temperature. So this check prevents the user from suppressing > the critical temperature and hence prevents from burning up the chip. Indeed the check is confusing, but now it makes perfectly sense. I'll look at the patch again and maybe turn into a patch just adding a comment to clarify this. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |