Example #1
0
static inline bool __acpi_aml_writable(struct circ_buf *circ, unsigned long flag)
{
	/*
	 * Another write is not in progress and there is buffer space
	 * available for write.
	 */
	if (!(acpi_aml_io.flags & flag) && circ_space(circ))
		return true;
	return false;
}
Example #2
0
static void rd_write(struct msm_rd_state *rd, const void *buf, int sz)
{
    struct circ_buf *fifo = &rd->fifo;
    const char *ptr = buf;

    while (sz > 0) {
        char *fptr = &fifo->buf[fifo->head];
        int n;

        wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0);

        n = min(sz, circ_space_to_end(&rd->fifo));
        memcpy(fptr, ptr, n);

        fifo->head = (fifo->head + n) & (BUF_SZ - 1);
        sz  -= n;
        ptr += n;

        wake_up_all(&rd->fifo_event);
    }
}