diff options
author | Thierry Reding <treding@nvidia.com> | 2015-08-06 11:04:54 +0200 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2015-08-13 13:47:57 +0200 |
commit | 530239a8b82c0d051ccda341cb346d3f11a80e70 (patch) | |
tree | 31ebacf2cf45d1c5eb3a78e136d8abcd8a4fb014 /drivers/gpu/drm/tegra | |
parent | 51511d05defe92715c19c3e583c9d1ac1c82e1e6 (diff) |
drm/tegra: sor: Use DRM debugfs infrastructure for CRC
Instead of duplicating most of the code to set up a debugfs file, use
the existing DRM core debugfs infrastructure instead.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/tegra')
-rw-r--r-- | drivers/gpu/drm/tegra/sor.c | 45 |
1 files changed, 8 insertions, 37 deletions
diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index d69575d2cdc7..9bc2cb701c04 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -595,18 +595,6 @@ static int tegra_sor_power_down(struct tegra_sor *sor) return 0; } -static int tegra_sor_crc_open(struct inode *inode, struct file *file) -{ - file->private_data = inode->i_private; - - return 0; -} - -static int tegra_sor_crc_release(struct inode *inode, struct file *file) -{ - return 0; -} - static int tegra_sor_crc_wait(struct tegra_sor *sor, unsigned long timeout) { u32 value; @@ -624,12 +612,11 @@ static int tegra_sor_crc_wait(struct tegra_sor *sor, unsigned long timeout) return -ETIMEDOUT; } -static ssize_t tegra_sor_crc_read(struct file *file, char __user *buffer, - size_t size, loff_t *ppos) +static int tegra_sor_show_crc(struct seq_file *s, void *data) { - struct tegra_sor *sor = file->private_data; - ssize_t num, err; - char buf[10]; + struct drm_info_node *node = s->private; + struct tegra_sor *sor = node->info_ent->data; + int err = 0; u32 value; mutex_lock(&sor->lock); @@ -658,22 +645,13 @@ static ssize_t tegra_sor_crc_read(struct file *file, char __user *buffer, tegra_sor_writel(sor, SOR_CRCA_RESET, SOR_CRCA); value = tegra_sor_readl(sor, SOR_CRCB); - num = scnprintf(buf, sizeof(buf), "%08x\n", value); - - err = simple_read_from_buffer(buffer, size, ppos, buf, num); + seq_printf(s, "%08x\n", value); unlock: mutex_unlock(&sor->lock); return err; } -static const struct file_operations tegra_sor_crc_fops = { - .owner = THIS_MODULE, - .open = tegra_sor_crc_open, - .read = tegra_sor_crc_read, - .release = tegra_sor_crc_release, -}; - static int tegra_sor_show_regs(struct seq_file *s, void *data) { struct drm_info_node *node = s->private; @@ -804,15 +782,15 @@ static int tegra_sor_show_regs(struct seq_file *s, void *data) } static const struct drm_info_list debugfs_files[] = { + { "crc", tegra_sor_show_crc, 0, NULL }, { "regs", tegra_sor_show_regs, 0, NULL }, }; static int tegra_sor_debugfs_init(struct tegra_sor *sor, struct drm_minor *minor) { - struct dentry *entry; unsigned int i; - int err = 0; + int err; sor->debugfs = debugfs_create_dir("sor", minor->debugfs_root); if (!sor->debugfs) @@ -834,16 +812,9 @@ static int tegra_sor_debugfs_init(struct tegra_sor *sor, if (err < 0) goto free; - entry = debugfs_create_file("crc", 0644, sor->debugfs, sor, - &tegra_sor_crc_fops); - if (!entry) { - err = -ENOMEM; - goto free; - } - sor->minor = minor; - return err; + return 0; free: kfree(sor->debugfs_files); |