lkml.org 
[lkml]   [2017]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v10 13/15] platform/x86: wmi: create userspace interface for drivers
Date
> -----Original Message-----
> From: Greg KH [mailto:greg@kroah.com]
> Sent: Friday, October 20, 2017 8:23 AM
> To: Limonciello, Mario <Mario_Limonciello@Dell.com>
> Cc: dvhart@infradead.org; Andy Shevchenko <andy.shevchenko@gmail.com>;
> LKML <linux-kernel@vger.kernel.org>; platform-driver-x86@vger.kernel.org; Andy
> Lutomirski <luto@kernel.org>; quasisec@google.com; pali.rohar@gmail.com;
> rjw@rjwysocki.net; mjg59@google.com; hch@lst.de; Alan Cox
> <gnomes@lxorguk.ukuu.org.uk>
> Subject: Re: [PATCH v10 13/15] platform/x86: wmi: create userspace interface for
> drivers
>
> 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, wasn't aware of it.


\
 
 \ /
  Last update: 2017-10-22 17:41    [W:0.529 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site