@@ -89,29 +89,25 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
8989 unsigned long cur_freq ;
9090 struct device * dev = & pfdev -> pdev -> dev ;
9191 struct devfreq * devfreq ;
92- struct opp_table * opp_table ;
9392 struct thermal_cooling_device * cooling ;
9493 struct panfrost_devfreq * pfdevfreq = & pfdev -> pfdevfreq ;
9594
96- opp_table = dev_pm_opp_set_regulators (dev , pfdev -> comp -> supply_names ,
97- pfdev -> comp -> num_supplies );
98- if (IS_ERR (opp_table )) {
99- ret = PTR_ERR (opp_table );
95+ ret = devm_pm_opp_set_regulators (dev , pfdev -> comp -> supply_names ,
96+ pfdev -> comp -> num_supplies );
97+ if (ret ) {
10098 /* Continue if the optional regulator is missing */
10199 if (ret != - ENODEV ) {
102100 DRM_DEV_ERROR (dev , "Couldn't set OPP regulators\n" );
103- goto err_fini ;
101+ return ret ;
104102 }
105- } else {
106- pfdevfreq -> regulators_opp_table = opp_table ;
107103 }
108104
109- ret = dev_pm_opp_of_add_table (dev );
105+ ret = devm_pm_opp_of_add_table (dev );
110106 if (ret ) {
111107 /* Optional, continue without devfreq */
112108 if (ret == - ENODEV )
113109 ret = 0 ;
114- goto err_fini ;
110+ return ret ;
115111 }
116112 pfdevfreq -> opp_of_table_added = true;
117113
@@ -122,10 +118,8 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
122118 cur_freq = clk_get_rate (pfdev -> clock );
123119
124120 opp = devfreq_recommended_opp (dev , & cur_freq , 0 );
125- if (IS_ERR (opp )) {
126- ret = PTR_ERR (opp );
127- goto err_fini ;
128- }
121+ if (IS_ERR (opp ))
122+ return PTR_ERR (opp );
129123
130124 panfrost_devfreq_profile .initial_freq = cur_freq ;
131125 dev_pm_opp_put (opp );
@@ -134,8 +128,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
134128 DEVFREQ_GOV_SIMPLE_ONDEMAND , NULL );
135129 if (IS_ERR (devfreq )) {
136130 DRM_DEV_ERROR (dev , "Couldn't initialize GPU devfreq\n" );
137- ret = PTR_ERR (devfreq );
138- goto err_fini ;
131+ return PTR_ERR (devfreq );
139132 }
140133 pfdevfreq -> devfreq = devfreq ;
141134
@@ -146,10 +139,6 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
146139 pfdevfreq -> cooling = cooling ;
147140
148141 return 0 ;
149-
150- err_fini :
151- panfrost_devfreq_fini (pfdev );
152- return ret ;
153142}
154143
155144void panfrost_devfreq_fini (struct panfrost_device * pfdev )
@@ -160,14 +149,6 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev)
160149 devfreq_cooling_unregister (pfdevfreq -> cooling );
161150 pfdevfreq -> cooling = NULL ;
162151 }
163-
164- if (pfdevfreq -> opp_of_table_added ) {
165- dev_pm_opp_of_remove_table (& pfdev -> pdev -> dev );
166- pfdevfreq -> opp_of_table_added = false;
167- }
168-
169- dev_pm_opp_put_regulators (pfdevfreq -> regulators_opp_table );
170- pfdevfreq -> regulators_opp_table = NULL ;
171152}
172153
173154void panfrost_devfreq_resume (struct panfrost_device * pfdev )
0 commit comments