On Sat, Dec 15, 2018 at 03:30:09AM +0100, Marek Vasut wrote:
> Convert the rcar code to devm_thermal_zone_of_sensor_register_params(),
> no functional change.
>
> Signed-off-by: Marek Vasut <[email protected]>
> Cc: Daniel Lezcano <[email protected]>
> Cc: Eduardo Valentin <[email protected]>
> Cc: Wolfram Sang <[email protected]>
> Cc: Zhang Rui <[email protected]>
> Cc: [email protected]
> To: [email protected]
This patch looks good to me, though I'm not sure why { } need
to be introduced into the 4th hunk.
That notwithstanding:
Reviewed-by: Simon Horman <[email protected]>
> ---
> V2: No change
> ---
> drivers/thermal/rcar_thermal.c | 33 +++++++++++++--------------------
> 1 file changed, 13 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index 8014a207d8d9..ec70c2119c77 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -19,8 +19,6 @@
> #include <linux/spinlock.h>
> #include <linux/thermal.h>
>
> -#include "thermal_hwmon.h"
> -
> #define IDLE_INTERVAL 5000
>
> #define COMMON_STR 0x00
> @@ -54,6 +52,10 @@ struct rcar_thermal_chip {
> unsigned int nirqs;
> };
>
> +static struct thermal_zone_params rcar_thermal_params = {
> + .no_hwmon = false,
> +};
> +
> static const struct rcar_thermal_chip rcar_thermal = {
> .use_of_thermal = 0,
> .has_filonoff = 1,
> @@ -458,9 +460,7 @@ static int rcar_thermal_remove(struct platform_device
> *pdev)
> rcar_thermal_for_each_priv(priv, common) {
> rcar_thermal_irq_disable(priv);
> cancel_delayed_work_sync(&priv->work);
> - if (priv->chip->use_of_thermal)
> - thermal_remove_hwmon_sysfs(priv->zone);
> - else
> + if (!priv->chip->use_of_thermal)
> thermal_zone_device_unregister(priv->zone);
> }
>
> @@ -554,16 +554,20 @@ static int rcar_thermal_probe(struct platform_device
> *pdev)
> if (ret < 0)
> goto error_unregister;
>
> - if (chip->use_of_thermal)
> - priv->zone = devm_thermal_zone_of_sensor_register(
> + if (chip->use_of_thermal) {
> + priv->zone =
> + devm_thermal_zone_of_sensor_register_params(
> dev, i, priv,
> - &rcar_thermal_zone_of_ops);
> - else
> + &rcar_thermal_zone_of_ops,
> + &rcar_thermal_params);
> + } else {
> priv->zone = thermal_zone_device_register(
> "rcar_thermal",
> 1, 0, priv,
> &rcar_thermal_zone_ops, NULL, 0,
> idle);
> + }
> +
> if (IS_ERR(priv->zone)) {
> dev_err(dev, "can't register thermal zone\n");
> ret = PTR_ERR(priv->zone);
> @@ -571,17 +575,6 @@ static int rcar_thermal_probe(struct platform_device
> *pdev)
> goto error_unregister;
> }
>
> - if (chip->use_of_thermal) {
> - /*
> - * thermal_zone doesn't enable hwmon as default,
> - * but, enable it here to keep compatible
> - */
> - priv->zone->tzp->no_hwmon = false;
> - ret = thermal_add_hwmon_sysfs(priv->zone);
> - if (ret)
> - goto error_unregister;
> - }
> -
> rcar_thermal_irq_enable(priv);
>
> list_move_tail(&priv->list, &common->head);
> --
> 2.18.0
>