Re: [PATCH 1/1] UIO: Add a write() function to enable/disable interrupts

Thomas Gleixner
2008-05-24T22:46:30Z

On Sat, 24 May 2008, Tom Spink wrote:
> 2008/5/24 Thomas Gleixner <tglx@linutronix.de>:
> > It makes a certain amount of sense to use write. You hold the device
> > file descriptor anyway for the read (wait for interrupt) operation,
> > so using the same file descriptor is not a too bad idea:
>
> What do you think about my ioctl idea, earlier in the thread?

I think it's a pretty bad idea.

> > while (!stop) {
> >
> > /* wait for interrupt */
> > read(fd);
> >
> > do_stuff();
> >
> > /*reenable interrupt */
> > write(fd);
> > }
>
> So, instead of write, you'd use ioctl(fd, ...).

And what's the actual gain ?

> > I thought about using a sysfs entry for a while, but looking at the
> > actual use case made the write() solution a more natural choice.
>
> I thought ioctl would be more natural, as [en,dis]abling interrupts is
> a "controlling" operation :-)

Oh no. We are not going to open the bottomless pit of ioctls in
UIO. Once we have an ioctl channel in place we have the same mess
which we want to avoid in the first place.

Also when a driver needs more than the obvious interrupt wait /
control functions (which are pretty symetric btw.) aside of the
mmapped access to the device then it does not belong into the category
of an UIO driver.

Thanks,

tglx