[<prev] [next>] [day] [month] [year] [list]
Message-id: <001201cdcd02$0e5f55d0$2b1e0170$%choi@samsung.com>
Date: Wed, 28 Nov 2012 09:48:17 +0900
From: Jonghwan Choi <jhbird.choi@...sung.com>
To: 'Jonghwan Choi' <jhbird.choi@...sung.com>,
'open list' <linux-kernel@...r.kernel.org>
Cc: 'Amit Daniel Kachhap' <amit.kachhap@...aro.org>,
'Sachin Kamat' <sachin.kamat@...aro.org>,
'Zhang Rui' <rui.zhang@...el.com>
Subject: [PATCH 1/2] thermal: exynos: Check the range of temperature code
The temperature code should range between 46 and 146.
Signed-off-by: Jonghwan Choi <jhbird.choi@...sung.com>
---
drivers/thermal/exynos_thermal.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/thermal/exynos_thermal.c
b/drivers/thermal/exynos_thermal.c
index 6dd29e4..dc2ad6c 100644
--- a/drivers/thermal/exynos_thermal.c
+++ b/drivers/thermal/exynos_thermal.c
@@ -530,14 +530,21 @@ out:
static int code_to_temp(struct exynos_tmu_data *data, u8 temp_code)
{
struct exynos_tmu_platform_data *pdata = data->pdata;
- int temp;
+ int min, max, temp;
- if (data->soc == SOC_ARCH_EXYNOS4210)
- /* temp_code should range between 75 and 175 */
- if (temp_code < 75 || temp_code > 175) {
- temp = -ENODATA;
- goto out;
- }
+ if (data->soc == SOC_ARCH_EXYNOS4210) {
+ min = 75;
+ max = 175;
+ } else {
+ min = 46;
+ max = 146;
+ }
+
+ /* temp_code should range between min and max */
+ if (temp_code < min || temp_code > max) {
+ temp = -ENODATA;
+ goto out;
+ }
switch (pdata->cal_type) {
case TYPE_TWO_POINT_TRIMMING:
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists