Re: [PATCH 2/5] iommu/arm-smmu-v3: Add register display to debugfs
From: Nicolin Chen
Date: Tue May 26 2026 - 21:28:51 EST
On Wed, May 20, 2026 at 02:37:08PM +0800, Qinxin Xia wrote:
> +static int smmu_debugfs_registers_open(struct inode *inode, struct file *file)
> +{
> + struct arm_smmu_device *smmu = inode->i_private;
> + int ret;
> +
> + if (!smmu || !get_device(smmu->dev))
> + return -ENODEV;
> +
> + ret = single_open(file, smmu_debugfs_registers_show, smmu);
> + if (ret)
> + put_device(smmu->dev);
> +
> + return ret;
> +}
> +
> +static int smmu_debugfs_registers_release(struct inode *inode, struct file *file)
> +{
> + struct seq_file *seq = file->private_data;
> + struct arm_smmu_device *smmu = seq->private;
> +
> + single_release(inode, file);
> + if (smmu)
> + put_device(smmu->dev);
> +
> + return 0;
> +}
> +
> +static const struct file_operations smmu_debugfs_registers_fops = {
> + .owner = THIS_MODULE,
> + .open = smmu_debugfs_registers_open,
> + .read = seq_read,
> + .llseek = seq_lseek,
> + .release = smmu_debugfs_registers_release,
> +};
These seem a bit redundant; only names and show functions are
different from the cap's fops/open/release?
If so, maybe we can mimic how drivers/usb/host/xhci-debugfs.c
unify things (refer to w_context_files).
Nicolin