From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754442AbbEMIy2 (ORCPT ); Wed, 13 May 2015 04:54:28 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:42482 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754604AbbEMIxP (ORCPT ); Wed, 13 May 2015 04:53:15 -0400 From: Sascha Hauer To: linux-pm@vger.kernel.org Cc: Zhang Rui , Eduardo Valentin , linux-kernel@vger.kernel.org, Stephen Warren , Mikko Perttunen , kernel@pengutronix.de, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Brian Norris , Sascha Hauer Subject: [PATCH 05/15] thermal: Add comment explaining test for critical temperature Date: Wed, 13 May 2015 10:52:33 +0200 Message-Id: <1431507163-19933-6-git-send-email-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431507163-19933-1-git-send-email-s.hauer@pengutronix.de> References: <1431507163-19933-1-git-send-email-s.hauer@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 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 The code testing if a temperature should be emulated or not is not obvious. Add a comment explaining why this test is done. Signed-off-by: Sascha Hauer --- drivers/thermal/thermal_core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 3e0fe55..e204deb 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -435,6 +435,11 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) } } + /* + * Only allow emulating a temperature when the real temperature + * is below the critical temperature so that the emulation code + * cannot hide critical conditions. + */ if (!ret && *temp < crit_temp) *temp = tz->emul_temperature; } -- 2.1.4