]> Git Repo - linux.git/blobdiff - drivers/hwmon/mlxreg-fan.c
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux...
[linux.git] / drivers / hwmon / mlxreg-fan.c
index f816d2ae1e58108ac77c0da93d8455e0411011d5..ed8d59d4eecb361c288b0926f222ec1e380634ea 100644 (file)
@@ -465,42 +465,42 @@ static int mlxreg_fan_config(struct mlxreg_fan *fan,
 static int mlxreg_fan_probe(struct platform_device *pdev)
 {
        struct mlxreg_core_platform_data *pdata;
+       struct device *dev = &pdev->dev;
        struct mlxreg_fan *fan;
        struct device *hwm;
        int err;
 
-       pdata = dev_get_platdata(&pdev->dev);
+       pdata = dev_get_platdata(dev);
        if (!pdata) {
-               dev_err(&pdev->dev, "Failed to get platform data.\n");
+               dev_err(dev, "Failed to get platform data.\n");
                return -EINVAL;
        }
 
-       fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL);
+       fan = devm_kzalloc(dev, sizeof(*fan), GFP_KERNEL);
        if (!fan)
                return -ENOMEM;
 
-       fan->dev = &pdev->dev;
+       fan->dev = dev;
        fan->regmap = pdata->regmap;
-       platform_set_drvdata(pdev, fan);
 
        err = mlxreg_fan_config(fan, pdata);
        if (err)
                return err;
 
-       hwm = devm_hwmon_device_register_with_info(&pdev->dev, "mlxreg_fan",
+       hwm = devm_hwmon_device_register_with_info(dev, "mlxreg_fan",
                                                   fan,
                                                   &mlxreg_fan_hwmon_chip_info,
                                                   NULL);
        if (IS_ERR(hwm)) {
-               dev_err(&pdev->dev, "Failed to register hwmon device\n");
+               dev_err(dev, "Failed to register hwmon device\n");
                return PTR_ERR(hwm);
        }
 
        if (IS_REACHABLE(CONFIG_THERMAL)) {
-               fan->cdev = thermal_cooling_device_register("mlxreg_fan", fan,
-                                               &mlxreg_fan_cooling_ops);
+               fan->cdev = devm_thermal_of_cooling_device_register(dev,
+                       NULL, "mlxreg_fan", fan, &mlxreg_fan_cooling_ops);
                if (IS_ERR(fan->cdev)) {
-                       dev_err(&pdev->dev, "Failed to register cooling device\n");
+                       dev_err(dev, "Failed to register cooling device\n");
                        return PTR_ERR(fan->cdev);
                }
        }
@@ -508,22 +508,11 @@ static int mlxreg_fan_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int mlxreg_fan_remove(struct platform_device *pdev)
-{
-       struct mlxreg_fan *fan = platform_get_drvdata(pdev);
-
-       if (IS_REACHABLE(CONFIG_THERMAL))
-               thermal_cooling_device_unregister(fan->cdev);
-
-       return 0;
-}
-
 static struct platform_driver mlxreg_fan_driver = {
        .driver = {
            .name = "mlxreg-fan",
        },
        .probe = mlxreg_fan_probe,
-       .remove = mlxreg_fan_remove,
 };
 
 module_platform_driver(mlxreg_fan_driver);
This page took 0.034252 seconds and 4 git commands to generate.