Lines Matching defs:chunk
1344 /* allocate a new memory chunk with the specified size */
1360 struct esm_memory *chunk = kmalloc(sizeof(*chunk), GFP_KERNEL);
1361 if (chunk == NULL) {
1365 chunk->buf = buf->buf;
1366 chunk->buf.bytes -= size;
1367 chunk->buf.area += size;
1368 chunk->buf.addr += size;
1369 chunk->empty = 1;
1371 list_add(&chunk->list, &buf->list);
1378 /* free a memory chunk */
1381 struct esm_memory *chunk;
1386 chunk = list_entry(buf->list.prev, struct esm_memory, list);
1387 if (chunk->empty) {
1388 chunk->buf.bytes += buf->buf.bytes;
1391 buf = chunk;
1395 chunk = list_entry(buf->list.next, struct esm_memory, list);
1396 if (chunk->empty) {
1397 buf->buf.bytes += chunk->buf.bytes;
1398 list_del(&chunk->list);
1399 kfree(chunk);
1413 struct esm_memory *chunk = list_entry(p, struct esm_memory, list);
1415 kfree(chunk);
1423 struct esm_memory *chunk;
1441 /* allocate an empty chunk */
1442 chunk = kmalloc(sizeof(*chunk), GFP_KERNEL);
1443 if (chunk == NULL) {
1448 chunk->buf = chip->dma;
1449 chunk->buf.area += ESM_MEM_ALIGN;
1450 chunk->buf.addr += ESM_MEM_ALIGN;
1451 chunk->buf.bytes -= ESM_MEM_ALIGN;
1452 chunk->empty = 1;
1453 list_add(&chunk->list, &chip->buf_list);
1459 /* buffer is extracted from the pre-allocated memory chunk */