Skip to content

Instantly share code, notes, and snippets.

@ndreys
Last active June 5, 2019 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndreys/d733228756a17e1dcb31ec8f9a0e9115 to your computer and use it in GitHub Desktop.
Save ndreys/d733228756a17e1dcb31ec8f9a0e9115 to your computer and use it in GitHub Desktop.
diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
index 53129de59dd9..5f4c7427f7b1 100644
--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -136,17 +136,6 @@ struct armada_drvdata {
} data;
};
-/*
- * struct armada_thermal_sensor - hold the information of one thermal sensor
- * @thermal: pointer to the local private structure
- * @tzd: pointer to the thermal zone device
- * @id: identifier of the thermal sensor
- */
-struct armada_thermal_sensor {
- struct armada_thermal_priv *priv;
- int id;
-};
-
static void armadaxp_init(struct platform_device *pdev,
struct armada_thermal_priv *priv)
{
@@ -429,16 +418,15 @@ static struct thermal_zone_device_ops legacy_ops = {
.get_temp = armada_get_temp_legacy,
};
-static int armada_get_temp(void *_sensor, int *temp)
+static int armada_get_temp(int id, void *priv, int *temp)
{
- struct armada_thermal_sensor *sensor = _sensor;
- struct armada_thermal_priv *priv = sensor->priv;
+ struct armada_thermal_priv *priv = priv;
int ret;
mutex_lock(&priv->update_lock);
/* Select the desired channel */
- ret = armada_select_channel(priv, sensor->id);
+ ret = armada_select_channel(priv, id);
if (ret)
goto unlock_mutex;
@@ -460,7 +448,7 @@ static int armada_get_temp(void *_sensor, int *temp)
}
static const struct thermal_zone_of_device_ops of_ops = {
- .get_temp = armada_get_temp,
+ .get_temp_id = armada_get_temp,
};
static unsigned int armada_mc_to_reg_temp(struct armada_thermal_data *data,
@@ -922,17 +910,8 @@ static int armada_thermal_probe(struct platform_device *pdev)
* channel has one sensor.
*/
for (sensor_id = 0; sensor_id <= priv->data->cpu_nr; sensor_id++) {
- sensor = devm_kzalloc(&pdev->dev,
- sizeof(struct armada_thermal_sensor),
- GFP_KERNEL);
- if (!sensor)
- return -ENOMEM;
-
- /* Register the sensor */
- sensor->priv = priv;
- sensor->id = sensor_id;
tz = devm_thermal_zone_of_sensor_register(&pdev->dev,
- sensor->id, sensor,
+ sensor_id, priv,
&of_ops);
if (IS_ERR(tz)) {
dev_info(&pdev->dev, "Thermal sensor %d unavailable\n",
@@ -947,7 +926,7 @@ static int armada_thermal_probe(struct platform_device *pdev)
* critical trip points will simply be ignored by the driver.
*/
if (irq > 0 && !priv->overheat_sensor)
- armada_configure_overheat_int(priv, tz, sensor->id);
+ armada_configure_overheat_int(priv, tz, sensor_id);
}
/* Just complain if no overheat interrupt was set up */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment