diff options
| -rw-r--r-- | device_info_procfs.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/device_info_procfs.c b/device_info_procfs.c index ce5843f..0229eec 100644 --- a/device_info_procfs.c +++ b/device_info_procfs.c | |||
| @@ -12,13 +12,17 @@ | |||
| 12 | static ssize_t nvdebug_reg32_read(struct file *f, char __user *buf, size_t size, loff_t *off) { | 12 | static ssize_t nvdebug_reg32_read(struct file *f, char __user *buf, size_t size, loff_t *off) { |
| 13 | char out[16]; | 13 | char out[16]; |
| 14 | int chars_written; | 14 | int chars_written; |
| 15 | uint32_t read; | ||
| 15 | struct nvdebug_state *g = &g_nvdebug_state[file2parentgpuidx(f)]; | 16 | struct nvdebug_state *g = &g_nvdebug_state[file2parentgpuidx(f)]; |
| 16 | if (size < 16 || *off != 0) | 17 | if (size < 16 || *off != 0) |
| 17 | return 0; | 18 | return 0; |
| 19 | |||
| 20 | if ((read = nvdebug_readl(g, (uintptr_t)pde_data(file_inode(f)))) == -1) | ||
| 21 | return -EOPNOTSUPP; | ||
| 18 | // 32 bit register will always take less than 16 characters to print | 22 | // 32 bit register will always take less than 16 characters to print |
| 19 | chars_written = scnprintf(out, 16, "%#0x\n", nvdebug_readl(g, (uintptr_t)pde_data(file_inode(f)))); | 23 | chars_written = scnprintf(out, 16, "%#0x\n", nvdebug_readl(g, read)); |
| 20 | if (copy_to_user(buf, out, chars_written)) | 24 | if (copy_to_user(buf, out, chars_written)) |
| 21 | printk(KERN_WARNING "Unable to copy all data for %s\n", file_dentry(f)->d_name.name); | 25 | printk(KERN_WARNING "[nvdebug] %s: Unable to copy all data for %s\n", __func__, file_dentry(f)->d_name.name); |
| 22 | *off += chars_written; | 26 | *off += chars_written; |
| 23 | return chars_written; | 27 | return chars_written; |
| 24 | } | 28 | } |
