@@ -300,16 +300,15 @@ static int core_get_v1(struct venus_core *core)
300
300
if (ret )
301
301
return ret ;
302
302
303
- core -> opp_table = dev_pm_opp_set_clkname (core -> dev , "core" );
304
- if (IS_ERR ( core -> opp_table ) )
305
- return PTR_ERR ( core -> opp_table ) ;
303
+ ret = devm_pm_opp_set_clkname (core -> dev , "core" );
304
+ if (ret )
305
+ return ret ;
306
306
307
307
return 0 ;
308
308
}
309
309
310
310
static void core_put_v1 (struct venus_core * core )
311
311
{
312
- dev_pm_opp_put_clkname (core -> opp_table );
313
312
}
314
313
315
314
static int core_power_v1 (struct venus_core * core , int on )
@@ -788,7 +787,6 @@ static int venc_power_v4(struct device *dev, int on)
788
787
static int vcodec_domains_get (struct venus_core * core )
789
788
{
790
789
int ret ;
791
- struct opp_table * opp_table ;
792
790
struct device * * opp_virt_dev ;
793
791
struct device * dev = core -> dev ;
794
792
const struct venus_resources * res = core -> res ;
@@ -811,11 +809,9 @@ static int vcodec_domains_get(struct venus_core *core)
811
809
return 0 ;
812
810
813
811
/* Attach the power domain for setting performance state */
814
- opp_table = dev_pm_opp_attach_genpd (dev , res -> opp_pmdomain , & opp_virt_dev );
815
- if (IS_ERR (opp_table )) {
816
- ret = PTR_ERR (opp_table );
812
+ ret = devm_pm_opp_attach_genpd (dev , res -> opp_pmdomain , & opp_virt_dev );
813
+ if (ret )
817
814
goto opp_attach_err ;
818
- }
819
815
820
816
core -> opp_pmdomain = * opp_virt_dev ;
821
817
core -> opp_dl_venus = device_link_add (dev , core -> opp_pmdomain ,
@@ -824,13 +820,11 @@ static int vcodec_domains_get(struct venus_core *core)
824
820
DL_FLAG_STATELESS );
825
821
if (!core -> opp_dl_venus ) {
826
822
ret = - ENODEV ;
827
- goto opp_dl_add_err ;
823
+ goto opp_attach_err ;
828
824
}
829
825
830
826
return 0 ;
831
827
832
- opp_dl_add_err :
833
- dev_pm_opp_detach_genpd (core -> opp_table );
834
828
opp_attach_err :
835
829
for (i = 0 ; i < res -> vcodec_pmdomains_num ; i ++ ) {
836
830
if (IS_ERR_OR_NULL (core -> pmdomains [i ]))
@@ -861,8 +855,6 @@ static void vcodec_domains_put(struct venus_core *core)
861
855
862
856
if (core -> opp_dl_venus )
863
857
device_link_del (core -> opp_dl_venus );
864
-
865
- dev_pm_opp_detach_genpd (core -> opp_table );
866
858
}
867
859
868
860
static int core_resets_reset (struct venus_core * core )
@@ -941,45 +933,33 @@ static int core_get_v4(struct venus_core *core)
941
933
if (legacy_binding )
942
934
return 0 ;
943
935
944
- core -> opp_table = dev_pm_opp_set_clkname (dev , "core" );
945
- if (IS_ERR ( core -> opp_table ) )
946
- return PTR_ERR ( core -> opp_table ) ;
936
+ ret = devm_pm_opp_set_clkname (dev , "core" );
937
+ if (ret )
938
+ return ret ;
947
939
948
940
if (core -> res -> opp_pmdomain ) {
949
- ret = dev_pm_opp_of_add_table (dev );
941
+ ret = devm_pm_opp_of_add_table (dev );
950
942
if (!ret ) {
951
943
core -> has_opp_table = true;
952
944
} else if (ret != - ENODEV ) {
953
945
dev_err (dev , "invalid OPP table in device tree\n" );
954
- dev_pm_opp_put_clkname (core -> opp_table );
955
946
return ret ;
956
947
}
957
948
}
958
949
959
950
ret = vcodec_domains_get (core );
960
- if (ret ) {
961
- if (core -> has_opp_table )
962
- dev_pm_opp_of_remove_table (dev );
963
- dev_pm_opp_put_clkname (core -> opp_table );
951
+ if (ret )
964
952
return ret ;
965
- }
966
953
967
954
return 0 ;
968
955
}
969
956
970
957
static void core_put_v4 (struct venus_core * core )
971
958
{
972
- struct device * dev = core -> dev ;
973
-
974
959
if (legacy_binding )
975
960
return ;
976
961
977
962
vcodec_domains_put (core );
978
-
979
- if (core -> has_opp_table )
980
- dev_pm_opp_of_remove_table (dev );
981
- dev_pm_opp_put_clkname (core -> opp_table );
982
-
983
963
}
984
964
985
965
static int core_power_v4 (struct venus_core * core , int on )
0 commit comments