Re: [PATCH v2] watchdog/imx2+: add support for pretimeout interrupt functionality

From: Oskar Schirmer
Date: Tue Sep 11 2012 - 09:39:41 EST


Hi Wim,

On Tue, Sep 11, 2012 at 13:00:21 +0200, Wim Van Sebroeck wrote:
> Hi Oskar,
>
> > This watchdog device provides pretimeout facilities:
> > Set some timeout value and get informed about imminent
> > watchdog activity thru interrupt.
> >
> > Allow user to wait for this interrupt thru poll(2),
> > and to clear it thru read(2).
> >
> > Signed-off-by: Oskar Schirmer <oskar@xxxxxxxxx>
> > Cc: Wim Van Sebroeck <wim@xxxxxxxxx>
> > Cc: Wolfram Sang <w.sang@xxxxxxxxxxxxxx>
> > Cc: Sascha Hauer <kernel@xxxxxxxxxxxxxx>
> > Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
>
> I have a problem with the read and poll.
> We had "read()" in the past so we have a possible issue here (different function but userspace apps could still use the old read)...
> Can you explain what the read and poll does and where you want to use it.

To wait for some hardware event without blocking,
poll is used, primarily in places where it's about
data transmission. Ioctl would be an alternative
for cases without data transmission, but poll is
more generic.

Events causing pollin to return usually provide
data for read access, or, where no data is involved,
at least allow to clear the event thru read.

Now, checking current kernel for precedent, there
is only one driver that comes with pretimeouts: ipmi_watchdog.
It allows to set/get pretimeout, wait for it thru poll,
and clear it's occurence thru read.

So the obvious approach is to have a similar api for
the imx watchdog, as well, to avoid conflicting designs
right away.

Documentation does introduce set/get pretimeout, but
does not define how to detect and clear events.
Actually it does not define any meaning of poll or read.
Maybe this should be added.

For the past use of read, could You point me to where
imx2_wdt.c did have it?

There are watchdog drivers around that do implement a
read function, most of them to read temperature values.
Temperature sensor and watchdog are quite
different functionalities, so even where provided by
a single piece of hardware they probably should go
along two distinct drivers to make it a clean design.

GrÃÃe,
Oskar
--
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/