@@ -48,7 +48,6 @@ struct acpi_power_dependent_device {
48
48
struct acpi_power_resource {
49
49
struct acpi_device device ;
50
50
struct list_head list_node ;
51
- char * name ;
52
51
u32 system_level ;
53
52
u32 order ;
54
53
unsigned int ref_count ;
@@ -70,6 +69,11 @@ static DEFINE_MUTEX(power_resource_list_lock);
70
69
Power Resource Management
71
70
-------------------------------------------------------------------------- */
72
71
72
+ static inline const char * resource_dev_name (struct acpi_power_resource * pr )
73
+ {
74
+ return dev_name (& pr -> device .dev );
75
+ }
76
+
73
77
static inline
74
78
struct acpi_power_resource * to_power_resource (struct acpi_device * device )
75
79
{
@@ -264,7 +268,8 @@ acpi_power_resource_add_dependent(struct acpi_power_resource *resource,
264
268
265
269
dep -> dev = dev ;
266
270
list_add_tail (& dep -> node , & resource -> dependents );
267
- dev_dbg (dev , "added power dependency to [%s]\n" , resource -> name );
271
+ dev_dbg (dev , "added power dependency to [%s]\n" ,
272
+ resource_dev_name (resource ));
268
273
269
274
unlock :
270
275
mutex_unlock (& resource -> resource_lock );
@@ -283,7 +288,7 @@ acpi_power_resource_remove_dependent(struct acpi_power_resource *resource,
283
288
list_del (& dep -> node );
284
289
kfree (dep );
285
290
dev_dbg (dev , "removed power dependency to [%s]\n" ,
286
- resource -> name );
291
+ resource_dev_name ( resource ) );
287
292
break ;
288
293
}
289
294
}
@@ -356,18 +361,19 @@ void acpi_device_power_remove_dependent(struct acpi_device *adev,
356
361
357
362
static int __acpi_power_on (struct acpi_power_resource * resource )
358
363
{
364
+ acpi_handle handle = resource -> device .handle ;
359
365
struct acpi_power_dependent_device * dep ;
360
366
acpi_status status = AE_OK ;
361
367
362
- status = acpi_evaluate_object (resource -> device . handle , "_ON" , NULL , NULL );
368
+ status = acpi_evaluate_object (handle , "_ON" , NULL , NULL );
363
369
if (ACPI_FAILURE (status )) {
364
370
resource -> state = ACPI_POWER_RESOURCE_STATE_UNKNOWN ;
365
371
return - ENODEV ;
366
372
}
367
373
368
374
resource -> state = ACPI_POWER_RESOURCE_STATE_ON ;
369
375
370
- pr_debug ( "Power resource [%s] turned on\n" , resource -> name );
376
+ acpi_handle_debug ( handle , "Power resource turned on\n" );
371
377
372
378
/*
373
379
* If there are other dependents on this power resource we need to
@@ -380,7 +386,7 @@ static int __acpi_power_on(struct acpi_power_resource *resource)
380
386
381
387
list_for_each_entry (dep , & resource -> dependents , node ) {
382
388
dev_dbg (dep -> dev , "runtime resuming because [%s] turned on\n" ,
383
- resource -> name );
389
+ resource_dev_name ( resource ) );
384
390
pm_request_resume (dep -> dev );
385
391
}
386
392
@@ -392,7 +398,8 @@ static int acpi_power_on_unlocked(struct acpi_power_resource *resource)
392
398
int result = 0 ;
393
399
394
400
if (resource -> ref_count ++ ) {
395
- pr_debug ("Power resource [%s] already on\n" , resource -> name );
401
+ acpi_handle_debug (resource -> device .handle ,
402
+ "Power resource already on\n" );
396
403
} else {
397
404
result = __acpi_power_on (resource );
398
405
if (result )
@@ -413,18 +420,18 @@ static int acpi_power_on(struct acpi_power_resource *resource)
413
420
414
421
static int __acpi_power_off (struct acpi_power_resource * resource )
415
422
{
423
+ acpi_handle handle = resource -> device .handle ;
416
424
acpi_status status ;
417
425
418
- status = acpi_evaluate_object (resource -> device .handle , "_OFF" ,
419
- NULL , NULL );
426
+ status = acpi_evaluate_object (handle , "_OFF" , NULL , NULL );
420
427
if (ACPI_FAILURE (status )) {
421
428
resource -> state = ACPI_POWER_RESOURCE_STATE_UNKNOWN ;
422
429
return - ENODEV ;
423
430
}
424
431
425
432
resource -> state = ACPI_POWER_RESOURCE_STATE_OFF ;
426
433
427
- pr_debug ( "Power resource [%s] turned off\n" , resource -> name );
434
+ acpi_handle_debug ( handle , "Power resource turned off\n" );
428
435
429
436
return 0 ;
430
437
}
@@ -434,12 +441,14 @@ static int acpi_power_off_unlocked(struct acpi_power_resource *resource)
434
441
int result = 0 ;
435
442
436
443
if (!resource -> ref_count ) {
437
- pr_debug ("Power resource [%s] already off\n" , resource -> name );
444
+ acpi_handle_debug (resource -> device .handle ,
445
+ "Power resource already off\n" );
438
446
return 0 ;
439
447
}
440
448
441
449
if (-- resource -> ref_count ) {
442
- pr_debug ("Power resource [%s] still in use\n" , resource -> name );
450
+ acpi_handle_debug (resource -> device .handle ,
451
+ "Power resource still in use\n" );
443
452
} else {
444
453
result = __acpi_power_off (resource );
445
454
if (result )
@@ -949,7 +958,6 @@ struct acpi_device *acpi_add_power_resource(acpi_handle handle)
949
958
mutex_init (& resource -> resource_lock );
950
959
INIT_LIST_HEAD (& resource -> list_node );
951
960
INIT_LIST_HEAD (& resource -> dependents );
952
- resource -> name = device -> pnp .bus_id ;
953
961
strcpy (acpi_device_name (device ), ACPI_POWER_DEVICE_NAME );
954
962
strcpy (acpi_device_class (device ), ACPI_POWER_CLASS );
955
963
device -> power .state = ACPI_STATE_UNKNOWN ;
@@ -1004,7 +1012,7 @@ void acpi_resume_power_resources(void)
1004
1012
1005
1013
if (state == ACPI_POWER_RESOURCE_STATE_OFF
1006
1014
&& resource -> ref_count ) {
1007
- dev_dbg ( & resource -> device .dev , "Turning ON\n" );
1015
+ acpi_handle_debug ( resource -> device .handle , "Turning ON\n" );
1008
1016
__acpi_power_on (resource );
1009
1017
}
1010
1018
@@ -1034,7 +1042,7 @@ void acpi_turn_off_unused_power_resources(void)
1034
1042
*/
1035
1043
if (!resource -> ref_count &&
1036
1044
resource -> state != ACPI_POWER_RESOURCE_STATE_OFF ) {
1037
- dev_dbg ( & resource -> device .dev , "Turning OFF\n" );
1045
+ acpi_handle_debug ( resource -> device .handle , "Turning OFF\n" );
1038
1046
__acpi_power_off (resource );
1039
1047
}
1040
1048
0 commit comments