diff --git a/drivers/misc/sdma-dae/sdma_dbg.c b/drivers/misc/sdma-dae/sdma_dbg.c index fc25daf991d76558facd800ed59f5e429bc9f54b..eb090c6b40f797158859c831781c74032f401452 100644 --- a/drivers/misc/sdma-dae/sdma_dbg.c +++ b/drivers/misc/sdma-dae/sdma_dbg.c @@ -95,7 +95,7 @@ static int sdma_debugfs_stats_show(struct seq_file *f, void *data SDMA_UNUSED) if (!dev) { seq_puts(f, "sdma_devices already released!\n"); spin_unlock(&dbg_g_info.core_dev->device_lock); - return -ENXIO; + return 0; } chn_num = sdma_chn_info(f, dev); exclusive_chn_used_nr = dev->nr_channel_used; @@ -249,7 +249,7 @@ static int sdma_debugfs_error_show(struct seq_file *f, void *data SDMA_UNUSED) if (!dev) { seq_puts(f, "sdma_devices already released!\n"); spin_unlock(&dbg_g_info.core_dev->device_lock); - return -ENXIO; + return 0; } chn_num = sdma_chn_info(f, dev); total_err_cnt = 0; @@ -404,7 +404,7 @@ static int sdma_debugfs_channels_show(struct seq_file *f, void *data SDMA_UNUSED if (!sdev) { seq_puts(f, "sdma_devices already released!\n"); spin_unlock(&dbg_g_info.core_dev->device_lock); - return -ENXIO; + return 0; } chn_num = sdma_chn_info(f, sdev); chn_idx = 0; @@ -423,14 +423,14 @@ static int sdma_debugfs_channels_show(struct seq_file *f, void *data SDMA_UNUSED if (dev_idx >= HISI_SDMA_MAX_DEVS || chn_idx >= HISI_SDMA_DEFAULT_CHANNEL_NUM) { seq_puts(f, "Unsupported device or channel!\n"); - return -EINVAL; + return 0; } spin_lock(&dbg_g_info.core_dev->device_lock); sdev = dbg_g_info.core_dev->sdma_devices[dev_idx]; if (!sdev) { seq_puts(f, "sdma_devices already released!\n"); spin_unlock(&dbg_g_info.core_dev->device_lock); - return -ENXIO; + return 0; } chn_num = sdma_chn_info(f, sdev); chn = sdev->channels + chn_idx; @@ -441,7 +441,7 @@ static int sdma_debugfs_channels_show(struct seq_file *f, void *data SDMA_UNUSED spin_unlock(&dbg_g_info.core_dev->device_lock); } else { seq_puts(f, "Unsupported debug mode!\n"); - return -EINVAL; + return 0; } return 0; @@ -477,9 +477,9 @@ int sdma_create_dbg_node(struct dentry *sdma_dbgfs_dir) if (IS_ERR(entry)) return PTR_ERR(entry); - debugfs_create_u32("debug_mode", RW_R_R, sdma_dbgfs_dir, &debug_mode); - debugfs_create_u32("device_id", RW_R_R, sdma_dbgfs_dir, &device_id); - debugfs_create_u32("channel_id", RW_R_R, sdma_dbgfs_dir, &channel_id); + debugfs_create_u32("debug_mode", RW_RW_RW, sdma_dbgfs_dir, &debug_mode); + debugfs_create_u32("device_id", RW_RW_RW, sdma_dbgfs_dir, &device_id); + debugfs_create_u32("channel_id", RW_RW_RW, sdma_dbgfs_dir, &channel_id); debug_mode = 0; device_id = 0; channel_id = 0; diff --git a/drivers/misc/sdma-dae/sdma_hal.h b/drivers/misc/sdma-dae/sdma_hal.h index 31027681a1f30ea5e4c5d5db544f352b404e2061..f734b20f3197f6e543e30cbb8966f741419ce9b8 100644 --- a/drivers/misc/sdma-dae/sdma_hal.h +++ b/drivers/misc/sdma-dae/sdma_hal.h @@ -13,6 +13,7 @@ #include "sdma_reg.h" #define RW_R_R 0644 +#define RW_RW_RW 0666 #define SDMA_IRQ_NUM_MAX 512 #define ALIGN_NUM 1 #define HISI_SDMA_HAL_HASH_BUCKETS_BITS 8 diff --git a/drivers/misc/sdma-dae/sdma_main.c b/drivers/misc/sdma-dae/sdma_main.c index 5bd187738ba5218aa34580f8d7036cdad014c2de..a76aa653e4738df3afbce0a52787c279afcdbdec 100644 --- a/drivers/misc/sdma-dae/sdma_main.c +++ b/drivers/misc/sdma-dae/sdma_main.c @@ -507,6 +507,16 @@ static long sdma_create_debugfs(void) return 0; } +static char *sdma_devnode(struct device *dev, umode_t *mode) +{ + if (!mode) + return NULL; + + *mode = RW_RW_RW; + + return NULL; +} + static int __init sdma_driver_init(void) { dev_t sdma_dev; @@ -521,6 +531,7 @@ static int __init sdma_driver_init(void) pr_err("class_create() failed for sdma_class: %ld\n", PTR_ERR(sdma_class)); goto destroy_ida; } + sdma_class->devnode = sdma_devnode; ret = alloc_chrdev_region(&sdma_dev, 0, HISI_SDMA_MAX_DEVS, "sdma"); if (ret < 0) { pr_err("alloc_chrdev_region() failed for sdma\n");