On Wednesday 20 April 2016 01:57:08 Arnd Bergmann wrote: > If you do this > > wait_event(&host->wq, !host->current_req); > > in the request function as well as > > wake_up(&host->wq); > > after setting host->current_req to NULL, I think you end up with > the same level of readability as the semaphore, and slightly > better object code, and you can drop the 'WARN_ON(host->current_req);' > which would be known to be impossible. > Correction: you would still need some form of serialization to ensure that only one thread can set the host->current_req at any time, so it's slightly more complex, either using a mutex around the wait_event/assignment, or doing wait_event(&host->wq, !cmpxchg(host->current_req, NULL, mrq)); which probably wants to be encapsulated in an inline function or annotated with a comment. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html