Unverified Commit 3af4ed7d authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!13294 sdma-dae: change authority of debugfs

Merge Pull Request from: @zhang-yuyang-0821 
 
1. change authority of normal user from 600 to 666
2. display error print of dfx

Zhang Shuowen (1):
    change authority of sdma device 
 
Link:https://gitee.com/openeuler/kernel/pulls/13294

 

Reviewed-by: default avatarFred Kimmy <xweikong@163.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parents df8594ea 883f9caa
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -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
+11 −0
Original line number Diff line number Diff line
@@ -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");