Re: [PATCH v4 3/3] dmaengine: ptdma: Add debugfs entries for PTDMA information

Sanjay R Mehta
2020-05-26T06:10:29Z

>> +static const struct file_operations pt_debugfs_info_ops = {
>> + .owner = THIS_MODULE,
>> + .open = simple_open,
>> + .read = ptdma_debugfs_info_read,
>> + .write = NULL,
>> +};
>> +
>> +static const struct file_operations pt_debugfs_queue_ops = {
>> + .owner = THIS_MODULE,
>> + .open = simple_open,
>> + .read = ptdma_debugfs_queue_read,
>> + .write = ptdma_debugfs_queue_write,
>> +};
>> +
>> +static const struct file_operations pt_debugfs_stats_ops = {
>> + .owner = THIS_MODULE,
>> + .open = simple_open,
>> + .read = ptdma_debugfs_stats_read,
>> + .write = ptdma_debugfs_stats_write,
>> +};
>
> pls convert to use DEFINE_SHOW_ATTRIBUTE()
>
Sure, will incorporate the changes in next version of patch.

>> +void ptdma_debugfs_setup(struct pt_device *pt)
>> +{
>> + struct pt_cmd_queue *cmd_q;
>> + char name[MAX_NAME_LEN + 1];
>> + struct dentry *debugfs_q_instance;
>> +
>> + if (!debugfs_initialized())
>> + return;
>> +
>> + mutex_lock(&pt_debugfs_lock);
>> + if (!pt_debugfs_dir)
>> + pt_debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
>> + mutex_unlock(&pt_debugfs_lock);
>> +
>> + pt->debugfs_instance = debugfs_create_dir(pt->name, pt_debugfs_dir);
>> +
>> + debugfs_create_file("info", 0400, pt->debugfs_instance, pt,
>> + &pt_debugfs_info_ops);
>> +
>> + debugfs_create_file("stats", 0600, pt->debugfs_instance, pt,
>> + &pt_debugfs_stats_ops);
>> +
>> + cmd_q = &pt->cmd_q;
>> +
>> + snprintf(name, MAX_NAME_LEN - 1, "q");
>> +
>> + debugfs_q_instance =
>> + debugfs_create_dir(name, pt->debugfs_instance);
>> +
>> + debugfs_create_file("stats", 0600, debugfs_q_instance, cmd_q,
>> + &pt_debugfs_queue_ops);
>
> Pls use dbg_dev_root in struct dma_device as root for your own debugfs
>
Sure, will incorporate the changes in next version of patch.

> Thanks
> --
> ~Vinod
>