Re: [PATCH v10 13/15] platform/x86: wmi: create userspace interface for drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 19, 2017 at 12:50:16PM -0500, Mario Limonciello wrote:
> +static ssize_t wmi_char_read(struct file *filp, char __user *buffer,
> +	size_t length, loff_t *offset)
> +{
> +	struct wmi_block *wblock = filp->private_data;
> +	size_t count;
> +
> +	if (*offset != 0)
> +		return 0;
> +
> +	count = sizeof(wblock->req_buf_size);
> +	count = length < count ? length : count;
> +
> +	if (copy_to_user(buffer, &wblock->req_buf_size, count))
> +		return -EFAULT;
> +
> +	*offset = count;
> +	return count;

simple_read_from_buffer()?  Library functions are your friend :)

thanks,

greg k-h



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux