@@ -158,7 +158,6 @@ static ssize_t sof_ipc_flood_dfs_write(struct file *file, const char __user *buf
158
158
unsigned long ipc_duration_ms = 0 ;
159
159
bool flood_duration_test = false;
160
160
unsigned long ipc_count = 0 ;
161
- struct dentry * dentry ;
162
161
int err ;
163
162
char * string ;
164
163
int ret ;
@@ -182,14 +181,7 @@ static ssize_t sof_ipc_flood_dfs_write(struct file *file, const char __user *buf
182
181
* ipc_duration_ms test floods the DSP for the time specified
183
182
* in the debugfs entry.
184
183
*/
185
- dentry = file -> f_path .dentry ;
186
- if (strcmp (dentry -> d_name .name , DEBUGFS_IPC_FLOOD_COUNT ) &&
187
- strcmp (dentry -> d_name .name , DEBUGFS_IPC_FLOOD_DURATION )) {
188
- ret = - EINVAL ;
189
- goto out ;
190
- }
191
-
192
- if (!strcmp (dentry -> d_name .name , DEBUGFS_IPC_FLOOD_DURATION ))
184
+ if (debugfs_get_aux_num (file ))
193
185
flood_duration_test = true;
194
186
195
187
/* test completion criterion */
@@ -252,22 +244,15 @@ static ssize_t sof_ipc_flood_dfs_read(struct file *file, char __user *buffer,
252
244
struct sof_ipc_flood_priv * priv = cdev -> data ;
253
245
size_t size_ret ;
254
246
255
- struct dentry * dentry ;
247
+ if (* ppos )
248
+ return 0 ;
256
249
257
- dentry = file -> f_path .dentry ;
258
- if (!strcmp (dentry -> d_name .name , DEBUGFS_IPC_FLOOD_COUNT ) ||
259
- !strcmp (dentry -> d_name .name , DEBUGFS_IPC_FLOOD_DURATION )) {
260
- if (* ppos )
261
- return 0 ;
250
+ count = min_t (size_t , count , strlen (priv -> buf ));
251
+ size_ret = copy_to_user (buffer , priv -> buf , count );
252
+ if (size_ret )
253
+ return - EFAULT ;
262
254
263
- count = min_t (size_t , count , strlen (priv -> buf ));
264
- size_ret = copy_to_user (buffer , priv -> buf , count );
265
- if (size_ret )
266
- return - EFAULT ;
267
-
268
- * ppos += count ;
269
- return count ;
270
- }
255
+ * ppos += count ;
271
256
return count ;
272
257
}
273
258
@@ -320,12 +305,12 @@ static int sof_ipc_flood_probe(struct auxiliary_device *auxdev,
320
305
priv -> dfs_root = debugfs_create_dir (dev_name (dev ), debugfs_root );
321
306
if (!IS_ERR_OR_NULL (priv -> dfs_root )) {
322
307
/* create read-write ipc_flood_count debugfs entry */
323
- debugfs_create_file (DEBUGFS_IPC_FLOOD_COUNT , 0644 , priv -> dfs_root ,
324
- cdev , & sof_ipc_flood_fops );
308
+ debugfs_create_file_aux_num (DEBUGFS_IPC_FLOOD_COUNT , 0644 ,
309
+ priv -> dfs_root , cdev , 0 , & sof_ipc_flood_fops );
325
310
326
311
/* create read-write ipc_flood_duration_ms debugfs entry */
327
- debugfs_create_file (DEBUGFS_IPC_FLOOD_DURATION , 0644 ,
328
- priv -> dfs_root , cdev , & sof_ipc_flood_fops );
312
+ debugfs_create_file_aux_num (DEBUGFS_IPC_FLOOD_DURATION , 0644 ,
313
+ priv -> dfs_root , cdev , 1 , & sof_ipc_flood_fops );
329
314
330
315
if (auxdev -> id == 0 ) {
331
316
/*
0 commit comments