Commit b86105ed authored by Daniel Lezcano's avatar Daniel Lezcano Committed by Daniel Lezcano

thermal/drivers/banggap: Switch to new of API

The thermal OF code has a new API allowing to migrate the OF
initialization to a simpler approach. The ops are no longer device
tree specific and are the generic ones provided by the core code.

Convert the ops to the thermal_zone_device_ops format and use the new
API to register the thermal zone with these generic ops.
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linexp.org>
Link: https://lore.kernel.org/r/20220804224349.1926752-22-daniel.lezcano@linexp.orgReviewed-by: default avatarBryan Brattlof <bb@ti.com>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent ab7e865d
...@@ -139,9 +139,9 @@ static int k3_bgp_read_temp(struct k3_thermal_data *devdata, ...@@ -139,9 +139,9 @@ static int k3_bgp_read_temp(struct k3_thermal_data *devdata,
return 0; return 0;
} }
static int k3_thermal_get_temp(void *devdata, int *temp) static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
{ {
struct k3_thermal_data *data = devdata; struct k3_thermal_data *data = tz->devdata;
int ret = 0; int ret = 0;
ret = k3_bgp_read_temp(data, temp); ret = k3_bgp_read_temp(data, temp);
...@@ -151,7 +151,7 @@ static int k3_thermal_get_temp(void *devdata, int *temp) ...@@ -151,7 +151,7 @@ static int k3_thermal_get_temp(void *devdata, int *temp)
return ret; return ret;
} }
static const struct thermal_zone_of_device_ops k3_of_thermal_ops = { static const struct thermal_zone_device_ops k3_of_thermal_ops = {
.get_temp = k3_thermal_get_temp, .get_temp = k3_thermal_get_temp,
}; };
...@@ -213,9 +213,9 @@ static int k3_bandgap_probe(struct platform_device *pdev) ...@@ -213,9 +213,9 @@ static int k3_bandgap_probe(struct platform_device *pdev)
writel(val, data[id].bgp->base + data[id].ctrl_offset); writel(val, data[id].bgp->base + data[id].ctrl_offset);
data[id].tzd = data[id].tzd =
devm_thermal_zone_of_sensor_register(dev, id, devm_thermal_of_zone_register(dev, id,
&data[id], &data[id],
&k3_of_thermal_ops); &k3_of_thermal_ops);
if (IS_ERR(data[id].tzd)) { if (IS_ERR(data[id].tzd)) {
dev_err(dev, "thermal zone device is NULL\n"); dev_err(dev, "thermal zone device is NULL\n");
ret = PTR_ERR(data[id].tzd); ret = PTR_ERR(data[id].tzd);
......
...@@ -247,9 +247,9 @@ static inline int k3_bgp_read_temp(struct k3_thermal_data *devdata, ...@@ -247,9 +247,9 @@ static inline int k3_bgp_read_temp(struct k3_thermal_data *devdata,
} }
/* Get temperature callback function for thermal zone */ /* Get temperature callback function for thermal zone */
static int k3_thermal_get_temp(void *devdata, int *temp) static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
{ {
struct k3_thermal_data *data = devdata; struct k3_thermal_data *data = tz->devdata;
int ret = 0; int ret = 0;
ret = k3_bgp_read_temp(data, temp); ret = k3_bgp_read_temp(data, temp);
...@@ -259,7 +259,7 @@ static int k3_thermal_get_temp(void *devdata, int *temp) ...@@ -259,7 +259,7 @@ static int k3_thermal_get_temp(void *devdata, int *temp)
return ret; return ret;
} }
static const struct thermal_zone_of_device_ops k3_of_thermal_ops = { static const struct thermal_zone_device_ops k3_of_thermal_ops = {
.get_temp = k3_thermal_get_temp, .get_temp = k3_thermal_get_temp,
}; };
...@@ -474,10 +474,8 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev) ...@@ -474,10 +474,8 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
writel(val, data[id].bgp->cfg2_base + data[id].ctrl_offset); writel(val, data[id].bgp->cfg2_base + data[id].ctrl_offset);
bgp->ts_data[id] = &data[id]; bgp->ts_data[id] = &data[id];
ti_thermal = ti_thermal = devm_thermal_of_zone_register(bgp->dev, id, &data[id],
devm_thermal_zone_of_sensor_register(bgp->dev, id, &k3_of_thermal_ops);
&data[id],
&k3_of_thermal_ops);
if (IS_ERR(ti_thermal)) { if (IS_ERR(ti_thermal)) {
dev_err(bgp->dev, "thermal zone device is NULL\n"); dev_err(bgp->dev, "thermal zone device is NULL\n");
ret = PTR_ERR(ti_thermal); ret = PTR_ERR(ti_thermal);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment