OSDN Git Service

drivers: thermal: tsens: Get rid of id field in tsens_sensor
authorAmit Kucheria <amit.kucheria@linaro.org>
Thu, 31 Oct 2019 18:37:25 +0000 (00:07 +0530)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Thu, 7 Nov 2019 06:00:26 +0000 (07:00 +0100)
commit8b71bce407b3f13c5db3795ee469da7773a7d230
treeba12b07a73a9edfd7d25bb5a42d7fdcfdbc1ba07
parent9809797b932e7d0485a37bd8a14bccb2c893b6c6
drivers: thermal: tsens: Get rid of id field in tsens_sensor

There are two fields - id and hw_id - to track what sensor an action was
to performed on. This was because the sensors connected to a TSENS IP
might not be contiguous i.e. 1, 2, 4, 5 with 3 being skipped.

This causes confusion in the code which uses hw_id sometimes and id
other times (tsens_get_temp, tsens_get_trend).

Switch to only using the hw_id field to track the physical ID of the
sensor. When we iterate through all the sensors connected to an IP
block, we use an index i to loop through the list of sensors, and then
return the actual hw_id that is registered on that index.

Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/30206cd47d303d2dcaef87f4e3c7173481a0bddd.1572526427.git.amit.kucheria@linaro.org
drivers/thermal/qcom/tsens-8960.c
drivers/thermal/qcom/tsens-common.c
drivers/thermal/qcom/tsens.c
drivers/thermal/qcom/tsens.h