History

comedi: remove the mapping of the Comedi buffer in vmalloc address space

Now that all the code that accesses the Comedi buffer data does so page-by-page, using the `virt_addr` member of `struct comedi_buf_page` to point to the data of each page, do not linearly map the buffer into vmalloc address space (pointed to by the `prealloc_buf` member of `struct comedi_async`). That was only done for convenience, but was not done for those drivers that need a DMA coherent buffer, which is allocated in a single chunk. Remove the `prealloc_buf` member as it is no longer used.

Ian Abbott committed 1 year ago

Commit 5117f281 parent e7199b62 files · +6 −49Browse files

Showing the changes to include/linux/comedi (1 of 2 files). Show all

Unified · Split

include/linux/comedi/comedidev.h+2−8
@@ -234,16 +234,12 @@ struct comedi_buf_page { · 233 unmodified lines
234 *234 *
235 * A COMEDI data buffer is allocated as individual pages, either in235 * A COMEDI data buffer is allocated as individual pages, either in
236 * conventional memory or DMA coherent memory, depending on the attached,236 * conventional memory or DMA coherent memory, depending on the attached,
237 * low-level hardware device. (The buffer pages also get mapped into the237 * low-level hardware device.
238 * kernel's contiguous virtual address space pointed to by the 'prealloc_buf'
239 * member of &struct comedi_async.)
240 *238 *
241 * The buffer is normally freed when the COMEDI device is detached from the239 * The buffer is normally freed when the COMEDI device is detached from the
242 * low-level driver (which may happen due to device removal), but if it happens240 * low-level driver (which may happen due to device removal), but if it happens
243 * to be mmapped at the time, the pages cannot be freed until the buffer has241 * to be mmapped at the time, the pages cannot be freed until the buffer has
244 * been munmapped. That is what the reference counter is for. (The virtual242 * been munmapped. That is what the reference counter is for.
245 * address space pointed by 'prealloc_buf' is freed when the COMEDI device is
246 * detached.)
247 */243 */
248struct comedi_buf_map {244struct comedi_buf_map {
249 struct device *dma_hw_dev;245 struct device *dma_hw_dev;
@@ -255,7 +251,6 @@ struct comedi_buf_map { · 5 unmodified lines
255 251
256/**252/**
257 * struct comedi_async - Control data for asynchronous COMEDI commands253 * struct comedi_async - Control data for asynchronous COMEDI commands
258 * @prealloc_buf: Kernel virtual address of allocated acquisition buffer.
259 * @prealloc_bufsz: Buffer size (in bytes).254 * @prealloc_bufsz: Buffer size (in bytes).
260 * @buf_map: Map of buffer pages.255 * @buf_map: Map of buffer pages.
261 * @max_bufsize: Maximum allowed buffer size (in bytes).256 * @max_bufsize: Maximum allowed buffer size (in bytes).
@@ -344,7 +339,6 @@ struct comedi_buf_map { · 82 unmodified lines
344 * less than or equal to UINT_MAX).339 * less than or equal to UINT_MAX).
345 */340 */
346struct comedi_async {341struct comedi_async {
347 void *prealloc_buf;
348 unsigned int prealloc_bufsz;342 unsigned int prealloc_bufsz;
349 struct comedi_buf_map *buf_map;343 struct comedi_buf_map *buf_map;
350 unsigned int max_bufsize;344 unsigned int max_bufsize;