diff options
author | Eduardo Valentin <eduardo.valentin@ti.com> | 2013-09-12 19:15:44 -0400 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-18 12:00:53 +0900 |
commit | 01e30a22f095cc88adc7114b8869f8988a2dbfca (patch) | |
tree | a614cdef47fcf3c9044304785305436b990fd467 | |
parent | 042fd3e695a823aa970d056c63b7d55416332022 (diff) | |
download | linux-3.10-01e30a22f095cc88adc7114b8869f8988a2dbfca.tar.gz linux-3.10-01e30a22f095cc88adc7114b8869f8988a2dbfca.tar.bz2 linux-3.10-01e30a22f095cc88adc7114b8869f8988a2dbfca.zip |
thermal: allow registering without .get_temp
This patch changes the thermal core driver to allow
registration of thermal zones without the .get_temp callback.
The idea behind this change is to allow lazy registration
of sensor callbacks.
The thermal zone will be disabled whenever the ops
does not contain a .get_temp callback. The sysfs interface
will be returning -EINVAL on any temperature read operation.
Change-Id: Id58d2b558bc5a946dc7d712e28c2ed7cb90cc64b
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
-rw-r--r-- | drivers/thermal/thermal_core.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index a167ab96be0..b4bb3d0999c 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -453,7 +453,7 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp) enum thermal_trip_type type; #endif - if (!tz || IS_ERR(tz)) + if (!tz || IS_ERR(tz) || !tz->ops->get_temp) goto exit; mutex_lock(&tz->lock); @@ -506,6 +506,9 @@ void thermal_zone_device_update(struct thermal_zone_device *tz) { int count; + if (!tz->ops->get_temp) + return; + update_temperature(tz); for (count = 0; count < tz->trips; count++) @@ -1439,7 +1442,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, if (trips > THERMAL_MAX_TRIPS || trips < 0 || mask >> trips) return ERR_PTR(-EINVAL); - if (!ops || !ops->get_temp) + if (!ops) return ERR_PTR(-EINVAL); if (trips > 0 && (!ops->get_trip_type || !ops->get_trip_temp)) @@ -1543,6 +1546,9 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, INIT_DELAYED_WORK(&(tz->poll_queue), thermal_zone_device_check); + if (!tz->ops->get_temp) + thermal_zone_device_set_polling(tz, 0); + thermal_zone_device_update(tz); if (!result) |