> I'd like to notice that one use of a semaphore is of a "fifo for
> token-like objects", that is, the one where the initial value is
> usually 0
The semaphore implementations (both current and new) do support this, but we have few if any
users of it currently in the kernel. We have the 'completion' API which sort-of does what you
want (it's specialised for 'I am exiting now', but doesn't have to be used that way).
My motivation was really not to correct mutex vs semaphore usage but to add new features to
semaphores -- down_killable() and down_timeout() are the two I've added so far, each taking
very few additional lines of code.
I now suspect, having read over the completion code, that completions could be rewritten in
terms of my new semaphore implementation. I'll look into it later.