diff options
author | Jinyoung Park <jinyoungp@nvidia.com> | 2013-03-21 16:59:54 +0900 |
---|---|---|
committer | Mrutyunjay Sawant <msawant@nvidia.com> | 2013-03-28 03:15:50 -0700 |
commit | 02ebe3a815127af786292d1a7d144277aa966b63 (patch) | |
tree | 848e3542282a43be08c6d39df6df269c56233a7b /drivers/misc | |
parent | d832906d904916a263c831d1bf55031070818991 (diff) |
drivers: misc: therm_est: Add therm_est_subdev_get_temp function
Added therm_est_subdev_get_temp function instead of get_temp callback in
struct therm_est_subdevice in order to remove redeundancy code.
Bug 1233363
Bug 1236444
Change-Id: If1126f9227b6821a79ed1d9718ed4cd7cea3c540
Signed-off-by: Jinyoung Park <jinyoungp@nvidia.com>
Reviewed-on: http://git-master/r/211539
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/therm_est.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/misc/therm_est.c b/drivers/misc/therm_est.c index 1c953082dba2..da1c74a575aa 100644 --- a/drivers/misc/therm_est.c +++ b/drivers/misc/therm_est.c @@ -57,6 +57,23 @@ struct therm_estimator { #endif }; +static int therm_est_subdev_match(struct thermal_zone_device *thz, void *data) +{ + return strcmp((char *)data, thz->type) == 0; +} + +static int therm_est_subdev_get_temp(void *data, long *temp) +{ + struct thermal_zone_device *thz; + + thz = thermal_zone_device_find(data, therm_est_subdev_match); + + if (!thz || thz->ops->get_temp(thz, temp)) + *temp = 25000; + + return 0; +} + static void therm_est_update_limits(struct therm_estimator *est) { const int MAX_HIGH_TEMP = 128000; @@ -105,7 +122,7 @@ static void therm_est_work_func(struct work_struct *work) therm_est_work); for (i = 0; i < est->ndevs; i++) { - if (est->devs[i].get_temp(est->devs[i].dev_data, &temp)) + if (therm_est_subdev_get_temp(est->devs[i].dev_data, &temp)) continue; est->devs[i].hist[(est->ntemp % HIST_LEN)] = temp; } @@ -448,7 +465,7 @@ static int therm_est_init_history(struct therm_estimator *est) for (i = 0; i < est->ndevs; i++) { dev = &est->devs[i]; - if (dev->get_temp(dev->dev_data, &temp)) + if (therm_est_subdev_get_temp(dev->dev_data, &temp)) return -EINVAL; for (j = 0; j < HIST_LEN; j++) |