コード例 #1
0
ファイル: dump_enable.c プロジェクト: 791254467/u8500_kernel
static int dump_enable_proc_show(struct seq_file *m, void *v)
{
	int ret;

	ret = lfs_param_op(PARAM_RD, O_RDONLY);

	if (ret == sizeof(param_buf))
		pr_info("%s: read debug_level.inf successfully.\n", __FUNCTION__);

	pr_info("%s: DEBUG_LEVEL = (%s)\n", __FUNCTION__, param_buf);

	if (!(strncmp(param_buf, DEBUG_LOW, sizeof(param_buf))))
		seq_printf(m, "0\n");

	else if (!(strncmp(param_buf, DEBUG_MID, sizeof(param_buf))))
		seq_printf(m, "1\n");

	else if (!(strncmp(param_buf, DEBUG_HIGH, sizeof(param_buf))))
		seq_printf(m, "2\n");

	else
		pr_err("%s: read invalid debug level\n", __FUNCTION__);

	return 0;
}
コード例 #2
0
static int save_lfs_param_value(void)
{
	int ret;

	ret = lfs_param_op(PARAM_WR, O_RDWR|O_SYNC);

	if (ret == sizeof(param_status)) {
		pr_info("%s: param.blk write successfully.\n", __FUNCTION__);
	}

	return 0;
}
コード例 #3
0
static int load_lfs_param_value(void)
{
	int ret;

	ret = lfs_param_op(PARAM_RD, O_RDONLY);

	if (ret == sizeof(param_status)) {
		pr_info("%s: param.blk read successfully.\n", __FUNCTION__);
	}

	return ret;
}
コード例 #4
0
ファイル: dump_enable.c プロジェクト: 791254467/u8500_kernel
static int dump_enable_proc_write(struct file *file, const char __user *buf,
			size_t count, loff_t *ppos)
{
	char ctl[2];
	int ret;

	if (count != 2 || *ppos)
		return -EINVAL;

	if (copy_from_user(ctl, buf, count))
		return -EFAULT;

	switch (ctl[0]) {
	case '0':
		strncpy(param_buf, DEBUG_LOW, sizeof(param_buf));
		break;
	case '1':
		strncpy(param_buf, DEBUG_MID, sizeof(param_buf));
		break;
	case '2':
		strncpy(param_buf, DEBUG_HIGH, sizeof(param_buf));
		break;
	default:
		pr_err("%s: invalid value of dump_enable\n", __FUNCTION__);
		return -EINVAL;
	}

	pr_info("%s: DEBUG_LEVEL = (%s)\n", __FUNCTION__, param_buf);

	ret = lfs_param_op(PARAM_WR, O_RDWR|O_SYNC);

	if (ret == sizeof(param_buf))
		pr_info("%s: write debug_level.inf successfully.\n", __FUNCTION__);

	return count;
}