Lines Matching defs:cb
202 static void ti_buf_free(struct circ_buf *cb);
203 static void ti_buf_clear(struct circ_buf *cb);
204 static int ti_buf_data_avail(struct circ_buf *cb);
205 static int ti_buf_space_avail(struct circ_buf *cb);
206 static int ti_buf_put(struct circ_buf *cb, const char *buf, int count);
207 static int ti_buf_get(struct circ_buf *cb, char *buf, int count);
1713 struct circ_buf *cb;
1715 cb = kmalloc(sizeof(struct circ_buf), GFP_KERNEL);
1716 if (cb == NULL)
1719 cb->buf = kmalloc(TI_WRITE_BUF_SIZE, GFP_KERNEL);
1720 if (cb->buf == NULL) {
1721 kfree(cb);
1725 ti_buf_clear(cb);
1727 return cb;
1737 static void ti_buf_free(struct circ_buf *cb)
1739 kfree(cb->buf);
1740 kfree(cb);
1750 static void ti_buf_clear(struct circ_buf *cb)
1752 cb->head = cb->tail = 0;
1763 static int ti_buf_data_avail(struct circ_buf *cb)
1765 return CIRC_CNT(cb->head,cb->tail,TI_WRITE_BUF_SIZE);
1776 static int ti_buf_space_avail(struct circ_buf *cb)
1778 return CIRC_SPACE(cb->head,cb->tail,TI_WRITE_BUF_SIZE);
1791 static int ti_buf_put(struct circ_buf *cb, const char *buf, int count)
1796 c = CIRC_SPACE_TO_END(cb->head, cb->tail, TI_WRITE_BUF_SIZE);
1801 memcpy(cb->buf + cb->head, buf, c);
1802 cb->head = (cb->head + c) & (TI_WRITE_BUF_SIZE-1);
1821 static int ti_buf_get(struct circ_buf *cb, char *buf, int count)
1826 c = CIRC_CNT_TO_END(cb->head, cb->tail, TI_WRITE_BUF_SIZE);
1831 memcpy(buf, cb->buf + cb->tail, c);
1832 cb->tail = (cb->tail + c) & (TI_WRITE_BUF_SIZE-1);