[PATCH RFC 2/2] thermal/drivers/qoriq: Use the get_temp_id()

From: Daniel Lezcano
Date: Thu Apr 04 2019 - 04:07:16 EST


Currently the code is adding extra back pointer to find out the general
structure for the driver from the sensor data.

Use the get_temp_id() which pass the sensor id when registering the callback.

Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
---
drivers/thermal/qoriq_thermal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index 3b5f5b3fb1bc..405d1fbdd0cb 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -92,20 +92,20 @@ static u32 tmu_read(struct qoriq_tmu_data *p, void __iomem *addr)
return ioread32be(addr);
}

-static int tmu_get_temp(void *p, int *temp)
+static int tmu_get_temp(int id, void *p, int *temp)
{
struct qoriq_sensor *qsensor = p;
struct qoriq_tmu_data *qdata = qsensor->qdata;
u32 val;

- val = tmu_read(qdata, &qdata->regs->site[qsensor->id].tritsr);
+ val = tmu_read(qdata, &qdata->regs->site[id].tritsr);
*temp = (val & 0xff) * 1000;

return 0;
}

static const struct thermal_zone_of_device_ops tmu_tz_ops = {
- .get_temp = tmu_get_temp,
+ .get_temp_id = tmu_get_temp,
};

static int qoriq_tmu_register_tmu_zone(struct platform_device *pdev)
--
2.17.1