* [PATCH]: UIO read(2)/write(2) overrides @ 2014-03-21 14:20 Matt Sickler 2014-03-21 14:24 ` gregkh 0 siblings, 1 reply; 4+ messages in thread From: Matt Sickler @ 2014-03-21 14:20 UTC (permalink / raw) To: hjk@hansjkoch.de, gregkh@linuxfoundation.org; +Cc: linux-kernel@vger.kernel.org Tiny patch to let uio-based drivers override the read(2), write(2), and poll(2) syscalls. The rationale is that some uio-based drivers might want the mmap(2) functionality of UIO, but have no need for the IRQ semantics of read(2) and write(2). Signed-Off-by: Matt Sickler <Matt.Sickler@daktronics.com> --- diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index a673e5b..da1bfc8 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c @@ -505,6 +505,9 @@ static unsigned int uio_poll(struct file *filep, poll_table *wait) struct uio_listener *listener = filep->private_data; struct uio_device *idev = listener->dev; + if (idev->info->poll) + return idev->info->poll(filep, wait); + if (!idev->info->irq) return -EIO; @@ -523,6 +526,9 @@ static ssize_t uio_read(struct file *filep, char __user *buf, ssize_t retval; s32 event_count; + if (idev->info->read) + return idev->info->read(filep, buf, count, ppos); + if (!idev->info->irq) return -EIO; @@ -571,6 +577,9 @@ static ssize_t uio_write(struct file *filep, const char __user *buf, ssize_t retval; s32 irq_on; + if (idev->info->write) + return idev->info->write(filep, buf, count, ppos); + if (!idev->info->irq) return -EIO; diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h index 1ad4724..f15ace1 100644 --- a/include/linux/uio_driver.h +++ b/include/linux/uio_driver.h @@ -16,6 +16,7 @@ #include <linux/fs.h> #include <linux/interrupt.h> +#include <linux/poll.h> struct module; struct uio_map; @@ -95,6 +96,11 @@ struct uio_info { int (*open)(struct uio_info *info, struct inode *inode); int (*release)(struct uio_info *info, struct inode *inode); int (*irqcontrol)(struct uio_info *info, s32 irq_on); + unsigned int (*poll)(struct file *filep, poll_table *wait); + ssize_t (*read)(struct file *filep, char __user *buf, + size_t count, loff_t *ppos); + ssize_t (*write)(struct file *filep, const char __user *buf, + size_t count, loff_t *ppos); }; extern int __must_check ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH]: UIO read(2)/write(2) overrides 2014-03-21 14:20 [PATCH]: UIO read(2)/write(2) overrides Matt Sickler @ 2014-03-21 14:24 ` gregkh 2014-03-21 14:49 ` Matt Sickler 0 siblings, 1 reply; 4+ messages in thread From: gregkh @ 2014-03-21 14:24 UTC (permalink / raw) To: Matt Sickler; +Cc: hjk@hansjkoch.de, linux-kernel@vger.kernel.org On Fri, Mar 21, 2014 at 02:20:11PM +0000, Matt Sickler wrote: > Tiny patch to let uio-based drivers override the read(2), write(2), and poll(2) syscalls. > The rationale is that some uio-based drivers might want the mmap(2) functionality > of UIO, but have no need for the IRQ semantics of read(2) and write(2). Can you submit a driver that uses these new interfaces as well? I don't want to add something that isn't used in the kernel. > > Signed-Off-by: Matt Sickler <Matt.Sickler@daktronics.com> > --- > diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c > index a673e5b..da1bfc8 100644 > --- a/drivers/uio/uio.c > +++ b/drivers/uio/uio.c > @@ -505,6 +505,9 @@ static unsigned int uio_poll(struct file *filep, poll_table *wait) > struct uio_listener *listener = filep->private_data; > struct uio_device *idev = listener->dev; > > + if (idev->info->poll) > + return idev->info->poll(filep, wait); > + Your email client ate all the tabs and created a patch that can't be applied :( ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH]: UIO read(2)/write(2) overrides 2014-03-21 14:24 ` gregkh @ 2014-03-21 14:49 ` Matt Sickler 2014-03-21 14:59 ` gregkh 0 siblings, 1 reply; 4+ messages in thread From: Matt Sickler @ 2014-03-21 14:49 UTC (permalink / raw) To: gregkh@linuxfoundation.org; +Cc: hjk@hansjkoch.de, linux-kernel@vger.kernel.org From: gregkh@linuxfoundation.org [mailto:gregkh@linuxfoundation.org] > >On Fri, Mar 21, 2014 at 02:20:11PM +0000, Matt Sickler wrote: >> Tiny patch to let uio-based drivers override the read(2), write(2), and poll(2) syscalls. >> The rationale is that some uio-based drivers might want the mmap(2) >> functionality of UIO, but have no need for the IRQ semantics of read(2) and write(2). > >Can you submit a driver that uses these new interfaces as well? I don't want to add something that isn't used in the kernel. We're developing a driver for a new product but the driver is still in a state of flux, so it's not ready for posting yet. We will definitely get this out there once it's more polished. If you want to hold off applying this patch until we have something to submit that uses it, I'm fine with that. I wanted to get the community's thoughts about this patch too. (This is my first, now second, email to LKML). >> Signed-Off-by: Matt Sickler <Matt.Sickler@daktronics.com> >> --- >> diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index >> a673e5b..da1bfc8 100644 >> --- a/drivers/uio/uio.c >> +++ b/drivers/uio/uio.c >> @@ -505,6 +505,9 @@ static unsigned int uio_poll(struct file *filep, poll_table *wait) >> struct uio_listener *listener = filep->private_data; >> struct uio_device *idev = listener->dev; >> >> + if (idev->info->poll) >> + return idev->info->poll(filep, wait); >> + > >Your email client ate all the tabs and created a patch that can't be applied :( Apologies, "Enterprise" email clients tend to do that. This patch should be correctly formatted, if it's not I'll suffer through making mutt talk to Exchange. --- diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index a673e5b..da1bfc8 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c @@ -505,6 +505,9 @@ static unsigned int uio_poll(struct file *filep, poll_table *wait) struct uio_listener *listener = filep->private_data; struct uio_device *idev = listener->dev; + if (idev->info->poll) + return idev->info->poll(filep, wait); + if (!idev->info->irq) return -EIO; @@ -523,6 +526,9 @@ static ssize_t uio_read(struct file *filep, char __user *buf, ssize_t retval; s32 event_count; + if (idev->info->read) + return idev->info->read(filep, buf, count, ppos); + if (!idev->info->irq) return -EIO; @@ -571,6 +577,9 @@ static ssize_t uio_write(struct file *filep, const char __user *buf, ssize_t retval; s32 irq_on; + if (idev->info->write) + return idev->info->write(filep, buf, count, ppos); + if (!idev->info->irq) return -EIO; diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h index 1ad4724..f15ace1 100644 --- a/include/linux/uio_driver.h +++ b/include/linux/uio_driver.h @@ -16,6 +16,7 @@ #include <linux/fs.h> #include <linux/interrupt.h> +#include <linux/poll.h> struct module; struct uio_map; @@ -95,6 +96,11 @@ struct uio_info { int (*open)(struct uio_info *info, struct inode *inode); int (*release)(struct uio_info *info, struct inode *inode); int (*irqcontrol)(struct uio_info *info, s32 irq_on); + unsigned int (*poll)(struct file *filep, poll_table *wait); + ssize_t (*read)(struct file *filep, char __user *buf, + size_t count, loff_t *ppos); + ssize_t (*write)(struct file *filep, const char __user *buf, + size_t count, loff_t *ppos); }; extern int __must_check ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH]: UIO read(2)/write(2) overrides 2014-03-21 14:49 ` Matt Sickler @ 2014-03-21 14:59 ` gregkh 0 siblings, 0 replies; 4+ messages in thread From: gregkh @ 2014-03-21 14:59 UTC (permalink / raw) To: Matt Sickler; +Cc: hjk@hansjkoch.de, linux-kernel@vger.kernel.org On Fri, Mar 21, 2014 at 02:49:28PM +0000, Matt Sickler wrote: > From: gregkh@linuxfoundation.org [mailto:gregkh@linuxfoundation.org] > > > >On Fri, Mar 21, 2014 at 02:20:11PM +0000, Matt Sickler wrote: > >> Tiny patch to let uio-based drivers override the read(2), write(2), and poll(2) syscalls. > >> The rationale is that some uio-based drivers might want the mmap(2) > >> functionality of UIO, but have no need for the IRQ semantics of read(2) and write(2). > > > >Can you submit a driver that uses these new interfaces as well? I don't want to add something that isn't used in the kernel. > > We're developing a driver for a new product but the driver is still in > a state of flux, so it's not ready for posting yet. > We will definitely get this out there once it's more polished. > If you want to hold off applying this patch until we have something to > submit that uses it, I'm fine with that. Yes, we will have to wait until we see that driver, thanks. greg k-h ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-03-21 14:58 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-03-21 14:20 [PATCH]: UIO read(2)/write(2) overrides Matt Sickler 2014-03-21 14:24 ` gregkh 2014-03-21 14:49 ` Matt Sickler 2014-03-21 14:59 ` gregkh
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox