diff options
author | Eduardo Valentin <edubezval@gmail.com> | 2014-11-07 20:24:39 -0500 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2014-11-20 09:44:54 -0500 |
commit | 2251aef64a38db60f4ae7a4a83f9203c6791f196 (patch) | |
tree | eb3fe5a0e6eb2c857f331ed39538a9fb2988939d /drivers/hwmon/lm75.c | |
parent | 66fb84805134c39f00d7c2054c881faa50910390 (diff) |
thermal: of: improve of-thermal sensor registration API
Different drivers request API extensions in of-thermal. For this reason,
additional callbacks are required to fit the new drivers needs.
The current API implementation expects the registering sensor driver
to provide a get_temp and get_trend callbacks as function parameters.
As the amount of callbacks is growing, this patch changes the existing
implementation to use a .ops field to hold all the of thermal callbacks
to sensor drivers.
This patch also changes the existing of-thermal users to fit the new
API design. No functional change is introduced in this patch.
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: devicetree@vger.kernel.org
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Jean Delvare <jdelvare@suse.de>
Cc: linux-kernel@vger.kernel.org
Cc: linux-pm@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Cc: lm-sensors@lm-sensors.org
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Mikko Perttunen <mikko.perttunen@kapsi.fi>
Reviewed-by: Mikko Perttunen <mikko.perttunen@kapsi.fi>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/hwmon/lm75.c')
-rw-r--r-- | drivers/hwmon/lm75.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index d16dbb33a531..e7c8bf9093ea 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c | |||
@@ -176,6 +176,10 @@ static struct attribute *lm75_attrs[] = { | |||
176 | }; | 176 | }; |
177 | ATTRIBUTE_GROUPS(lm75); | 177 | ATTRIBUTE_GROUPS(lm75); |
178 | 178 | ||
179 | static const struct thermal_zone_of_device_ops lm75_of_thermal_ops = { | ||
180 | .get_temp = lm75_read_temp, | ||
181 | }; | ||
182 | |||
179 | /*-----------------------------------------------------------------------*/ | 183 | /*-----------------------------------------------------------------------*/ |
180 | 184 | ||
181 | /* device probe and removal */ | 185 | /* device probe and removal */ |
@@ -291,10 +295,9 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
291 | if (IS_ERR(data->hwmon_dev)) | 295 | if (IS_ERR(data->hwmon_dev)) |
292 | return PTR_ERR(data->hwmon_dev); | 296 | return PTR_ERR(data->hwmon_dev); |
293 | 297 | ||
294 | data->tz = thermal_zone_of_sensor_register(data->hwmon_dev, | 298 | data->tz = thermal_zone_of_sensor_register(data->hwmon_dev, 0, |
295 | 0, | ||
296 | data->hwmon_dev, | 299 | data->hwmon_dev, |
297 | lm75_read_temp, NULL); | 300 | &lm75_of_thermal_ops); |
298 | if (IS_ERR(data->tz)) | 301 | if (IS_ERR(data->tz)) |
299 | data->tz = NULL; | 302 | data->tz = NULL; |
300 | 303 | ||