aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/mlxreg-fan.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-05-16 10:56:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-16 10:56:57 -0400
commita455eda33faafcaac1effb31d682765b14ef868c (patch)
tree9a4ca7da47300ca9081445539ff337efcead4b6b /drivers/hwmon/mlxreg-fan.c
parentcc7ce90153e74f8266eefee9fba466faa1a2d5df (diff)
parent37bcec5d9f71bd13142a97d2196b293c9ac23823 (diff)
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal
Pull thermal soc updates from Eduardo Valentin: - thermal core has a new devm_* API for registering cooling devices. I took the entire series, that is why you see changes on drivers/hwmon in this pull (Guenter Roeck) - rockchip thermal driver gains support to PX30 SoC (Elaine Zhang) - the generic-adc thermal driver now considers the lookup table DT property as optional (Jean-Francois Dagenais) - Refactoring of tsens thermal driver (Amit Kucheria) - Cleanups on cpu cooling driver (Daniel Lezcano) - broadcom thermal driver dropped support to ACPI (Srinath Mannam) - tegra thermal driver gains support to OC hw throttle and GPU throtle (Wei Ni) - Fixes in several thermal drivers. * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal: (59 commits) hwmon: (pwm-fan) Use devm_thermal_of_cooling_device_register hwmon: (npcm750-pwm-fan) Use devm_thermal_of_cooling_device_register hwmon: (mlxreg-fan) Use devm_thermal_of_cooling_device_register hwmon: (gpio-fan) Use devm_thermal_of_cooling_device_register hwmon: (aspeed-pwm-tacho) Use devm_thermal_of_cooling_device_register thermal: rcar_gen3_thermal: Fix to show correct trip points number thermal: rcar_thermal: update calculation formula for R-Car Gen3 SoCs thermal: cpu_cooling: Actually trace CPU load in thermal_power_cpu_get_power thermal: rockchip: Support the PX30 SoC in thermal driver dt-bindings: rockchip-thermal: Support the PX30 SoC compatible thermal: rockchip: fix up the tsadc pinctrl setting error thermal: broadcom: Remove ACPI support thermal: Fix build error of missing devm_ioremap_resource on UM thermal/drivers/cpu_cooling: Remove pointless field thermal/drivers/cpu_cooling: Add Software Package Data Exchange (SPDX) thermal/drivers/cpu_cooling: Fixup the header and copyright thermal/drivers/cpu_cooling: Remove pointless test in power2state() thermal: rcar_gen3_thermal: disable interrupt in .remove thermal: rcar_gen3_thermal: fix interrupt type thermal: Introduce devm_thermal_of_cooling_device_register ...
Diffstat (limited to 'drivers/hwmon/mlxreg-fan.c')
-rw-r--r--drivers/hwmon/mlxreg-fan.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/drivers/hwmon/mlxreg-fan.c b/drivers/hwmon/mlxreg-fan.c
index f816d2ae1e58..ed8d59d4eecb 100644
--- a/drivers/hwmon/mlxreg-fan.c
+++ b/drivers/hwmon/mlxreg-fan.c
@@ -465,42 +465,42 @@ static int mlxreg_fan_config(struct mlxreg_fan *fan,
465static int mlxreg_fan_probe(struct platform_device *pdev) 465static int mlxreg_fan_probe(struct platform_device *pdev)
466{ 466{
467 struct mlxreg_core_platform_data *pdata; 467 struct mlxreg_core_platform_data *pdata;
468 struct device *dev = &pdev->dev;
468 struct mlxreg_fan *fan; 469 struct mlxreg_fan *fan;
469 struct device *hwm; 470 struct device *hwm;
470 int err; 471 int err;
471 472
472 pdata = dev_get_platdata(&pdev->dev); 473 pdata = dev_get_platdata(dev);
473 if (!pdata) { 474 if (!pdata) {
474 dev_err(&pdev->dev, "Failed to get platform data.\n"); 475 dev_err(dev, "Failed to get platform data.\n");
475 return -EINVAL; 476 return -EINVAL;
476 } 477 }
477 478
478 fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL); 479 fan = devm_kzalloc(dev, sizeof(*fan), GFP_KERNEL);
479 if (!fan) 480 if (!fan)
480 return -ENOMEM; 481 return -ENOMEM;
481 482
482 fan->dev = &pdev->dev; 483 fan->dev = dev;
483 fan->regmap = pdata->regmap; 484 fan->regmap = pdata->regmap;
484 platform_set_drvdata(pdev, fan);
485 485
486 err = mlxreg_fan_config(fan, pdata); 486 err = mlxreg_fan_config(fan, pdata);
487 if (err) 487 if (err)
488 return err; 488 return err;
489 489
490 hwm = devm_hwmon_device_register_with_info(&pdev->dev, "mlxreg_fan", 490 hwm = devm_hwmon_device_register_with_info(dev, "mlxreg_fan",
491 fan, 491 fan,
492 &mlxreg_fan_hwmon_chip_info, 492 &mlxreg_fan_hwmon_chip_info,
493 NULL); 493 NULL);
494 if (IS_ERR(hwm)) { 494 if (IS_ERR(hwm)) {
495 dev_err(&pdev->dev, "Failed to register hwmon device\n"); 495 dev_err(dev, "Failed to register hwmon device\n");
496 return PTR_ERR(hwm); 496 return PTR_ERR(hwm);
497 } 497 }
498 498
499 if (IS_REACHABLE(CONFIG_THERMAL)) { 499 if (IS_REACHABLE(CONFIG_THERMAL)) {
500 fan->cdev = thermal_cooling_device_register("mlxreg_fan", fan, 500 fan->cdev = devm_thermal_of_cooling_device_register(dev,
501 &mlxreg_fan_cooling_ops); 501 NULL, "mlxreg_fan", fan, &mlxreg_fan_cooling_ops);
502 if (IS_ERR(fan->cdev)) { 502 if (IS_ERR(fan->cdev)) {
503 dev_err(&pdev->dev, "Failed to register cooling device\n"); 503 dev_err(dev, "Failed to register cooling device\n");
504 return PTR_ERR(fan->cdev); 504 return PTR_ERR(fan->cdev);
505 } 505 }
506 } 506 }
@@ -508,22 +508,11 @@ static int mlxreg_fan_probe(struct platform_device *pdev)
508 return 0; 508 return 0;
509} 509}
510 510
511static int mlxreg_fan_remove(struct platform_device *pdev)
512{
513 struct mlxreg_fan *fan = platform_get_drvdata(pdev);
514
515 if (IS_REACHABLE(CONFIG_THERMAL))
516 thermal_cooling_device_unregister(fan->cdev);
517
518 return 0;
519}
520
521static struct platform_driver mlxreg_fan_driver = { 511static struct platform_driver mlxreg_fan_driver = {
522 .driver = { 512 .driver = {
523 .name = "mlxreg-fan", 513 .name = "mlxreg-fan",
524 }, 514 },
525 .probe = mlxreg_fan_probe, 515 .probe = mlxreg_fan_probe,
526 .remove = mlxreg_fan_remove,
527}; 516};
528 517
529module_platform_driver(mlxreg_fan_driver); 518module_platform_driver(mlxreg_fan_driver);