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 ;
3737 int ret ;
@@ -66,7 +66,7 @@ static int sof_debug_ipc_flood_test(struct sof_client_dev *cdev,
6666 unsigned long ipc_duration_ms ,
6767 unsigned long ipc_count )
6868{
69- struct sof_ipc_client_data * ipc_client_data = cdev -> data ;
69+ struct sof_ipc_test_priv * priv = cdev -> data ;
7070 struct device * dev = & cdev -> auxdev .dev ;
7171 struct sof_ipc_cmd_hdr hdr ;
7272 struct sof_ipc_reply reply ;
@@ -115,7 +115,7 @@ static int sof_debug_ipc_flood_test(struct sof_client_dev *cdev,
115115 }
116116
117117 if (ret < 0 )
118- dev_err (dev , "error: ipc flood test failed at %d iterations\n" , i );
118+ dev_err (dev , "ipc flood test failed at %d iterations\n" , i );
119119
120120 /* return if the first IPC fails */
121121 if (!i )
@@ -125,26 +125,27 @@ static int sof_debug_ipc_flood_test(struct sof_client_dev *cdev,
125125 do_div (avg_response_time , i );
126126
127127 /* clear previous test output */
128- memset (ipc_client_data -> buf , 0 , IPC_FLOOD_TEST_RESULT_LEN );
128+ memset (priv -> buf , 0 , IPC_FLOOD_TEST_RESULT_LEN );
129129
130130 if (!ipc_count ) {
131131 dev_dbg (dev , "IPC Flood test duration: %lums\n" , ipc_duration_ms );
132- snprintf (ipc_client_data -> buf , IPC_FLOOD_TEST_RESULT_LEN ,
132+ snprintf (priv -> buf , IPC_FLOOD_TEST_RESULT_LEN ,
133133 "IPC Flood test duration: %lums\n" , ipc_duration_ms );
134134 }
135135
136- dev_dbg (dev ,
137- "IPC Flood count: %d, Avg response time: %lluns\n" , i , avg_response_time );
136+ dev_dbg (dev , "IPC Flood count: %d, Avg response time: %lluns\n" ,
137+ i , avg_response_time );
138138 dev_dbg (dev , "Max response time: %lluns\n" , max_response_time );
139139 dev_dbg (dev , "Min response time: %lluns\n" , min_response_time );
140140
141141 /* format output string and save test results */
142- snprintf (ipc_client_data -> buf + strlen (ipc_client_data -> buf ),
143- IPC_FLOOD_TEST_RESULT_LEN - strlen (ipc_client_data -> buf ),
144- "IPC Flood count: %d\nAvg response time: %lluns\n" , i , avg_response_time );
142+ snprintf (priv -> buf + strlen (priv -> buf ),
143+ IPC_FLOOD_TEST_RESULT_LEN - strlen (priv -> buf ),
144+ "IPC Flood count: %d\nAvg response time: %lluns\n" ,
145+ i , avg_response_time );
145146
146- snprintf (ipc_client_data -> buf + strlen (ipc_client_data -> buf ),
147- IPC_FLOOD_TEST_RESULT_LEN - strlen (ipc_client_data -> buf ),
147+ snprintf (priv -> buf + strlen (priv -> buf ),
148+ IPC_FLOOD_TEST_RESULT_LEN - strlen (priv -> buf ),
148149 "Max response time: %lluns\nMin response time: %lluns\n" ,
149150 max_response_time , min_response_time );
150151
@@ -155,7 +156,7 @@ static int sof_debug_ipc_flood_test(struct sof_client_dev *cdev,
155156 * Writing to the debugfs entry initiates the IPC flood test based on
156157 * the IPC count or the duration specified by the user.
157158 */
158- static ssize_t sof_ipc_dfsentry_write (struct file * file , const char __user * buffer ,
159+ static ssize_t sof_ipc_test_dfs_write (struct file * file , const char __user * buffer ,
159160 size_t count , loff_t * ppos )
160161{
161162 struct sof_client_dev * cdev = file -> private_data ;
@@ -223,9 +224,7 @@ static ssize_t sof_ipc_dfsentry_write(struct file *file, const char __user *buff
223224
224225 ret = pm_runtime_get_sync (dev );
225226 if (ret < 0 && ret != - EACCES ) {
226- dev_err_ratelimited (dev ,
227- "error: debugfs write failed to resume %d\n" ,
228- ret );
227+ dev_err_ratelimited (dev , "debugfs write failed to resume %d\n" , ret );
229228 pm_runtime_put_noidle (dev );
230229 goto out ;
231230 }
@@ -237,9 +236,7 @@ static ssize_t sof_ipc_dfsentry_write(struct file *file, const char __user *buff
237236 pm_runtime_mark_last_busy (dev );
238237 err = pm_runtime_put_autosuspend (dev );
239238 if (err < 0 )
240- dev_err_ratelimited (dev ,
241- "error: debugfs write failed to idle %d\n" ,
242- err );
239+ dev_err_ratelimited (dev , "debugfs write failed to idle %d\n" , err );
243240
244241 /* return size if test is successful */
245242 if (ret >= 0 )
@@ -250,11 +247,11 @@ static ssize_t sof_ipc_dfsentry_write(struct file *file, const char __user *buff
250247}
251248
252249/* return the result of the last IPC flood test */
253- static ssize_t sof_ipc_dfsentry_read (struct file * file , char __user * buffer ,
250+ static ssize_t sof_ipc_test_dfs_read (struct file * file , char __user * buffer ,
254251 size_t count , loff_t * ppos )
255252{
256253 struct sof_client_dev * cdev = file -> private_data ;
257- struct sof_ipc_client_data * ipc_client_data = cdev -> data ;
254+ struct sof_ipc_test_priv * priv = cdev -> data ;
258255 size_t size_ret ;
259256
260257 struct dentry * dentry ;
@@ -265,8 +262,8 @@ static ssize_t sof_ipc_dfsentry_read(struct file *file, char __user *buffer,
265262 if (* ppos )
266263 return 0 ;
267264
268- count = min_t (size_t , count , strlen (ipc_client_data -> buf ));
269- size_ret = copy_to_user (buffer , ipc_client_data -> buf , count );
265+ count = min_t (size_t , count , strlen (priv -> buf ));
266+ size_ret = copy_to_user (buffer , priv -> buf , count );
270267 if (size_ret )
271268 return - EFAULT ;
272269
@@ -276,7 +273,7 @@ static ssize_t sof_ipc_dfsentry_read(struct file *file, char __user *buffer,
276273 return count ;
277274}
278275
279- static int sof_ipc_dfsentry_release (struct inode * inode , struct file * file )
276+ static int sof_ipc_test_dfs_release (struct inode * inode , struct file * file )
280277{
281278 struct sof_client_dev * cdev = inode -> i_private ;
282279
@@ -285,12 +282,12 @@ static int sof_ipc_dfsentry_release(struct inode *inode, struct file *file)
285282 return 0 ;
286283}
287284
288- static const struct file_operations sof_ipc_dfs_fops = {
289- .open = sof_ipc_dfsentry_open ,
290- .read = sof_ipc_dfsentry_read ,
285+ static const struct file_operations sof_ipc_test_fops = {
286+ .open = sof_ipc_test_dfs_open ,
287+ .read = sof_ipc_test_dfs_read ,
291288 .llseek = default_llseek ,
292- .write = sof_ipc_dfsentry_write ,
293- .release = sof_ipc_dfsentry_release ,
289+ .write = sof_ipc_test_dfs_write ,
290+ .release = sof_ipc_test_dfs_release ,
294291
295292 .owner = THIS_MODULE ,
296293};
@@ -308,30 +305,31 @@ static int sof_ipc_test_probe(struct auxiliary_device *auxdev,
308305 const struct auxiliary_device_id * id )
309306{
310307 struct sof_client_dev * cdev = auxiliary_dev_to_sof_client_dev (auxdev );
311- struct sof_ipc_client_data * ipc_client_data ;
312308 struct dentry * debugfs_root = sof_client_get_debugfs_root (cdev );
309+ struct sof_ipc_test_priv * priv ;
313310
314311 /* allocate memory for client data */
315- ipc_client_data = devm_kzalloc (& auxdev -> dev , sizeof (* ipc_client_data ), GFP_KERNEL );
316- if (!ipc_client_data )
312+ priv = devm_kzalloc (& auxdev -> dev , sizeof (* priv ), GFP_KERNEL );
313+ if (!priv )
317314 return - ENOMEM ;
318315
319- ipc_client_data -> buf = devm_kzalloc (& auxdev -> dev , IPC_FLOOD_TEST_RESULT_LEN , GFP_KERNEL );
320- if (!ipc_client_data -> buf )
316+ priv -> buf = devm_kzalloc (& auxdev -> dev , IPC_FLOOD_TEST_RESULT_LEN ,
317+ GFP_KERNEL );
318+ if (!priv -> buf )
321319 return - ENOMEM ;
322320
323- cdev -> data = ipc_client_data ;
321+ cdev -> data = priv ;
324322
325323 /* create debugfs root folder with device name under parent SOF dir */
326- ipc_client_data -> dfs_root = debugfs_create_dir (dev_name (& auxdev -> dev ), debugfs_root );
327- if (!IS_ERR_OR_NULL (ipc_client_data -> dfs_root )) {
324+ priv -> dfs_root = debugfs_create_dir (dev_name (& auxdev -> dev ), debugfs_root );
325+ if (!IS_ERR_OR_NULL (priv -> dfs_root )) {
328326 /* create read-write ipc_flood_count debugfs entry */
329- debugfs_create_file (DEBUGFS_IPC_FLOOD_COUNT , 0644 ,
330- ipc_client_data -> dfs_root , cdev , & sof_ipc_dfs_fops );
327+ debugfs_create_file (DEBUGFS_IPC_FLOOD_COUNT , 0644 , priv -> dfs_root ,
328+ cdev , & sof_ipc_test_fops );
331329
332330 /* create read-write ipc_flood_duration_ms debugfs entry */
333331 debugfs_create_file (DEBUGFS_IPC_FLOOD_DURATION , 0644 ,
334- ipc_client_data -> dfs_root , cdev , & sof_ipc_dfs_fops );
332+ priv -> dfs_root , cdev , & sof_ipc_test_fops );
335333
336334 if (auxdev -> id == 0 ) {
337335 /*
@@ -342,13 +340,13 @@ static int sof_ipc_test_probe(struct auxiliary_device *auxdev,
342340
343341 snprintf (target , 100 , "%s/" DEBUGFS_IPC_FLOOD_COUNT ,
344342 dev_name (& auxdev -> dev ));
345- ipc_client_data -> dfs_link [0 ] =
343+ priv -> dfs_link [0 ] =
346344 debugfs_create_symlink (DEBUGFS_IPC_FLOOD_COUNT ,
347345 debugfs_root , target );
348346
349347 snprintf (target , 100 , "%s/" DEBUGFS_IPC_FLOOD_DURATION ,
350348 dev_name (& auxdev -> dev ));
351- ipc_client_data -> dfs_link [1 ] =
349+ priv -> dfs_link [1 ] =
352350 debugfs_create_symlink (DEBUGFS_IPC_FLOOD_DURATION ,
353351 debugfs_root , target );
354352 }
@@ -367,16 +365,16 @@ static int sof_ipc_test_probe(struct auxiliary_device *auxdev,
367365static void sof_ipc_test_remove (struct auxiliary_device * auxdev )
368366{
369367 struct sof_client_dev * cdev = auxiliary_dev_to_sof_client_dev (auxdev );
370- struct sof_ipc_client_data * ipc_client_data = cdev -> data ;
368+ struct sof_ipc_test_priv * priv = cdev -> data ;
371369
372370 pm_runtime_disable (& auxdev -> dev );
373371
374372 if (auxdev -> id == 0 ) {
375- debugfs_remove (ipc_client_data -> dfs_link [0 ]);
376- debugfs_remove (ipc_client_data -> dfs_link [1 ]);
373+ debugfs_remove (priv -> dfs_link [0 ]);
374+ debugfs_remove (priv -> dfs_link [1 ]);
377375 }
378376
379- debugfs_remove_recursive (ipc_client_data -> dfs_root );
377+ debugfs_remove_recursive (priv -> dfs_root );
380378}
381379
382380static const struct auxiliary_device_id sof_ipc_test_client_id_table [] = {
0 commit comments