Lines Matching defs:cb
106 static void serial_buf_clear(struct circ_buf *cb)
108 cb->head = cb->tail = 0;
118 struct circ_buf *cb;
119 cb = kmalloc(sizeof(struct circ_buf), GFP_KERNEL);
120 if (cb == NULL)
122 cb->buf = kmalloc(AIRCABLE_BUF_SIZE, GFP_KERNEL);
123 if (cb->buf == NULL) {
124 kfree(cb);
127 serial_buf_clear(cb);
128 return cb;
136 static void serial_buf_free(struct circ_buf *cb)
138 kfree(cb->buf);
139 kfree(cb);
148 static int serial_buf_data_avail(struct circ_buf *cb)
150 return CIRC_CNT(cb->head,cb->tail,AIRCABLE_BUF_SIZE);
161 static int serial_buf_put(struct circ_buf *cb, const char *buf, int count)
165 c = CIRC_SPACE_TO_END(cb->head, cb->tail, AIRCABLE_BUF_SIZE);
170 memcpy(cb->buf + cb->head, buf, c);
171 cb->head = (cb->head + c) & (AIRCABLE_BUF_SIZE-1);
187 static int serial_buf_get(struct circ_buf *cb, char *buf, int count)
191 c = CIRC_CNT_TO_END(cb->head, cb->tail, AIRCABLE_BUF_SIZE);
196 memcpy(buf, cb->buf + cb->tail, c);
197 cb->tail = (cb->tail + c) & (AIRCABLE_BUF_SIZE-1);