I have something like:
Code:
struct buffer {
uint32_t head, tail;
void **buf;
struct semaphore sem;
}
that I'm using to control several input buffers in my device driver. As a particular part of the driver is released, I need to dispose of that buffer. What I want to do is something along these lines:
Code:
struct buffer *buf;
down(buf->sem);
kfree(buf->buf);
kfree(buf);
// Uh oh, where'd the semaphore go?
I'm almost certain that this would be valid since the semaphore is controlled by me and ONLY by me. I believe that the kernel has no interest in the semaphore at any point, so I'm the one completely responsible for it.
Am I right in these assumptions?