another couple questions regarding wait queues
Robert P. J. Day
rpjday at crashcourse.ca
Sat Jun 22 03:38:14 EDT 2013
while i'm immersed in the code, might as well toss out a couple more
questions, these related to some code in drivers/mtd/mtdblock.c:
=====
static int erase_write (struct mtd_info *mtd, unsigned long pos,
int len, const char *buf)
{
struct erase_info erase;
DECLARE_WAITQUEUE(wait, current);
wait_queue_head_t wait_q;
size_t retlen;
int ret;
/*
* First, let's erase the flash block.
*/
init_waitqueue_head(&wait_q);
... snip ...
=====
this code seems a bit confusing. there are two ways to define both
wait queue heads and wait queues -- at compile time, and at run time.
above, the wait queue is defined at compile time with:
DECLARE_WAITQUEUE(wait, current);
which seems fine, but the wait queue head itself uses the *run-time*
declaration, which seems unnecessary -- why couldn't that have been
declared at compile time as well? is there something subtle going on
that i'm just not seeing? wait.h provides:
#define DECLARE_WAIT_QUEUE_HEAD(name) \
wait_queue_head_t name = __WAIT_QUEUE_HEAD_INITIALIZER(name)
and i don't see why that wouldn't have worked just fine. thoughts?
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
More information about the Kernelnewbies
mailing list