]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
thermal: qoriq: Use devm_thermal_zone_of_sensor_register()
authorFabio Estevam <fabio.estevam@nxp.com>
Sat, 28 Jul 2018 19:17:49 +0000 (16:17 -0300)
committerEduardo Valentin <edubezval@gmail.com>
Mon, 20 Aug 2018 18:29:42 +0000 (11:29 -0700)
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>
drivers/thermal/qoriq_thermal.c

index c866cc1659606726584e47b6e74ff59fe2d6aa51..e32d6ac79145fa855d59cea0dda38a23905a4774 100644 (file)
@@ -233,8 +233,9 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
        if (ret < 0)
                goto err_tmu;
 
-       data->tz = thermal_zone_of_sensor_register(&pdev->dev, data->sensor_id,
-                               data, &tmu_tz_ops);
+       data->tz = devm_thermal_zone_of_sensor_register(&pdev->dev,
+                                                       data->sensor_id,
+                                                       data, &tmu_tz_ops);
        if (IS_ERR(data->tz)) {
                ret = PTR_ERR(data->tz);
                dev_err(&pdev->dev,
@@ -261,8 +262,6 @@ static int qoriq_tmu_remove(struct platform_device *pdev)
 {
        struct qoriq_tmu_data *data = platform_get_drvdata(pdev);
 
-       thermal_zone_of_sensor_unregister(&pdev->dev, data->tz);
-
        /* Disable monitoring */
        tmu_write(data, TMR_DISABLE, &data->regs->tmr);