Lines Matching defs:chunk
1340 /* allocate a new memory chunk with the specified size */
1356 struct esm_memory *chunk = kmalloc(sizeof(*chunk), GFP_KERNEL);
1357 if (chunk == NULL) {
1361 chunk->buf = buf->buf;
1362 chunk->buf.bytes -= size;
1363 chunk->buf.area += size;
1364 chunk->buf.addr += size;
1365 chunk->empty = 1;
1367 list_add(&chunk->list, &buf->list);
1374 /* free a memory chunk */
1377 struct esm_memory *chunk;
1382 chunk = list_entry(buf->list.prev, struct esm_memory, list);
1383 if (chunk->empty) {
1384 chunk->buf.bytes += buf->buf.bytes;
1387 buf = chunk;
1391 chunk = list_entry(buf->list.next, struct esm_memory, list);
1392 if (chunk->empty) {
1393 buf->buf.bytes += chunk->buf.bytes;
1394 list_del(&chunk->list);
1395 kfree(chunk);
1409 struct esm_memory *chunk = list_entry(p, struct esm_memory, list);
1411 kfree(chunk);
1419 struct esm_memory *chunk;
1437 /* allocate an empty chunk */
1438 chunk = kmalloc(sizeof(*chunk), GFP_KERNEL);
1439 if (chunk == NULL) {
1444 chunk->buf = chip->dma;
1445 chunk->buf.area += ESM_MEM_ALIGN;
1446 chunk->buf.addr += ESM_MEM_ALIGN;
1447 chunk->buf.bytes -= ESM_MEM_ALIGN;
1448 chunk->empty = 1;
1449 list_add(&chunk->list, &chip->buf_list);
1455 /* buffer is extracted from the pre-allocated memory chunk */