Re: [PATCH 1/2] uio: add warning to documentation

From: Benedikt Spranger
Date: Tue Dec 11 2012 - 19:45:30 EST


On Tue, 11 Dec 2012 15:18:16 -0800
Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:

> > -<function>open()</function>, you will probably also want a custom
> > +<function>release()</function>, you will probably also want a
> > custom <function>release()</function> function.
> That sentance no longer makes sense.
DUH! will fix...

> > +</para><para>CAVE: The release hook may be processed, even if a
> > mmap is aktive.
> Huh?
OK, think about a user of uio_pdrv_genirq and you did your
powermanagement well. The user open the UIO device, do a mmap() and
close the UIO device. Then he access the given pointer and wonders why
the system is stuck. It is a bad idea to disable clocks on release
while a mmap is active.

> > +Disabling clocks or other powermanagement functionality may cause
> > a system +crash, hangup or other unwanted sideeffects.
> > +</para><para><emphasis>The mmap() function shall add an extra
> > reference to the file associated with the file descriptor fildes
> > which is not removed by a subsequent close() on that file
> > descriptor. This reference shall be removed when there are no more
> > mappings to the file.</emphasis></para><para> +<link
> > xlink:href="http://pubs.opengroup.org/onlinepubs/009695399/functions/mmap.html";>IEEE
> > Std 1003.1, 2004 Edition, mmap()</link>
>
> It's not up to us to document the mmap system call here, you should
> know how to use it if you write a program with it, right?
Its not the user of mmap(), it is for the driver programmer. It is a
bad idea to do every kind of powermanagement function in the release
hook.

Regards
Bene
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/