@@ -573,43 +573,6 @@ bool dev_pm_may_skip_resume(struct device *dev)
573
573
return !dev -> power .must_resume && pm_transition .event != PM_EVENT_RESTORE ;
574
574
}
575
575
576
- static pm_callback_t dpm_subsys_resume_noirq_cb (struct device * dev ,
577
- pm_message_t state ,
578
- const char * * info_p )
579
- {
580
- pm_callback_t callback ;
581
- const char * info ;
582
-
583
- if (dev -> pm_domain ) {
584
- info = "noirq power domain " ;
585
- callback = pm_noirq_op (& dev -> pm_domain -> ops , state );
586
- } else if (dev -> type && dev -> type -> pm ) {
587
- info = "noirq type " ;
588
- callback = pm_noirq_op (dev -> type -> pm , state );
589
- } else if (dev -> class && dev -> class -> pm ) {
590
- info = "noirq class " ;
591
- callback = pm_noirq_op (dev -> class -> pm , state );
592
- } else if (dev -> bus && dev -> bus -> pm ) {
593
- info = "noirq bus " ;
594
- callback = pm_noirq_op (dev -> bus -> pm , state );
595
- } else {
596
- return NULL ;
597
- }
598
-
599
- if (info_p )
600
- * info_p = info ;
601
-
602
- return callback ;
603
- }
604
-
605
- static pm_callback_t dpm_subsys_suspend_noirq_cb (struct device * dev ,
606
- pm_message_t state ,
607
- const char * * info_p );
608
-
609
- static pm_callback_t dpm_subsys_suspend_late_cb (struct device * dev ,
610
- pm_message_t state ,
611
- const char * * info_p );
612
-
613
576
/**
614
577
* device_resume_noirq - Execute a "noirq resume" callback for given device.
615
578
* @dev: Device to handle.
@@ -621,8 +584,8 @@ static pm_callback_t dpm_subsys_suspend_late_cb(struct device *dev,
621
584
*/
622
585
static int device_resume_noirq (struct device * dev , pm_message_t state , bool async )
623
586
{
624
- pm_callback_t callback ;
625
- const char * info ;
587
+ pm_callback_t callback = NULL ;
588
+ const char * info = NULL ;
626
589
bool skip_resume ;
627
590
int error = 0 ;
628
591
@@ -638,7 +601,19 @@ static int device_resume_noirq(struct device *dev, pm_message_t state, bool asyn
638
601
if (!dpm_wait_for_superior (dev , async ))
639
602
goto Out ;
640
603
641
- callback = dpm_subsys_resume_noirq_cb (dev , state , & info );
604
+ if (dev -> pm_domain ) {
605
+ info = "noirq power domain " ;
606
+ callback = pm_noirq_op (& dev -> pm_domain -> ops , state );
607
+ } else if (dev -> type && dev -> type -> pm ) {
608
+ info = "noirq type " ;
609
+ callback = pm_noirq_op (dev -> type -> pm , state );
610
+ } else if (dev -> class && dev -> class -> pm ) {
611
+ info = "noirq class " ;
612
+ callback = pm_noirq_op (dev -> class -> pm , state );
613
+ } else if (dev -> bus && dev -> bus -> pm ) {
614
+ info = "noirq bus " ;
615
+ callback = pm_noirq_op (dev -> bus -> pm , state );
616
+ }
642
617
if (callback ) {
643
618
skip_resume = false;
644
619
goto Run ;
@@ -791,35 +766,6 @@ void dpm_resume_noirq(pm_message_t state)
791
766
cpuidle_resume ();
792
767
}
793
768
794
- static pm_callback_t dpm_subsys_resume_early_cb (struct device * dev ,
795
- pm_message_t state ,
796
- const char * * info_p )
797
- {
798
- pm_callback_t callback ;
799
- const char * info ;
800
-
801
- if (dev -> pm_domain ) {
802
- info = "early power domain " ;
803
- callback = pm_late_early_op (& dev -> pm_domain -> ops , state );
804
- } else if (dev -> type && dev -> type -> pm ) {
805
- info = "early type " ;
806
- callback = pm_late_early_op (dev -> type -> pm , state );
807
- } else if (dev -> class && dev -> class -> pm ) {
808
- info = "early class " ;
809
- callback = pm_late_early_op (dev -> class -> pm , state );
810
- } else if (dev -> bus && dev -> bus -> pm ) {
811
- info = "early bus " ;
812
- callback = pm_late_early_op (dev -> bus -> pm , state );
813
- } else {
814
- return NULL ;
815
- }
816
-
817
- if (info_p )
818
- * info_p = info ;
819
-
820
- return callback ;
821
- }
822
-
823
769
/**
824
770
* device_resume_early - Execute an "early resume" callback for given device.
825
771
* @dev: Device to handle.
@@ -830,8 +776,8 @@ static pm_callback_t dpm_subsys_resume_early_cb(struct device *dev,
830
776
*/
831
777
static int device_resume_early (struct device * dev , pm_message_t state , bool async )
832
778
{
833
- pm_callback_t callback ;
834
- const char * info ;
779
+ pm_callback_t callback = NULL ;
780
+ const char * info = NULL ;
835
781
int error = 0 ;
836
782
837
783
TRACE_DEVICE (dev );
@@ -846,9 +792,19 @@ static int device_resume_early(struct device *dev, pm_message_t state, bool asyn
846
792
if (!dpm_wait_for_superior (dev , async ))
847
793
goto Out ;
848
794
849
- callback = dpm_subsys_resume_early_cb (dev , state , & info );
850
-
851
- if (!callback && dev -> driver && dev -> driver -> pm ) {
795
+ if (dev -> pm_domain ) {
796
+ info = "early power domain " ;
797
+ callback = pm_late_early_op (& dev -> pm_domain -> ops , state );
798
+ } else if (dev -> type && dev -> type -> pm ) {
799
+ info = "early type " ;
800
+ callback = pm_late_early_op (dev -> type -> pm , state );
801
+ } else if (dev -> class && dev -> class -> pm ) {
802
+ info = "early class " ;
803
+ callback = pm_late_early_op (dev -> class -> pm , state );
804
+ } else if (dev -> bus && dev -> bus -> pm ) {
805
+ info = "early bus " ;
806
+ callback = pm_late_early_op (dev -> bus -> pm , state );
807
+ } else if (dev -> driver && dev -> driver -> pm ) {
852
808
info = "early driver " ;
853
809
callback = pm_late_early_op (dev -> driver -> pm , state );
854
810
}
@@ -1226,35 +1182,6 @@ static void dpm_superior_set_must_resume(struct device *dev)
1226
1182
device_links_read_unlock (idx );
1227
1183
}
1228
1184
1229
- static pm_callback_t dpm_subsys_suspend_noirq_cb (struct device * dev ,
1230
- pm_message_t state ,
1231
- const char * * info_p )
1232
- {
1233
- pm_callback_t callback ;
1234
- const char * info ;
1235
-
1236
- if (dev -> pm_domain ) {
1237
- info = "noirq power domain " ;
1238
- callback = pm_noirq_op (& dev -> pm_domain -> ops , state );
1239
- } else if (dev -> type && dev -> type -> pm ) {
1240
- info = "noirq type " ;
1241
- callback = pm_noirq_op (dev -> type -> pm , state );
1242
- } else if (dev -> class && dev -> class -> pm ) {
1243
- info = "noirq class " ;
1244
- callback = pm_noirq_op (dev -> class -> pm , state );
1245
- } else if (dev -> bus && dev -> bus -> pm ) {
1246
- info = "noirq bus " ;
1247
- callback = pm_noirq_op (dev -> bus -> pm , state );
1248
- } else {
1249
- return NULL ;
1250
- }
1251
-
1252
- if (info_p )
1253
- * info_p = info ;
1254
-
1255
- return callback ;
1256
- }
1257
-
1258
1185
/**
1259
1186
* __device_suspend_noirq - Execute a "noirq suspend" callback for given device.
1260
1187
* @dev: Device to handle.
@@ -1266,8 +1193,8 @@ static pm_callback_t dpm_subsys_suspend_noirq_cb(struct device *dev,
1266
1193
*/
1267
1194
static int __device_suspend_noirq (struct device * dev , pm_message_t state , bool async )
1268
1195
{
1269
- pm_callback_t callback ;
1270
- const char * info ;
1196
+ pm_callback_t callback = NULL ;
1197
+ const char * info = NULL ;
1271
1198
int error = 0 ;
1272
1199
1273
1200
TRACE_DEVICE (dev );
@@ -1281,7 +1208,19 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool a
1281
1208
if (dev -> power .syscore || dev -> power .direct_complete )
1282
1209
goto Complete ;
1283
1210
1284
- callback = dpm_subsys_suspend_noirq_cb (dev , state , & info );
1211
+ if (dev -> pm_domain ) {
1212
+ info = "noirq power domain " ;
1213
+ callback = pm_noirq_op (& dev -> pm_domain -> ops , state );
1214
+ } else if (dev -> type && dev -> type -> pm ) {
1215
+ info = "noirq type " ;
1216
+ callback = pm_noirq_op (dev -> type -> pm , state );
1217
+ } else if (dev -> class && dev -> class -> pm ) {
1218
+ info = "noirq class " ;
1219
+ callback = pm_noirq_op (dev -> class -> pm , state );
1220
+ } else if (dev -> bus && dev -> bus -> pm ) {
1221
+ info = "noirq bus " ;
1222
+ callback = pm_noirq_op (dev -> bus -> pm , state );
1223
+ }
1285
1224
if (callback )
1286
1225
goto Run ;
1287
1226
@@ -1429,35 +1368,6 @@ static void dpm_propagate_wakeup_to_parent(struct device *dev)
1429
1368
spin_unlock_irq (& parent -> power .lock );
1430
1369
}
1431
1370
1432
- static pm_callback_t dpm_subsys_suspend_late_cb (struct device * dev ,
1433
- pm_message_t state ,
1434
- const char * * info_p )
1435
- {
1436
- pm_callback_t callback ;
1437
- const char * info ;
1438
-
1439
- if (dev -> pm_domain ) {
1440
- info = "late power domain " ;
1441
- callback = pm_late_early_op (& dev -> pm_domain -> ops , state );
1442
- } else if (dev -> type && dev -> type -> pm ) {
1443
- info = "late type " ;
1444
- callback = pm_late_early_op (dev -> type -> pm , state );
1445
- } else if (dev -> class && dev -> class -> pm ) {
1446
- info = "late class " ;
1447
- callback = pm_late_early_op (dev -> class -> pm , state );
1448
- } else if (dev -> bus && dev -> bus -> pm ) {
1449
- info = "late bus " ;
1450
- callback = pm_late_early_op (dev -> bus -> pm , state );
1451
- } else {
1452
- return NULL ;
1453
- }
1454
-
1455
- if (info_p )
1456
- * info_p = info ;
1457
-
1458
- return callback ;
1459
- }
1460
-
1461
1371
/**
1462
1372
* __device_suspend_late - Execute a "late suspend" callback for given device.
1463
1373
* @dev: Device to handle.
@@ -1468,8 +1378,8 @@ static pm_callback_t dpm_subsys_suspend_late_cb(struct device *dev,
1468
1378
*/
1469
1379
static int __device_suspend_late (struct device * dev , pm_message_t state , bool async )
1470
1380
{
1471
- pm_callback_t callback ;
1472
- const char * info ;
1381
+ pm_callback_t callback = NULL ;
1382
+ const char * info = NULL ;
1473
1383
int error = 0 ;
1474
1384
1475
1385
TRACE_DEVICE (dev );
@@ -1490,7 +1400,19 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool as
1490
1400
if (dev -> power .syscore || dev -> power .direct_complete )
1491
1401
goto Complete ;
1492
1402
1493
- callback = dpm_subsys_suspend_late_cb (dev , state , & info );
1403
+ if (dev -> pm_domain ) {
1404
+ info = "late power domain " ;
1405
+ callback = pm_late_early_op (& dev -> pm_domain -> ops , state );
1406
+ } else if (dev -> type && dev -> type -> pm ) {
1407
+ info = "late type " ;
1408
+ callback = pm_late_early_op (dev -> type -> pm , state );
1409
+ } else if (dev -> class && dev -> class -> pm ) {
1410
+ info = "late class " ;
1411
+ callback = pm_late_early_op (dev -> class -> pm , state );
1412
+ } else if (dev -> bus && dev -> bus -> pm ) {
1413
+ info = "late bus " ;
1414
+ callback = pm_late_early_op (dev -> bus -> pm , state );
1415
+ }
1494
1416
if (callback )
1495
1417
goto Run ;
1496
1418
0 commit comments