Lines Matching defs:chunk
1333 /* allocate a new memory chunk with the specified size */
1349 struct esm_memory *chunk = kmalloc(sizeof(*chunk), GFP_KERNEL);
1350 if (chunk == NULL) {
1354 chunk->buf = buf->buf;
1355 chunk->buf.bytes -= size;
1356 chunk->buf.area += size;
1357 chunk->buf.addr += size;
1358 chunk->empty = 1;
1360 list_add(&chunk->list, &buf->list);
1367 /* free a memory chunk */
1370 struct esm_memory *chunk;
1375 chunk = list_entry(buf->list.prev, struct esm_memory, list);
1376 if (chunk->empty) {
1377 chunk->buf.bytes += buf->buf.bytes;
1380 buf = chunk;
1384 chunk = list_entry(buf->list.next, struct esm_memory, list);
1385 if (chunk->empty) {
1386 buf->buf.bytes += chunk->buf.bytes;
1387 list_del(&chunk->list);
1388 kfree(chunk);
1402 struct esm_memory *chunk = list_entry(p, struct esm_memory, list);
1404 kfree(chunk);
1412 struct esm_memory *chunk;
1433 /* allocate an empty chunk */
1434 chunk = kmalloc(sizeof(*chunk), GFP_KERNEL);
1435 if (chunk == NULL) {
1440 chunk->buf = chip->dma;
1441 chunk->buf.area += ESM_MEM_ALIGN;
1442 chunk->buf.addr += ESM_MEM_ALIGN;
1443 chunk->buf.bytes -= ESM_MEM_ALIGN;
1444 chunk->empty = 1;
1445 list_add(&chunk->list, &chip->buf_list);
1451 /* buffer is extracted from the pre-allocated memory chunk */