diff options
Diffstat (limited to 'drivers/misc/therm_est.c')
| -rw-r--r-- | drivers/misc/therm_est.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/misc/therm_est.c b/drivers/misc/therm_est.c index c4dfbdab6..471d626ff 100644 --- a/drivers/misc/therm_est.c +++ b/drivers/misc/therm_est.c | |||
| @@ -108,12 +108,9 @@ static int therm_est_subdev_match(struct thermal_zone_device *thz, void *data) | |||
| 108 | return strcmp((char *)data, thz->type) == 0; | 108 | return strcmp((char *)data, thz->type) == 0; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | static int therm_est_subdev_get_temp(void *data, long *temp) | 111 | static int therm_est_subdev_get_temp(struct thermal_zone_device *thz, |
| 112 | long *temp) | ||
| 112 | { | 113 | { |
| 113 | struct thermal_zone_device *thz; | ||
| 114 | |||
| 115 | thz = thermal_zone_device_find(data, therm_est_subdev_match); | ||
| 116 | |||
| 117 | if (!thz || thz->ops->get_temp(thz, temp)) | 114 | if (!thz || thz->ops->get_temp(thz, temp)) |
| 118 | *temp = 25000; | 115 | *temp = 25000; |
| 119 | 116 | ||
| @@ -249,7 +246,7 @@ static void therm_est_work_func(struct work_struct *work) | |||
| 249 | therm_est_work); | 246 | therm_est_work); |
| 250 | 247 | ||
| 251 | for (i = 0; i < est->ndevs; i++) { | 248 | for (i = 0; i < est->ndevs; i++) { |
| 252 | if (therm_est_subdev_get_temp(est->devs[i].dev_data, &temp)) | 249 | if (therm_est_subdev_get_temp(est->devs[i].sub_thz, &temp)) |
| 253 | continue; | 250 | continue; |
| 254 | est->devs[i].hist[(est->ntemp % HIST_LEN)] = temp; | 251 | est->devs[i].hist[(est->ntemp % HIST_LEN)] = temp; |
| 255 | } | 252 | } |
| @@ -475,7 +472,7 @@ static int therm_est_init_history(struct therm_estimator *est) | |||
| 475 | for (i = 0; i < est->ndevs; i++) { | 472 | for (i = 0; i < est->ndevs; i++) { |
| 476 | dev = &est->devs[i]; | 473 | dev = &est->devs[i]; |
| 477 | 474 | ||
| 478 | if (therm_est_subdev_get_temp(dev->dev_data, &temp)) | 475 | if (therm_est_subdev_get_temp(dev->sub_thz, &temp)) |
| 479 | return -EINVAL; | 476 | return -EINVAL; |
| 480 | 477 | ||
| 481 | for (j = 0; j < HIST_LEN; j++) | 478 | for (j = 0; j < HIST_LEN; j++) |
| @@ -777,6 +774,7 @@ static int therm_est_probe(struct platform_device *pdev) | |||
| 777 | int i; | 774 | int i; |
| 778 | struct therm_estimator *est; | 775 | struct therm_estimator *est; |
| 779 | struct therm_est_data *data; | 776 | struct therm_est_data *data; |
| 777 | struct thermal_zone_device *thz; | ||
| 780 | 778 | ||
| 781 | est = kzalloc(sizeof(struct therm_estimator), GFP_KERNEL); | 779 | est = kzalloc(sizeof(struct therm_estimator), GFP_KERNEL); |
| 782 | if (IS_ERR_OR_NULL(est)) | 780 | if (IS_ERR_OR_NULL(est)) |
| @@ -786,6 +784,14 @@ static int therm_est_probe(struct platform_device *pdev) | |||
| 786 | 784 | ||
| 787 | data = pdev->dev.platform_data; | 785 | data = pdev->dev.platform_data; |
| 788 | 786 | ||
| 787 | for (i = 0; i < data->ndevs; i++) { | ||
| 788 | thz = thermal_zone_device_find(data->devs[i].dev_data, | ||
| 789 | therm_est_subdev_match); | ||
| 790 | if (!thz) | ||
| 791 | goto err; | ||
| 792 | data->devs[i].sub_thz = thz; | ||
| 793 | } | ||
| 794 | |||
| 789 | est->devs = data->devs; | 795 | est->devs = data->devs; |
| 790 | est->ndevs = data->ndevs; | 796 | est->ndevs = data->ndevs; |
| 791 | est->toffset = data->toffset; | 797 | est->toffset = data->toffset; |
