diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/processor_thermal.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index 641b5450a0db..e8e652710e65 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c | |||
@@ -218,9 +218,13 @@ processor_get_max_state(struct thermal_cooling_device *cdev, | |||
218 | unsigned long *state) | 218 | unsigned long *state) |
219 | { | 219 | { |
220 | struct acpi_device *device = cdev->devdata; | 220 | struct acpi_device *device = cdev->devdata; |
221 | struct acpi_processor *pr = acpi_driver_data(device); | 221 | struct acpi_processor *pr; |
222 | 222 | ||
223 | if (!device || !pr) | 223 | if (!device) |
224 | return -EINVAL; | ||
225 | |||
226 | pr = acpi_driver_data(device); | ||
227 | if (!pr) | ||
224 | return -EINVAL; | 228 | return -EINVAL; |
225 | 229 | ||
226 | *state = acpi_processor_max_state(pr); | 230 | *state = acpi_processor_max_state(pr); |
@@ -232,9 +236,13 @@ processor_get_cur_state(struct thermal_cooling_device *cdev, | |||
232 | unsigned long *cur_state) | 236 | unsigned long *cur_state) |
233 | { | 237 | { |
234 | struct acpi_device *device = cdev->devdata; | 238 | struct acpi_device *device = cdev->devdata; |
235 | struct acpi_processor *pr = acpi_driver_data(device); | 239 | struct acpi_processor *pr; |
236 | 240 | ||
237 | if (!device || !pr) | 241 | if (!device) |
242 | return -EINVAL; | ||
243 | |||
244 | pr = acpi_driver_data(device); | ||
245 | if (!pr) | ||
238 | return -EINVAL; | 246 | return -EINVAL; |
239 | 247 | ||
240 | *cur_state = cpufreq_get_cur_state(pr->id); | 248 | *cur_state = cpufreq_get_cur_state(pr->id); |
@@ -248,11 +256,15 @@ processor_set_cur_state(struct thermal_cooling_device *cdev, | |||
248 | unsigned long state) | 256 | unsigned long state) |
249 | { | 257 | { |
250 | struct acpi_device *device = cdev->devdata; | 258 | struct acpi_device *device = cdev->devdata; |
251 | struct acpi_processor *pr = acpi_driver_data(device); | 259 | struct acpi_processor *pr; |
252 | int result = 0; | 260 | int result = 0; |
253 | int max_pstate; | 261 | int max_pstate; |
254 | 262 | ||
255 | if (!device || !pr) | 263 | if (!device) |
264 | return -EINVAL; | ||
265 | |||
266 | pr = acpi_driver_data(device); | ||
267 | if (!pr) | ||
256 | return -EINVAL; | 268 | return -EINVAL; |
257 | 269 | ||
258 | max_pstate = cpufreq_get_max_state(pr->id); | 270 | max_pstate = cpufreq_get_max_state(pr->id); |