@@ -622,9 +622,50 @@ static void sysc_show_registers(struct sysc *ddata)
622
622
buf );
623
623
}
624
624
625
- static int __maybe_unused sysc_runtime_suspend (struct device * dev )
625
+ static int __maybe_unused sysc_runtime_suspend_legacy (struct device * dev ,
626
+ struct sysc * ddata )
627
+ {
628
+ struct ti_sysc_platform_data * pdata ;
629
+ int error ;
630
+
631
+ pdata = dev_get_platdata (ddata -> dev );
632
+ if (!pdata )
633
+ return 0 ;
634
+
635
+ if (!pdata -> idle_module )
636
+ return - ENODEV ;
637
+
638
+ error = pdata -> idle_module (dev , & ddata -> cookie );
639
+ if (error )
640
+ dev_err (dev , "%s: could not idle: %i\n" ,
641
+ __func__ , error );
642
+
643
+ return 0 ;
644
+ }
645
+
646
+ static int __maybe_unused sysc_runtime_resume_legacy (struct device * dev ,
647
+ struct sysc * ddata )
626
648
{
627
649
struct ti_sysc_platform_data * pdata ;
650
+ int error ;
651
+
652
+ pdata = dev_get_platdata (ddata -> dev );
653
+ if (!pdata )
654
+ return 0 ;
655
+
656
+ if (!pdata -> enable_module )
657
+ return - ENODEV ;
658
+
659
+ error = pdata -> enable_module (dev , & ddata -> cookie );
660
+ if (error )
661
+ dev_err (dev , "%s: could not enable: %i\n" ,
662
+ __func__ , error );
663
+
664
+ return 0 ;
665
+ }
666
+
667
+ static int __maybe_unused sysc_runtime_suspend (struct device * dev )
668
+ {
628
669
struct sysc * ddata ;
629
670
int error = 0 , i ;
630
671
@@ -634,19 +675,11 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev)
634
675
return 0 ;
635
676
636
677
if (ddata -> legacy_mode ) {
637
- pdata = dev_get_platdata (ddata -> dev );
638
- if (!pdata )
639
- return 0 ;
640
-
641
- if (!pdata -> idle_module )
642
- return - ENODEV ;
643
-
644
- error = pdata -> idle_module (dev , & ddata -> cookie );
645
- if (error )
646
- dev_err (dev , "%s: could not idle: %i\n" ,
647
- __func__ , error );
678
+ error = sysc_runtime_suspend_legacy (dev , ddata );
679
+ if (!error )
680
+ ddata -> enabled = false;
648
681
649
- goto idled ;
682
+ return error ;
650
683
}
651
684
652
685
for (i = 0 ; i < ddata -> nr_clocks ; i ++ ) {
@@ -659,15 +692,13 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev)
659
692
clk_disable (ddata -> clocks [i ]);
660
693
}
661
694
662
- idled :
663
695
ddata -> enabled = false;
664
696
665
697
return error ;
666
698
}
667
699
668
700
static int __maybe_unused sysc_runtime_resume (struct device * dev )
669
701
{
670
- struct ti_sysc_platform_data * pdata ;
671
702
struct sysc * ddata ;
672
703
int error = 0 , i ;
673
704
@@ -677,19 +708,11 @@ static int __maybe_unused sysc_runtime_resume(struct device *dev)
677
708
return 0 ;
678
709
679
710
if (ddata -> legacy_mode ) {
680
- pdata = dev_get_platdata ( ddata -> dev );
681
- if (!pdata )
682
- return 0 ;
711
+ error = sysc_runtime_resume_legacy ( dev , ddata );
712
+ if (!error )
713
+ ddata -> enabled = true ;
683
714
684
- if (!pdata -> enable_module )
685
- return - ENODEV ;
686
-
687
- error = pdata -> enable_module (dev , & ddata -> cookie );
688
- if (error )
689
- dev_err (dev , "%s: could not enable: %i\n" ,
690
- __func__ , error );
691
-
692
- goto awake ;
715
+ return error ;
693
716
}
694
717
695
718
for (i = 0 ; i < ddata -> nr_clocks ; i ++ ) {
@@ -704,7 +727,6 @@ static int __maybe_unused sysc_runtime_resume(struct device *dev)
704
727
return error ;
705
728
}
706
729
707
- awake :
708
730
ddata -> enabled = true;
709
731
710
732
return error ;
0 commit comments