All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
To: Eduardo Valentin <eduardo.valentin@ti.com>
Cc: Zhang Rui <rui.zhang@intel.com>,
	Amit Daniel Kachhap <amit.daniel@samsung.com>,
	Tomasz Figa <t.figa@samsung.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com
Subject: [PATCH v2 5/9] thermal: exynos: remove redundant threshold_code checks from exynos_tmu_initialize()
Date: Tue, 17 Jun 2014 19:27:21 +0200	[thread overview]
Message-ID: <1403026045-16024-6-git-send-email-b.zolnierkie@samsung.com> (raw)
In-Reply-To: <1403026045-16024-1-git-send-email-b.zolnierkie@samsung.com>

Remove runtime checks for negative return values of temp_to_code()
from exynos_tmu_initialize().

The current level temperature data hardcoded in pdata will never
cause a negative temp_to_code() return values and checking itself
is not proper.  The checks in question are done at runtime in
a production code for data that is hardcoded inside driver during
development time and later it doesn't change.  Such data should
be verified during development and review time (i.e. by a script
parsing relevant data from exynos_tmu_data.c, one can also argue
that verification to be done is so simple that the review by
a maintainer should be enough).

Theres should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/thermal/samsung/exynos_tmu.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index f061580..204f811 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -180,10 +180,6 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
 	if (data->soc == SOC_ARCH_EXYNOS4210) {
 		/* Write temperature code for threshold */
 		threshold_code = temp_to_code(data, pdata->threshold);
-		if (threshold_code < 0) {
-			ret = threshold_code;
-			goto out;
-		}
 		writeb(threshold_code,
 			data->base + reg->threshold_temp);
 		for (i = 0; i < trigger_levs; i++)
@@ -197,19 +193,13 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
 		i < trigger_levs && i < EXYNOS_MAX_TRIGGER_PER_REG; i++) {
 			threshold_code = temp_to_code(data,
 						pdata->trigger_levels[i]);
-			if (threshold_code < 0) {
-				ret = threshold_code;
-				goto out;
-			}
 			rising_threshold &= ~(0xff << 8 * i);
 			rising_threshold |= threshold_code << 8 * i;
 			if (pdata->threshold_falling) {
 				threshold_code = temp_to_code(data,
 						pdata->trigger_levels[i] -
 						pdata->threshold_falling);
-				if (threshold_code > 0)
-					falling_threshold |=
-						threshold_code << 8 * i;
+				falling_threshold |= threshold_code << 8 * i;
 			}
 		}
 
@@ -228,10 +218,6 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
 				(pdata->trigger_type[i] == HW_TRIP)) {
 			threshold_code = temp_to_code(data,
 						pdata->trigger_levels[i]);
-			if (threshold_code < 0) {
-				ret = threshold_code;
-				goto out;
-			}
 			if (i == EXYNOS_MAX_TRIGGER_PER_REG - 1) {
 				/* 1-4 level to be assigned in th0 reg */
 				rising_threshold &= ~(0xff << 8 * i);
-- 
1.8.2.3


  parent reply	other threads:[~2014-06-17 17:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-17 17:27 [PATCH v2 0/9] thermal: exynos: various cleanups Bartlomiej Zolnierkiewicz
2014-06-17 17:27 ` [PATCH v2 1/9] thermal: exynos: remove unused struct exynos_tmu_registers entries Bartlomiej Zolnierkiewicz
2014-06-17 17:27 ` [PATCH v2 2/9] thermal: exynos: remove dead code for HW_MODE calibration Bartlomiej Zolnierkiewicz
2014-06-17 17:27 ` [PATCH v2 3/9] thermal: exynos: remove dead code for TYPE_TWO_POINT_TRIMMING calibration Bartlomiej Zolnierkiewicz
2014-06-17 17:27 ` [PATCH v2 4/9] thermal: exynos: remove redundant pdata checks from exynos_tmu_initialize() Bartlomiej Zolnierkiewicz
2014-06-17 17:27 ` Bartlomiej Zolnierkiewicz [this message]
2014-06-17 17:27 ` [PATCH v2 6/9] thermal: exynos: simplify temp_to_code() and code_to_temp() Bartlomiej Zolnierkiewicz
2014-06-17 17:27 ` [PATCH v2 7/9] thermal: exynos: cache non_hw_trigger_levels in pdata Bartlomiej Zolnierkiewicz
2014-06-17 17:27 ` [PATCH v2 8/9] thermal: exynos: remove redundant pdata checks from exynos_tmu_control() Bartlomiej Zolnierkiewicz
2014-06-17 17:27 ` [PATCH v2 9/9] thermal: exynos: remove identical values from exynos*_tmu_registers structures Bartlomiej Zolnierkiewicz
2014-07-01  2:09 ` [PATCH v2 0/9] thermal: exynos: various cleanups Zhang Rui
2014-07-28 14:37 ` Eduardo Valentin
2014-07-28 15:00   ` amit daniel kachhap
2014-07-28 15:00     ` amit daniel kachhap
2014-07-29 12:58     ` Eduardo Valentin
2014-07-29 12:58       ` Eduardo Valentin
2014-07-31 17:37       ` Bartlomiej Zolnierkiewicz
2014-07-31 17:37         ` Bartlomiej Zolnierkiewicz
2014-08-01 13:18         ` edubezval
2014-08-01 13:18           ` edubezval
2014-08-20 14:16           ` Bartlomiej Zolnierkiewicz
2014-08-20 14:16             ` Bartlomiej Zolnierkiewicz

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=1403026045-16024-6-git-send-email-b.zolnierkie@samsung.com \
    --to=b.zolnierkie@samsung.com \
    --cc=amit.daniel@samsung.com \
    --cc=eduardo.valentin@ti.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=rui.zhang@intel.com \
    --cc=t.figa@samsung.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.