From 95db9f4073ae6750ee271f1c2d0a480b2e86d7d3 Mon Sep 17 00:00:00 2001 From: Abhijeet Dharmapurikar Date: Tue, 7 Jun 2011 15:06:35 -0700 Subject: [PATCH] thermal: msm_tsense: fix request irq ordering Triggering an irq might cause an update to the thermal zone device. If the thermal zone device is not initialized then a kernel panic ensues. Request the irq after the thermal devices have been initialized, this way the isr will be called only after it is initialized. Signed-off-by: Abhijeet Dharmapurikar (cherry picked from commit 8e85855631a198d27d422cd680c051d0e948e276) Change-Id: Ieaa753e870ea86d0c56860b4fe2faceba4c2451a Signed-off-by: Shruthi Krishna Signed-off-by: David Brown --- drivers/thermal/msm_tsens.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/msm_tsens.c b/drivers/thermal/msm_tsens.c index 5dc367e6f69..40c68509391 100644 --- a/drivers/thermal/msm_tsens.c +++ b/drivers/thermal/msm_tsens.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010, Code Aurora Forum. All rights reserved. +/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -525,14 +525,6 @@ static int __devinit tsens_tm_probe(struct platform_device *pdev) tmdev->offset = TSENS_FACTOR * TSENS_CAL_DEGC - (int)(TSENS_FACTOR * TSENS_SLOPE) * calib_data; tmdev->prev_reading_avail = 0; - rc = request_threaded_irq(TSENS_UPPER_LOWER_INT, tsens_isr, - tsens_isr_thread, 0, "tsens", tmdev); - - if (rc < 0) { - pr_err("%s: request_irq FAIL: %d\n", __func__, rc); - kfree(tmdev); - return rc; - } INIT_WORK(&tmdev->work, notify_uspace_tsens_fn); @@ -572,6 +564,14 @@ static int __devinit tsens_tm_probe(struct platform_device *pdev) tmdev->sensor[i].mode = THERMAL_DEVICE_DISABLED; } + rc = request_threaded_irq(TSENS_UPPER_LOWER_INT, tsens_isr, + tsens_isr_thread, 0, "tsens", tmdev); + if (rc < 0) { + pr_err("%s: request_irq FAIL: %d\n", __func__, rc); + kfree(tmdev); + return rc; + } + writel(reg & ~((((1 << TSENS_NUM_SENSORS) - 1) << 3) | TSENS_SLP_CLK_ENA | TSENS_EN), TSENS_CNTL_ADDR); pr_notice("%s: OK\n", __func__);