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

From: Vinod Koul
Date: Wed Jun 09 2021 - 10:10:14 EST


On 02-06-21, 12:22, Sanjay R Mehta wrote:

> +/* DebugFS helpers */
> +#define MAX_NAME_LEN 20
> +#define RI_VERSION_NUM 0x0000003F
> +
> +#define RI_NUM_VQM 0x00078000
> +#define RI_NVQM_SHIFT 15
> +
> +static DEFINE_MUTEX(pt_debugfs_lock);

unused?

> +
> +static int pt_debugfs_info_show(struct seq_file *s, void *p)
> +{
> + struct pt_device *pt = s->private;
> + unsigned int regval;
> +
> + if (!pt)
> + return 0;

better return an error code?

> +
> + seq_printf(s, "Device name: %s\n", pt->name);
> + seq_printf(s, " # Queues: %d\n", 1);
> + seq_printf(s, " # Cmds: %d\n", pt->cmd_count);
> +
> + regval = ioread32(pt->io_regs + CMD_PT_VERSION);

how do you ensure your device is not sleeping or you can access iomem
safely?

> +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;
> +
> + debugfs_create_file("info", 0400, pt->dma_dev.dbg_dev_root, pt,
> + &pt_debugfs_info_fops);
> +
> + debugfs_create_file("stats", 0600, pt->dma_dev.dbg_dev_root, pt,

why 600 here?
--
~Vinod