aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@nxp.com>2018-07-28 15:17:49 -0400
committerEduardo Valentin <edubezval@gmail.com>2018-08-20 14:29:42 -0400
commitf1506a69e3e72196c7c5ce4fd420d5e1a6965ed3 (patch)
tree893c594c6ab80dc21cc79afe72fb373783bfc230
parent2ad0d52699700a91660a406a4046017a2d7f246a (diff)
thermal: qoriq: Use devm_thermal_zone_of_sensor_register()
By using the managed devm_thermal_zone_of_sensor_register() we can drop the explicit call to thermal_zone_of_sensor_unregister() in the qoriq_tmu_remove() function, which simplifies the code a bit. So switch to devm_thermal_zone_of_sensor_register(). Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
-rw-r--r--drivers/thermal/qoriq_thermal.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index c866cc165960..e32d6ac79145 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -233,8 +233,9 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
233 if (ret < 0) 233 if (ret < 0)
234 goto err_tmu; 234 goto err_tmu;
235 235
236 data->tz = thermal_zone_of_sensor_register(&pdev->dev, data->sensor_id, 236 data->tz = devm_thermal_zone_of_sensor_register(&pdev->dev,
237 data, &tmu_tz_ops); 237 data->sensor_id,
238 data, &tmu_tz_ops);
238 if (IS_ERR(data->tz)) { 239 if (IS_ERR(data->tz)) {
239 ret = PTR_ERR(data->tz); 240 ret = PTR_ERR(data->tz);
240 dev_err(&pdev->dev, 241 dev_err(&pdev->dev,
@@ -261,8 +262,6 @@ static int qoriq_tmu_remove(struct platform_device *pdev)
261{ 262{
262 struct qoriq_tmu_data *data = platform_get_drvdata(pdev); 263 struct qoriq_tmu_data *data = platform_get_drvdata(pdev);
263 264
264 thermal_zone_of_sensor_unregister(&pdev->dev, data->tz);
265
266 /* Disable monitoring */ 265 /* Disable monitoring */
267 tmu_write(data, TMR_DISABLE, &data->regs->tmr); 266 tmu_write(data, TMR_DISABLE, &data->regs->tmr);
268 267