Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pm-for-3.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael J. Wysocki:
"Three ACPI device power management fixes related to checking and
setting device power states."

* tag 'pm-for-3.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
ACPI / PM: Use KERN_DEBUG when no power resources are found
ACPI / PM: Fix resource_lock dead lock in acpi_power_on_device
ACPI / PM: Infer parent power state from child if unknown, v2

+34 -12
+10
drivers/acpi/bus.c
··· 237 237 } else if (result == ACPI_STATE_D3_HOT) { 238 238 result = ACPI_STATE_D3; 239 239 } 240 + 241 + /* 242 + * If we were unsure about the device parent's power state up to this 243 + * point, the fact that the device is in D0 implies that the parent has 244 + * to be in D0 too. 245 + */ 246 + if (device->parent && device->parent->power.state == ACPI_STATE_UNKNOWN 247 + && result == ACPI_STATE_D0) 248 + device->parent->power.state = ACPI_STATE_D0; 249 + 240 250 *state = result; 241 251 242 252 out:
+24 -12
drivers/acpi/power.c
··· 107 107 108 108 /* List of devices relying on this power resource */ 109 109 struct acpi_power_resource_device *devices; 110 + struct mutex devices_lock; 110 111 }; 111 112 112 113 static struct list_head acpi_power_resource_list; ··· 226 225 227 226 static int __acpi_power_on(struct acpi_power_resource *resource) 228 227 { 229 - struct acpi_power_resource_device *device_list = resource->devices; 230 228 acpi_status status = AE_OK; 231 229 232 230 status = acpi_evaluate_object(resource->device->handle, "_ON", NULL, NULL); ··· 238 238 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Power resource [%s] turned on\n", 239 239 resource->name)); 240 240 241 - while (device_list) { 242 - acpi_power_on_device(device_list->device); 243 - 244 - device_list = device_list->next; 245 - } 246 - 247 241 return 0; 248 242 } 249 243 250 244 static int acpi_power_on(acpi_handle handle) 251 245 { 252 246 int result = 0; 247 + bool resume_device = false; 253 248 struct acpi_power_resource *resource = NULL; 249 + struct acpi_power_resource_device *device_list; 254 250 255 251 result = acpi_power_get_context(handle, &resource); 256 252 if (result) ··· 262 266 result = __acpi_power_on(resource); 263 267 if (result) 264 268 resource->ref_count--; 269 + else 270 + resume_device = true; 265 271 } 266 272 267 273 mutex_unlock(&resource->resource_lock); 274 + 275 + if (!resume_device) 276 + return result; 277 + 278 + mutex_lock(&resource->devices_lock); 279 + 280 + device_list = resource->devices; 281 + while (device_list) { 282 + acpi_power_on_device(device_list->device); 283 + device_list = device_list->next; 284 + } 285 + 286 + mutex_unlock(&resource->devices_lock); 268 287 269 288 return result; 270 289 } ··· 366 355 if (acpi_power_get_context(res_handle, &resource)) 367 356 return; 368 357 369 - mutex_lock(&resource->resource_lock); 358 + mutex_lock(&resource->devices_lock); 370 359 prev = NULL; 371 360 curr = resource->devices; 372 361 while (curr) { ··· 383 372 prev = curr; 384 373 curr = curr->next; 385 374 } 386 - mutex_unlock(&resource->resource_lock); 375 + mutex_unlock(&resource->devices_lock); 387 376 } 388 377 389 378 /* Unlink dev from all power resources in _PR0 */ ··· 425 414 426 415 power_resource_device->device = powered_device; 427 416 428 - mutex_lock(&resource->resource_lock); 417 + mutex_lock(&resource->devices_lock); 429 418 power_resource_device->next = resource->devices; 430 419 resource->devices = power_resource_device; 431 - mutex_unlock(&resource->resource_lock); 420 + mutex_unlock(&resource->devices_lock); 432 421 433 422 return 0; 434 423 } ··· 473 462 return ret; 474 463 475 464 no_power_resource: 476 - printk(KERN_WARNING PREFIX "Invalid Power Resource to register!"); 465 + printk(KERN_DEBUG PREFIX "Invalid Power Resource to register!"); 477 466 return -ENODEV; 478 467 } 479 468 EXPORT_SYMBOL_GPL(acpi_power_resource_register_device); ··· 732 721 733 722 resource->device = device; 734 723 mutex_init(&resource->resource_lock); 724 + mutex_init(&resource->devices_lock); 735 725 strcpy(resource->name, device->pnp.bus_id); 736 726 strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); 737 727 strcpy(acpi_device_class(device), ACPI_POWER_CLASS);