Skip to content

RFC add poll_event*() interface

Nishanth Aravamudan kernel-janitors 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest5 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5add poll_event*()include/linux/delay.h+39 -01 reply
2/5char/tpqic02: use poll_event*() interfacedrivers/char/tpqic02.c+4 -122 replies
3/5ppc/pmac_cpufreq: use poll_event*() interfacearch/ppc/platforms/pmac_cpufreq.c+2 -70 replies
4/5ppc/serial_sicc: use poll_event*() interfacearch/ppc/4xx_io/serial_sicc.c+8 -100 replies
5/5ieee1394/amdtp: use poll_event*() interfacedrivers/ieee1394/amdtp.c+6 -100 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [KJ] [RFC][PATCH 0/5] add poll_event*() interface

Hi,

The following patches, including the one below, attempt to create a new sleep interface.

In reviewing the remaining schedule_timeout() callers in the kernel, I noticed that a number of usages of this function obey this model:

/* sleep at most this long */
timeout = jiffies + some_time;
/* every interval of time, check some_event's state */

while (some_event) {
	/* state to sleep in depends on the intent */
	set_current_state(TASK_{UN,}INTERRUPTIBLE);
	/* each iteration sleep for some_other_time */
	schedule_timeout(some_other_time);
}

Now, I thought to myself, this is very similar to wait_event() and co., but without wait-queues. And, thus, instead of a wait-queue being the trigger to check a condition, the some_other_time sleep going by is.

Thus, it seemed logical to add an interface to do exactly this in a nice compact way, but using msleep() and msleep_interruptible().

Patch 1/5: Adds the poll_event(), poll_event_timeout(), poll_event_interruptible() and poll_event_interruptible_timeout() interfaces.

Patch {2,3,4,5}/5: Demonstrates the utitlity of poll_event*() in various drivers.

I am more than happy to change the names of these macros, change the names of the variables, or whatever other suggestions you may have. I closely modelled the macros after wait_event*(), which should be apparently.

If this code has a decent response from KJML, I will go ahead and push it to LKML.

Thanks,
Nish

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors