2525#define DEBUGFS_IPC_FLOOD_COUNT "ipc_flood_count"
2626#define DEBUGFS_IPC_FLOOD_DURATION "ipc_flood_duration_ms"
2727
28- struct sof_ipc_client_data {
28+ struct sof_ipc_test_priv {
2929 struct dentry * dfs_root ;
3030 struct dentry * dfs_link [2 ];
3131 char * buf ;
3232};
3333
34- static int sof_ipc_dfsentry_open (struct inode * inode , struct file * file )
34+ static int sof_ipc_test_dfs_open (struct inode * inode , struct file * file )
3535{
3636 struct sof_client_dev * cdev = inode -> i_private ;
3737 int ret ;
@@ -59,7 +59,7 @@ static int sof_debug_ipc_flood_test(struct sof_client_dev *cdev,
5959 unsigned long ipc_duration_ms ,
6060 unsigned long ipc_count )
6161{
62- struct sof_ipc_client_data * ipc_client_data = cdev -> data ;
62+ struct sof_ipc_test_priv * priv = cdev -> data ;
6363 struct device * dev = & cdev -> auxdev .dev ;
6464 struct sof_ipc_cmd_hdr hdr ;
6565 struct sof_ipc_reply reply ;
@@ -108,7 +108,7 @@ static int sof_debug_ipc_flood_test(struct sof_client_dev *cdev,
108108 }
109109
110110 if (ret < 0 )
111- dev_err (dev , "error: ipc flood test failed at %d iterations\n" , i );
111+ dev_err (dev , "ipc flood test failed at %d iterations\n" , i );
112112
113113 /* return if the first IPC fails */
114114 if (!i )
@@ -118,26 +118,27 @@ static int sof_debug_ipc_flood_test(struct sof_client_dev *cdev,
118118 do_div (avg_response_time , i );
119119
120120 /* clear previous test output */
121- memset (ipc_client_data -> buf , 0 , IPC_FLOOD_TEST_RESULT_LEN );
121+ memset (priv -> buf , 0 , IPC_FLOOD_TEST_RESULT_LEN );
122122
123123 if (!ipc_count ) {
124124 dev_dbg (dev , "IPC Flood test duration: %lums\n" , ipc_duration_ms );
125- snprintf (ipc_client_data -> buf , IPC_FLOOD_TEST_RESULT_LEN ,
125+ snprintf (priv -> buf , IPC_FLOOD_TEST_RESULT_LEN ,
126126 "IPC Flood test duration: %lums\n" , ipc_duration_ms );
127127 }
128128
129- dev_dbg (dev ,
130- "IPC Flood count: %d, Avg response time: %lluns\n" , i , avg_response_time );
129+ dev_dbg (dev , "IPC Flood count: %d, Avg response time: %lluns\n" ,
130+ i , avg_response_time );
131131 dev_dbg (dev , "Max response time: %lluns\n" , max_response_time );
132132 dev_dbg (dev , "Min response time: %lluns\n" , min_response_time );
133133
134134 /* format output string and save test results */
135- snprintf (ipc_client_data -> buf + strlen (ipc_client_data -> buf ),
136- IPC_FLOOD_TEST_RESULT_LEN - strlen (ipc_client_data -> buf ),
137- "IPC Flood count: %d\nAvg response time: %lluns\n" , i , avg_response_time );
135+ snprintf (priv -> buf + strlen (priv -> buf ),
136+ IPC_FLOOD_TEST_RESULT_LEN - strlen (priv -> buf ),
137+ "IPC Flood count: %d\nAvg response time: %lluns\n" ,
138+ i , avg_response_time );
138139
139- snprintf (ipc_client_data -> buf + strlen (ipc_client_data -> buf ),
140- IPC_FLOOD_TEST_RESULT_LEN - strlen (ipc_client_data -> buf ),
140+ snprintf (priv -> buf + strlen (priv -> buf ),
141+ IPC_FLOOD_TEST_RESULT_LEN - strlen (priv -> buf ),
141142 "Max response time: %lluns\nMin response time: %lluns\n" ,
142143 max_response_time , min_response_time );
143144
@@ -148,7 +149,7 @@ static int sof_debug_ipc_flood_test(struct sof_client_dev *cdev,
148149 * Writing to the debugfs entry initiates the IPC flood test based on
149150 * the IPC count or the duration specified by the user.
150151 */
151- static ssize_t sof_ipc_dfsentry_write (struct file * file , const char __user * buffer ,
152+ static ssize_t sof_ipc_test_dfs_write (struct file * file , const char __user * buffer ,
152153 size_t count , loff_t * ppos )
153154{
154155 struct sof_client_dev * cdev = file -> private_data ;
@@ -216,9 +217,7 @@ static ssize_t sof_ipc_dfsentry_write(struct file *file, const char __user *buff
216217
217218 ret = pm_runtime_get_sync (dev );
218219 if (ret < 0 && ret != - EACCES ) {
219- dev_err_ratelimited (dev ,
220- "error: debugfs write failed to resume %d\n" ,
221- ret );
220+ dev_err_ratelimited (dev , "debugfs write failed to resume %d\n" , ret );
222221 pm_runtime_put_noidle (dev );
223222 goto out ;
224223 }
@@ -230,9 +229,7 @@ static ssize_t sof_ipc_dfsentry_write(struct file *file, const char __user *buff
230229 pm_runtime_mark_last_busy (dev );
231230 err = pm_runtime_put_autosuspend (dev );
232231 if (err < 0 )
233- dev_err_ratelimited (dev ,
234- "error: debugfs write failed to idle %d\n" ,
235- err );
232+ dev_err_ratelimited (dev , "debugfs write failed to idle %d\n" , err );
236233
237234 /* return size if test is successful */
238235 if (ret >= 0 )
@@ -243,11 +240,11 @@ static ssize_t sof_ipc_dfsentry_write(struct file *file, const char __user *buff
243240}
244241
245242/* return the result of the last IPC flood test */
246- static ssize_t sof_ipc_dfsentry_read (struct file * file , char __user * buffer ,
243+ static ssize_t sof_ipc_test_dfs_read (struct file * file , char __user * buffer ,
247244 size_t count , loff_t * ppos )
248245{
249246 struct sof_client_dev * cdev = file -> private_data ;
250- struct sof_ipc_client_data * ipc_client_data = cdev -> data ;
247+ struct sof_ipc_test_priv * priv = cdev -> data ;
251248 size_t size_ret ;
252249
253250 struct dentry * dentry ;
@@ -258,8 +255,8 @@ static ssize_t sof_ipc_dfsentry_read(struct file *file, char __user *buffer,
258255 if (* ppos )
259256 return 0 ;
260257
261- count = min_t (size_t , count , strlen (ipc_client_data -> buf ));
262- size_ret = copy_to_user (buffer , ipc_client_data -> buf , count );
258+ count = min_t (size_t , count , strlen (priv -> buf ));
259+ size_ret = copy_to_user (buffer , priv -> buf , count );
263260 if (size_ret )
264261 return - EFAULT ;
265262
@@ -269,19 +266,19 @@ static ssize_t sof_ipc_dfsentry_read(struct file *file, char __user *buffer,
269266 return count ;
270267}
271268
272- static int sof_ipc_dfsentry_release (struct inode * inode , struct file * file )
269+ static int sof_ipc_test_dfs_release (struct inode * inode , struct file * file )
273270{
274271 debugfs_file_put (file -> f_path .dentry );
275272
276273 return 0 ;
277274}
278275
279- static const struct file_operations sof_ipc_dfs_fops = {
280- .open = sof_ipc_dfsentry_open ,
281- .read = sof_ipc_dfsentry_read ,
276+ static const struct file_operations sof_ipc_test_fops = {
277+ .open = sof_ipc_test_dfs_open ,
278+ .read = sof_ipc_test_dfs_read ,
282279 .llseek = default_llseek ,
283- .write = sof_ipc_dfsentry_write ,
284- .release = sof_ipc_dfsentry_release ,
280+ .write = sof_ipc_test_dfs_write ,
281+ .release = sof_ipc_test_dfs_release ,
285282
286283 .owner = THIS_MODULE ,
287284};
@@ -299,30 +296,31 @@ static int sof_ipc_test_probe(struct auxiliary_device *auxdev,
299296 const struct auxiliary_device_id * id )
300297{
301298 struct sof_client_dev * cdev = auxiliary_dev_to_sof_client_dev (auxdev );
302- struct sof_ipc_client_data * ipc_client_data ;
303299 struct dentry * debugfs_root = sof_client_get_debugfs_root (cdev );
300+ struct sof_ipc_test_priv * priv ;
304301
305302 /* allocate memory for client data */
306- ipc_client_data = devm_kzalloc (& auxdev -> dev , sizeof (* ipc_client_data ), GFP_KERNEL );
307- if (!ipc_client_data )
303+ priv = devm_kzalloc (& auxdev -> dev , sizeof (* priv ), GFP_KERNEL );
304+ if (!priv )
308305 return - ENOMEM ;
309306
310- ipc_client_data -> buf = devm_kzalloc (& auxdev -> dev , IPC_FLOOD_TEST_RESULT_LEN , GFP_KERNEL );
311- if (!ipc_client_data -> buf )
307+ priv -> buf = devm_kzalloc (& auxdev -> dev , IPC_FLOOD_TEST_RESULT_LEN ,
308+ GFP_KERNEL );
309+ if (!priv -> buf )
312310 return - ENOMEM ;
313311
314- cdev -> data = ipc_client_data ;
312+ cdev -> data = priv ;
315313
316314 /* create debugfs root folder with device name under parent SOF dir */
317- ipc_client_data -> dfs_root = debugfs_create_dir (dev_name (& auxdev -> dev ), debugfs_root );
318- if (!IS_ERR_OR_NULL (ipc_client_data -> dfs_root )) {
315+ priv -> dfs_root = debugfs_create_dir (dev_name (& auxdev -> dev ), debugfs_root );
316+ if (!IS_ERR_OR_NULL (priv -> dfs_root )) {
319317 /* create read-write ipc_flood_count debugfs entry */
320- debugfs_create_file (DEBUGFS_IPC_FLOOD_COUNT , 0644 ,
321- ipc_client_data -> dfs_root , cdev , & sof_ipc_dfs_fops );
318+ debugfs_create_file (DEBUGFS_IPC_FLOOD_COUNT , 0644 , priv -> dfs_root ,
319+ cdev , & sof_ipc_test_fops );
322320
323321 /* create read-write ipc_flood_duration_ms debugfs entry */
324322 debugfs_create_file (DEBUGFS_IPC_FLOOD_DURATION , 0644 ,
325- ipc_client_data -> dfs_root , cdev , & sof_ipc_dfs_fops );
323+ priv -> dfs_root , cdev , & sof_ipc_test_fops );
326324
327325 if (auxdev -> id == 0 ) {
328326 /*
@@ -333,13 +331,13 @@ static int sof_ipc_test_probe(struct auxiliary_device *auxdev,
333331
334332 snprintf (target , 100 , "%s/" DEBUGFS_IPC_FLOOD_COUNT ,
335333 dev_name (& auxdev -> dev ));
336- ipc_client_data -> dfs_link [0 ] =
334+ priv -> dfs_link [0 ] =
337335 debugfs_create_symlink (DEBUGFS_IPC_FLOOD_COUNT ,
338336 debugfs_root , target );
339337
340338 snprintf (target , 100 , "%s/" DEBUGFS_IPC_FLOOD_DURATION ,
341339 dev_name (& auxdev -> dev ));
342- ipc_client_data -> dfs_link [1 ] =
340+ priv -> dfs_link [1 ] =
343341 debugfs_create_symlink (DEBUGFS_IPC_FLOOD_DURATION ,
344342 debugfs_root , target );
345343 }
@@ -358,16 +356,16 @@ static int sof_ipc_test_probe(struct auxiliary_device *auxdev,
358356static void sof_ipc_test_remove (struct auxiliary_device * auxdev )
359357{
360358 struct sof_client_dev * cdev = auxiliary_dev_to_sof_client_dev (auxdev );
361- struct sof_ipc_client_data * ipc_client_data = cdev -> data ;
359+ struct sof_ipc_test_priv * priv = cdev -> data ;
362360
363361 pm_runtime_disable (& auxdev -> dev );
364362
365363 if (auxdev -> id == 0 ) {
366- debugfs_remove (ipc_client_data -> dfs_link [0 ]);
367- debugfs_remove (ipc_client_data -> dfs_link [1 ]);
364+ debugfs_remove (priv -> dfs_link [0 ]);
365+ debugfs_remove (priv -> dfs_link [1 ]);
368366 }
369367
370- debugfs_remove_recursive (ipc_client_data -> dfs_root );
368+ debugfs_remove_recursive (priv -> dfs_root );
371369}
372370
373371static const struct auxiliary_device_id sof_ipc_test_client_id_table [] = {
0 commit comments