Skip to content

Commit 657b7cf

Browse files
committed
fixup! ASoC: SOF: debug-dsp-ops: Add ops for trace init/free
Fix the trace init/free functionality test in the debug ops tester. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
1 parent 7b88046 commit 657b7cf

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

sound/soc/sof/debug-dsp-ops.c

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@ static int sof_dsp_ops_set_power_state(struct snd_sof_dev *sdev, char *state)
6565

6666
static int sof_dsp_ops_trace_init(struct snd_sof_dev *sdev, bool init)
6767
{
68-
if (init)
68+
if (init) {
69+
sdev->fw_trace_is_supported = true;
6970
return sof_fw_trace_init(sdev);
71+
}
7072

7173
sof_fw_trace_free(sdev);
74+
sdev->fw_trace_is_supported = false;
7275
return 0;
7376
}
7477

@@ -234,13 +237,37 @@ static ssize_t sof_dsp_ops_tester_dfs_write(struct file *file, const char __user
234237
struct snd_sof_dev *sdev = dfse->sdev;
235238
size_t size;
236239
char *string;
240+
int ret;
237241

242+
if (!strcmp(dentry->d_name.name, "init_trace")) {
243+
string = kzalloc(count + 1, GFP_KERNEL);
244+
if (!string)
245+
return -ENOMEM;
238246

239-
if (!strcmp(dentry->d_name.name, "init_trace"))
240-
return sof_dsp_ops_trace_init(sdev, true);
247+
size = simple_write_to_buffer(string, count, ppos, buffer, count);
248+
kfree(string);
249+
250+
ret = sof_dsp_ops_trace_init(sdev, true);
251+
if (ret < 0)
252+
return ret;
253+
254+
return size;
255+
}
241256

242-
if (!strcmp(dentry->d_name.name, "free_trace"))
243-
return sof_dsp_ops_trace_init(sdev, false);
257+
if (!strcmp(dentry->d_name.name, "free_trace")) {
258+
string = kzalloc(count + 1, GFP_KERNEL);
259+
if (!string)
260+
return -ENOMEM;
261+
262+
size = simple_write_to_buffer(string, count, ppos, buffer, count);
263+
kfree(string);
264+
265+
ret = sof_dsp_ops_trace_init(sdev, false);
266+
if (ret < 0)
267+
return ret;
268+
269+
return size;
270+
}
244271

245272
if (!strcmp(dentry->d_name.name, "unload_fw")) {
246273
string = kzalloc(count + 1, GFP_KERNEL);

0 commit comments

Comments
 (0)