Re: [PATCH 2/2] thermal: rcar-thermal: enable hwmon when thermal_zone

From: Zhang Rui
Date: Wed Aug 24 2016 - 03:53:29 EST


On ä, 2016-08-19 at 19:35 +0800, Zhang Rui wrote:
> On ä, 2016-07-19 at 10:01 +0000, Kuninori Morimoto wrote:
> >
> > From: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
> >
> > rcar-thermal is supporting both thermal_zone_of_sensor_register()
> > and
> > thermal_zone_device_register(). But
> > thermal_zone_of_sensor_register()
> > doesn't enable hwmon as default.
> > This patch enables it to keep compatibility
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
> Queued for 4.9
>
the subject should be "thermal:rcar-theraml: enable hwmon when
thermal_zone_of_sensor_register is used", right?

thanks,
rui
> thanks,
> rui
> >
> > ---
> > Âdrivers/thermal/rcar_thermal.c | 20 ++++++++++++++++++--
> > Â1 file changed, 18 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/thermal/rcar_thermal.c
> > b/drivers/thermal/rcar_thermal.c
> > index 71a3392..4d07644 100644
> > --- a/drivers/thermal/rcar_thermal.c
> > +++ b/drivers/thermal/rcar_thermal.c
> > @@ -31,6 +31,8 @@
> > Â#include <linux/spinlock.h>
> > Â#include <linux/thermal.h>
> > Â
> > +#include "thermal_hwmon.h"
> > +
> > Â#define IDLE_INTERVAL 5000
> > Â
> > Â#define COMMON_STR 0x00
> > @@ -75,6 +77,8 @@ struct rcar_thermal_priv {
> > Â#define rcar_priv_to_dev(priv) ((priv)->common-
> > >dev)
> > Â#define rcar_has_irq_support(priv) ((priv)->common->base)
> > Â#define rcar_id_to_shift(priv) ((priv)->id * 8)
> > +#define rcar_of_data(dev) ((unsigned
> > long)of_device_get_match_data(dev))
> > +#define rcar_use_of_thermal(dev) (rcar_of_data(dev) ==
> > USE_OF_THERMAL)
> > Â
> > Â#define USE_OF_THERMAL 1
> > Âstatic const struct of_device_id rcar_thermal_dt_ids[] = {
> > @@ -416,6 +420,8 @@ static int rcar_thermal_remove(struct
> > platform_device *pdev)
> > Â rcar_thermal_for_each_priv(priv, common) {
> > Â rcar_thermal_irq_disable(priv);
> > Â thermal_zone_device_unregister(priv->zone);
> > + if (rcar_use_of_thermal(dev))
> > + thermal_remove_hwmon_sysfs(priv->zone);
> > Â }
> > Â
> > Â pm_runtime_put(dev);
> > @@ -430,7 +436,6 @@ static int rcar_thermal_probe(struct
> > platform_device *pdev)
> > Â struct rcar_thermal_priv *priv;
> > Â struct device *dev = &pdev->dev;
> > Â struct resource *res, *irq;
> > - unsigned long of_data = (unsigned
> > long)of_device_get_match_data(dev);
> > Â int mres = 0;
> > Â int i;
> > Â int ret = -ENODEV;
> > @@ -491,7 +496,7 @@ static int rcar_thermal_probe(struct
> > platform_device *pdev)
> > Â if (ret < 0)
> > Â goto error_unregister;
> > Â
> > - if (of_data == USE_OF_THERMAL)
> > + if (rcar_use_of_thermal(dev))
> > Â priv->zone =
> > devm_thermal_zone_of_sensor_register(
> > Â dev, i, priv,
> > Â &rcar_thermal_zone
> > _o
> > f_ops);
> > @@ -507,6 +512,17 @@ static int rcar_thermal_probe(struct
> > platform_device *pdev)
> > Â goto error_unregister;
> > Â }
> > Â
> > + if (rcar_use_of_thermal(dev)) {
> > + /*
> > + Â* 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);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm"
> in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info atÂÂhttp://vger.kernel.org/majordomo-info.html