All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amit Kucheria <amit.kucheria@linaro.org>
To: linux-kernel@vger.kernel.org
Cc: rnayak@codeaurora.org, linux-arm-msm@vger.kernel.org,
	bjorn.andersson@linaro.org, edubezval@gmail.com,
	smohanad@codeaurora.org, andy.gross@linaro.org,
	dianders@chromium.org, mka@chromium.org,
	Zhang Rui <rui.zhang@intel.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	linux-pm@vger.kernel.org
Subject: [PATCH v2 09/11] thermal: tsens: Get rid of 'id' field
Date: Tue, 28 Aug 2018 19:08:38 +0530	[thread overview]
Message-ID: <6c23d113e19a9ddf9dc9def18943eaf7f5ad4d79.1535462942.git.amit.kucheria@linaro.org> (raw)
In-Reply-To: <cover.1535462942.git.amit.kucheria@linaro.org>
In-Reply-To: <cover.1535462942.git.amit.kucheria@linaro.org>

The hw_id field in 'struct tsens_sensor' can do the job of tracking
unique ids for each sensor connected to each tsens device instance. It
also allows hw_ids to be overridden (e.g. 8916) in cases where some
sensors in a sequence are disabled on a particular platform.

Use the hw_id field instead of the id field consistently across the
tsens code.

While we're at it, document the fields of struct tsens_sensor.

Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
---
 drivers/thermal/qcom/tsens.c |  5 ++---
 drivers/thermal/qcom/tsens.h | 10 +++++++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 9a8e8f7b4ae1..fb728ec5d77f 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -17,7 +17,7 @@ static int tsens_get_temp(void *data, int *temp)
 	const struct tsens_sensor *s = data;
 	struct tsens_device *tmdev = s->tmdev;
 
-	return tmdev->ops->get_temp(tmdev, s->id, temp);
+	return tmdev->ops->get_temp(tmdev, s->hw_id, temp);
 }
 
 static int tsens_get_trend(void *p, int trip, enum thermal_trend *trend)
@@ -26,7 +26,7 @@ static int tsens_get_trend(void *p, int trip, enum thermal_trend *trend)
 	struct tsens_device *tmdev = s->tmdev;
 
 	if (tmdev->ops->get_trend)
-		return  tmdev->ops->get_trend(tmdev, s->id, trend);
+		return  tmdev->ops->get_trend(tmdev, s->hw_id, trend);
 
 	return -ENOTSUPP;
 }
@@ -83,7 +83,6 @@ static int tsens_register(struct tsens_device *tmdev)
 
 	for (i = 0;  i < tmdev->num_sensors; i++) {
 		tmdev->sensor[i].tmdev = tmdev;
-		tmdev->sensor[i].id = i;
 		tzd = devm_thermal_zone_of_sensor_register(tmdev->dev, i,
 							   &tmdev->sensor[i],
 							   &tsens_of_ops);
diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h
index b9c4bcf255fa..2a3174dfc1a9 100644
--- a/drivers/thermal/qcom/tsens.h
+++ b/drivers/thermal/qcom/tsens.h
@@ -14,11 +14,19 @@
 
 struct tsens_device;
 
+/**
+ * struct tsens_sensor - sensor-specific data
+ * @tmdev: tsens device instance this sensor is connected to
+ * @tzd: thermal zone corresponding to this sensor
+ * @offset: offset from calibration data to convert ADC data to degrees
+ * @hw_id: unique sensor ID for each sensor connected to tsens device instance
+ * @slope: slope from calibration data to convert ADC data to degrees
+ * @status: 8960-specific status register addresses
+ */
 struct tsens_sensor {
 	struct tsens_device		*tmdev;
 	struct thermal_zone_device	*tzd;
 	int				offset;
-	int				id;
 	int				hw_id;
 	int				slope;
 	u32				status;
-- 
2.17.1

  parent reply	other threads:[~2018-08-28 13:38 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 13:38 [PATCH v2 00/11] Another round of tsens cleanups Amit Kucheria
2018-08-28 13:38 ` [PATCH v2 01/11] arm/arm64: dts: msm8974/msm8916: thermal: Split address space into two Amit Kucheria
2018-09-03 20:02   ` Bjorn Andersson
2018-09-06  9:24     ` Amit Kucheria
2018-08-28 13:38 ` [PATCH v2 02/11] arm/arm64: dts: msm8974/msm8916: thermal: Add "qcom,sensors" property Amit Kucheria
2018-09-03 20:03   ` Bjorn Andersson
2018-08-28 13:38 ` [PATCH v2 03/11] dt-bindings: thermal: Fix a typo in documentation Amit Kucheria
2018-09-03 20:04   ` Bjorn Andersson
2018-08-28 13:38 ` [PATCH v2 04/11] thermal: tsens: Add SPDX license identifiers Amit Kucheria
2018-09-03 20:04   ` Bjorn Andersson
2018-08-28 13:38 ` [PATCH v2 05/11] thermal: tsens: Get rid of dead code Amit Kucheria
2018-09-03 20:22   ` Bjorn Andersson
2018-08-28 13:38 ` [PATCH v2 06/11] thermal: tsens: Rename map field in order to add a second address map Amit Kucheria
2018-09-03 20:23   ` Bjorn Andersson
2018-08-28 13:38 ` [PATCH v2 07/11] thermal: tsens: Add the SROT " Amit Kucheria
2018-09-03 20:28   ` Bjorn Andersson
2018-08-28 13:38 ` [PATCH v2 08/11] thermal: tsens: Check if the IP is correctly enabled by firmware Amit Kucheria
2018-08-30 19:23   ` Amit Kucheria
2018-09-03 20:48     ` Bjorn Andersson
2018-09-06 10:00       ` Amit Kucheria
2018-08-28 13:38 ` Amit Kucheria [this message]
2018-09-03 20:26   ` [PATCH v2 09/11] thermal: tsens: Get rid of 'id' field Bjorn Andersson
2018-08-28 13:38 ` [PATCH v2 10/11] arm64: dts: qcom: Add reg-names for all tsens nodes Amit Kucheria
2018-09-03 20:34   ` Bjorn Andersson
2018-09-04 23:42     ` Doug Anderson
2018-08-28 13:38 ` [PATCH v2 11/11] MAINTAINERS: Add entry for Qualcomm TSENS thermal drivers Amit Kucheria
2018-09-03 20:46   ` Bjorn Andersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6c23d113e19a9ddf9dc9def18943eaf7f5ad4d79.1535462942.git.amit.kucheria@linaro.org \
    --to=amit.kucheria@linaro.org \
    --cc=andy.gross@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=dianders@chromium.org \
    --cc=edubezval@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=rnayak@codeaurora.org \
    --cc=rui.zhang@intel.com \
    --cc=smohanad@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.