Lines Matching defs:buf
75 struct saa7164_buffer *buf = 0;
84 buf = kzalloc(sizeof(struct saa7164_buffer), GFP_KERNEL);
85 if (buf == NULL) {
90 buf->port = port;
91 buf->flags = SAA7164_BUFFER_FREE;
93 buf->pci_size = SAA7164_PT_ENTRIES * 0x1000;
94 buf->pt_size = (SAA7164_PT_ENTRIES * sizeof(u64)) + 0x1000;
97 buf->cpu = pci_alloc_consistent(port->dev->pci, buf->pci_size,
98 &buf->dma);
99 if (!buf->cpu)
102 buf->pt_cpu = pci_alloc_consistent(port->dev->pci, buf->pt_size,
103 &buf->pt_dma);
104 if (!buf->pt_cpu)
108 memset(buf->cpu, 0xff, buf->pci_size);
109 memset(buf->pt_cpu, 0xff, buf->pt_size);
111 dprintk(DBGLVL_BUF, "%s() allocated buffer @ 0x%p\n", __func__, buf);
113 buf->cpu, (long)buf->dma, buf->pci_size);
115 buf->pt_cpu, (long)buf->pt_dma, buf->pt_size);
120 *(buf->pt_cpu + i) = buf->dma + (i * 0x1000); /* TODO */
127 pci_free_consistent(port->dev->pci, buf->pci_size, buf->cpu, buf->dma);
129 kfree(buf);
131 buf = 0;
133 return buf;
137 struct saa7164_buffer *buf)
141 if (!buf || !port)
145 dprintk(DBGLVL_BUF, "%s() deallocating buffer @ 0x%p\n", __func__, buf);
147 if (buf->flags != SAA7164_BUFFER_FREE)
150 pci_free_consistent(port->dev->pci, buf->pci_size, buf->cpu, buf->dma);
151 pci_free_consistent(port->dev->pci, buf->pt_size, buf->pt_cpu,
152 buf->pt_dma);
154 kfree(buf);