mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonghwan Choi <jhbird.choi@samsung.com>
To: "'Jonghwan Choi'" <jhbird.choi@samsung.com>,
	"'open list'" <linux-kernel@vger.kernel.org>
Cc: "'Amit Daniel Kachhap'" <amit.kachhap@linaro.org>,
	"'Sachin Kamat'" <sachin.kamat@linaro.org>,
	"'Zhang Rui'" <rui.zhang@intel.com>
Subject: [PATCH 1/2] thermal: exynos: Check the range of temperature code
Date: Wed, 28 Nov 2012 09:48:17 +0900	[thread overview]
Message-ID: <001201cdcd02$0e5f55d0$2b1e0170$%choi@samsung.com> (raw)
In-Reply-To: 

The temperature code should range between 46 and 146.

Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.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


                 reply	other threads:[~2012-11-28  0:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001201cdcd02$0e5f55d0$2b1e0170$%choi@samsung.com' \
    --to=jhbird.choi@samsung.com \
    --cc=amit.kachhap@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=sachin.kamat@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®