@@ -35,7 +35,7 @@ void opp_debug_remove_one(struct dev_pm_opp *opp)
3535 debugfs_remove_recursive (opp -> dentry );
3636}
3737
38- static bool opp_debug_create_supplies (struct dev_pm_opp * opp ,
38+ static void opp_debug_create_supplies (struct dev_pm_opp * opp ,
3939 struct opp_table * opp_table ,
4040 struct dentry * pdentry )
4141{
@@ -50,30 +50,21 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp,
5050 /* Create per-opp directory */
5151 d = debugfs_create_dir (name , pdentry );
5252
53- if (! d )
54- return false ;
53+ debugfs_create_ulong ( "u_volt_target" , S_IRUGO , d ,
54+ & opp -> supplies [ i ]. u_volt ) ;
5555
56- if (!debugfs_create_ulong ("u_volt_target" , S_IRUGO , d ,
57- & opp -> supplies [i ].u_volt ))
58- return false;
56+ debugfs_create_ulong ("u_volt_min" , S_IRUGO , d ,
57+ & opp -> supplies [i ].u_volt_min );
5958
60- if (!debugfs_create_ulong ("u_volt_min" , S_IRUGO , d ,
61- & opp -> supplies [i ].u_volt_min ))
62- return false;
59+ debugfs_create_ulong ("u_volt_max" , S_IRUGO , d ,
60+ & opp -> supplies [i ].u_volt_max );
6361
64- if (!debugfs_create_ulong ("u_volt_max" , S_IRUGO , d ,
65- & opp -> supplies [i ].u_volt_max ))
66- return false;
67-
68- if (!debugfs_create_ulong ("u_amp" , S_IRUGO , d ,
69- & opp -> supplies [i ].u_amp ))
70- return false;
62+ debugfs_create_ulong ("u_amp" , S_IRUGO , d ,
63+ & opp -> supplies [i ].u_amp );
7164 }
72-
73- return true;
7465}
7566
76- int opp_debug_create_one (struct dev_pm_opp * opp , struct opp_table * opp_table )
67+ void opp_debug_create_one (struct dev_pm_opp * opp , struct opp_table * opp_table )
7768{
7869 struct dentry * pdentry = opp_table -> dentry ;
7970 struct dentry * d ;
@@ -95,40 +86,23 @@ int opp_debug_create_one(struct dev_pm_opp *opp, struct opp_table *opp_table)
9586
9687 /* Create per-opp directory */
9788 d = debugfs_create_dir (name , pdentry );
98- if (!d )
99- return - ENOMEM ;
100-
101- if (!debugfs_create_bool ("available" , S_IRUGO , d , & opp -> available ))
102- return - ENOMEM ;
103-
104- if (!debugfs_create_bool ("dynamic" , S_IRUGO , d , & opp -> dynamic ))
105- return - ENOMEM ;
106-
107- if (!debugfs_create_bool ("turbo" , S_IRUGO , d , & opp -> turbo ))
108- return - ENOMEM ;
109-
110- if (!debugfs_create_bool ("suspend" , S_IRUGO , d , & opp -> suspend ))
111- return - ENOMEM ;
112-
113- if (!debugfs_create_u32 ("performance_state" , S_IRUGO , d , & opp -> pstate ))
114- return - ENOMEM ;
11589
116- if (!debugfs_create_ulong ("rate_hz" , S_IRUGO , d , & opp -> rate ))
117- return - ENOMEM ;
90+ debugfs_create_bool ("available" , S_IRUGO , d , & opp -> available );
91+ debugfs_create_bool ("dynamic" , S_IRUGO , d , & opp -> dynamic );
92+ debugfs_create_bool ("turbo" , S_IRUGO , d , & opp -> turbo );
93+ debugfs_create_bool ("suspend" , S_IRUGO , d , & opp -> suspend );
94+ debugfs_create_u32 ("performance_state" , S_IRUGO , d , & opp -> pstate );
95+ debugfs_create_ulong ("rate_hz" , S_IRUGO , d , & opp -> rate );
96+ debugfs_create_ulong ("clock_latency_ns" , S_IRUGO , d ,
97+ & opp -> clock_latency_ns );
11898
119- if (!opp_debug_create_supplies (opp , opp_table , d ))
120- return - ENOMEM ;
121-
122- if (!debugfs_create_ulong ("clock_latency_ns" , S_IRUGO , d ,
123- & opp -> clock_latency_ns ))
124- return - ENOMEM ;
99+ opp_debug_create_supplies (opp , opp_table , d );
125100
126101 opp -> dentry = d ;
127- return 0 ;
128102}
129103
130- static int opp_list_debug_create_dir (struct opp_device * opp_dev ,
131- struct opp_table * opp_table )
104+ static void opp_list_debug_create_dir (struct opp_device * opp_dev ,
105+ struct opp_table * opp_table )
132106{
133107 const struct device * dev = opp_dev -> dev ;
134108 struct dentry * d ;
@@ -137,36 +111,21 @@ static int opp_list_debug_create_dir(struct opp_device *opp_dev,
137111
138112 /* Create device specific directory */
139113 d = debugfs_create_dir (opp_table -> dentry_name , rootdir );
140- if (!d ) {
141- dev_err (dev , "%s: Failed to create debugfs dir\n" , __func__ );
142- return - ENOMEM ;
143- }
144114
145115 opp_dev -> dentry = d ;
146116 opp_table -> dentry = d ;
147-
148- return 0 ;
149117}
150118
151- static int opp_list_debug_create_link (struct opp_device * opp_dev ,
152- struct opp_table * opp_table )
119+ static void opp_list_debug_create_link (struct opp_device * opp_dev ,
120+ struct opp_table * opp_table )
153121{
154- const struct device * dev = opp_dev -> dev ;
155122 char name [NAME_MAX ];
156- struct dentry * d ;
157123
158124 opp_set_dev_name (opp_dev -> dev , name );
159125
160126 /* Create device specific directory link */
161- d = debugfs_create_symlink (name , rootdir , opp_table -> dentry_name );
162- if (!d ) {
163- dev_err (dev , "%s: Failed to create link\n" , __func__ );
164- return - ENOMEM ;
165- }
166-
167- opp_dev -> dentry = d ;
168-
169- return 0 ;
127+ opp_dev -> dentry = debugfs_create_symlink (name , rootdir ,
128+ opp_table -> dentry_name );
170129}
171130
172131/**
@@ -177,20 +136,13 @@ static int opp_list_debug_create_link(struct opp_device *opp_dev,
177136 * Dynamically adds device specific directory in debugfs 'opp' directory. If the
178137 * device-opp is shared with other devices, then links will be created for all
179138 * devices except the first.
180- *
181- * Return: 0 on success, otherwise negative error.
182139 */
183- int opp_debug_register (struct opp_device * opp_dev , struct opp_table * opp_table )
140+ void opp_debug_register (struct opp_device * opp_dev , struct opp_table * opp_table )
184141{
185- if (!rootdir ) {
186- pr_debug ("%s: Uninitialized rootdir\n" , __func__ );
187- return - EINVAL ;
188- }
189-
190142 if (opp_table -> dentry )
191- return opp_list_debug_create_link (opp_dev , opp_table );
192-
193- return opp_list_debug_create_dir (opp_dev , opp_table );
143+ opp_list_debug_create_link (opp_dev , opp_table );
144+ else
145+ opp_list_debug_create_dir (opp_dev , opp_table );
194146}
195147
196148static void opp_migrate_dentry (struct opp_device * opp_dev ,
@@ -252,10 +204,6 @@ static int __init opp_debug_init(void)
252204{
253205 /* Create /sys/kernel/debug/opp directory */
254206 rootdir = debugfs_create_dir ("opp" , NULL );
255- if (!rootdir ) {
256- pr_err ("%s: Failed to create root directory\n" , __func__ );
257- return - ENOMEM ;
258- }
259207
260208 return 0 ;
261209}
0 commit comments