コード例 #1
0
static ssize_t emdh_reg_read(
	struct file *file,
	char __user *buff,
	size_t count,
	loff_t *ppos)
{
	int tot = 0;

	if (*ppos)
		return 0;	/* the end */

	tot = mddi_reg_read(1);	/* emdh */

	if (tot < 0)
		return 0;
	if (copy_to_user(buff, debug_buf, tot))
		return -EFAULT;

	*ppos += tot;	/* increase offset */

	return tot;
}
コード例 #2
0
static ssize_t emdh_reg_read(
	struct file *file,
	char __user *buff,
	size_t count,
	loff_t *ppos)
{
	int tot = 0;

	if (*ppos)
		return 0;	

	tot = mddi_reg_read(1);	

	if (tot < 0)
		return 0;
	if (copy_to_user(buff, debug_buf, tot))
		return -EFAULT;

	*ppos += tot;	

	return tot;
}