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 <adharmap@codeaurora.org>
(cherry picked from commit 8e85855631a198d27d422cd680c051d0e948e276)

Change-Id: Ieaa753e870ea86d0c56860b4fe2faceba4c2451a
Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
This commit is contained in:
Abhijeet Dharmapurikar
2011-06-07 15:06:35 -07:00
committed by Stephen Boyd
parent e4f930189a
commit 95db9f4073

View File

@@ -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__);