aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal/rcar_thermal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/thermal/rcar_thermal.c')
-rw-r--r--drivers/thermal/rcar_thermal.c49
1 files changed, 21 insertions, 28 deletions
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 5d4ae7d705e0..13d01edc7a04 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -361,6 +361,24 @@ static irqreturn_t rcar_thermal_irq(int irq, void *data)
361/* 361/*
362 * platform functions 362 * platform functions
363 */ 363 */
364static int rcar_thermal_remove(struct platform_device *pdev)
365{
366 struct rcar_thermal_common *common = platform_get_drvdata(pdev);
367 struct device *dev = &pdev->dev;
368 struct rcar_thermal_priv *priv;
369
370 rcar_thermal_for_each_priv(priv, common) {
371 if (rcar_has_irq_support(priv))
372 rcar_thermal_irq_disable(priv);
373 thermal_zone_device_unregister(priv->zone);
374 }
375
376 pm_runtime_put(dev);
377 pm_runtime_disable(dev);
378
379 return 0;
380}
381
364static int rcar_thermal_probe(struct platform_device *pdev) 382static int rcar_thermal_probe(struct platform_device *pdev)
365{ 383{
366 struct rcar_thermal_common *common; 384 struct rcar_thermal_common *common;
@@ -377,6 +395,8 @@ static int rcar_thermal_probe(struct platform_device *pdev)
377 if (!common) 395 if (!common)
378 return -ENOMEM; 396 return -ENOMEM;
379 397
398 platform_set_drvdata(pdev, common);
399
380 INIT_LIST_HEAD(&common->head); 400 INIT_LIST_HEAD(&common->head);
381 spin_lock_init(&common->lock); 401 spin_lock_init(&common->lock);
382 common->dev = dev; 402 common->dev = dev;
@@ -454,43 +474,16 @@ static int rcar_thermal_probe(struct platform_device *pdev)
454 rcar_thermal_common_write(common, ENR, enr_bits); 474 rcar_thermal_common_write(common, ENR, enr_bits);
455 } 475 }
456 476
457 platform_set_drvdata(pdev, common);
458
459 dev_info(dev, "%d sensor probed\n", i); 477 dev_info(dev, "%d sensor probed\n", i);
460 478
461 return 0; 479 return 0;
462 480
463error_unregister: 481error_unregister:
464 rcar_thermal_for_each_priv(priv, common) { 482 rcar_thermal_remove(pdev);
465 if (rcar_has_irq_support(priv))
466 rcar_thermal_irq_disable(priv);
467 thermal_zone_device_unregister(priv->zone);
468 }
469
470 pm_runtime_put(dev);
471 pm_runtime_disable(dev);
472 483
473 return ret; 484 return ret;
474} 485}
475 486
476static int rcar_thermal_remove(struct platform_device *pdev)
477{
478 struct rcar_thermal_common *common = platform_get_drvdata(pdev);
479 struct device *dev = &pdev->dev;
480 struct rcar_thermal_priv *priv;
481
482 rcar_thermal_for_each_priv(priv, common) {
483 if (rcar_has_irq_support(priv))
484 rcar_thermal_irq_disable(priv);
485 thermal_zone_device_unregister(priv->zone);
486 }
487
488 pm_runtime_put(dev);
489 pm_runtime_disable(dev);
490
491 return 0;
492}
493
494static const struct of_device_id rcar_thermal_dt_ids[] = { 487static const struct of_device_id rcar_thermal_dt_ids[] = {
495 { .compatible = "renesas,rcar-thermal", }, 488 { .compatible = "renesas,rcar-thermal", },
496 {}, 489 {},