bus_dma: Deduplicate locking helper functions.
- Move busdma_lock_mutex to subr_bus_dma.c. - Move _busdma_lock_dflt to subr_bus_dma.c. This function was named a couple of different things previously. It is not a public API but an internal helper used in place of a NULL pointer. The prototype is in <sys/bus_dma.h> as not all backends include <sys/bus_dma_internal.h>. Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D33694
This commit is contained in:
@@ -375,41 +375,6 @@ must_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr,
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convenience function for manipulating driver locks from busdma (during
|
||||
* busdma_swi, for example).
|
||||
*/
|
||||
void
|
||||
busdma_lock_mutex(void *arg, bus_dma_lock_op_t op)
|
||||
{
|
||||
struct mtx *dmtx;
|
||||
|
||||
dmtx = (struct mtx *)arg;
|
||||
switch (op) {
|
||||
case BUS_DMA_LOCK:
|
||||
mtx_lock(dmtx);
|
||||
break;
|
||||
case BUS_DMA_UNLOCK:
|
||||
mtx_unlock(dmtx);
|
||||
break;
|
||||
default:
|
||||
panic("Unknown operation 0x%x for busdma_lock_mutex!", op);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* dflt_lock should never get called. It gets put into the dma tag when
|
||||
* lockfunc == NULL, which is only valid if the maps that are associated
|
||||
* with the tag are meant to never be defered.
|
||||
* XXX Should have a way to identify which driver is responsible here.
|
||||
*/
|
||||
static void
|
||||
dflt_lock(void *arg, bus_dma_lock_op_t op)
|
||||
{
|
||||
|
||||
panic("driver error: busdma dflt_lock called");
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate a device specific dma_tag.
|
||||
*/
|
||||
@@ -461,7 +426,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
|
||||
newtag->lockfunc = lockfunc;
|
||||
newtag->lockfuncarg = lockfuncarg;
|
||||
} else {
|
||||
newtag->lockfunc = dflt_lock;
|
||||
newtag->lockfunc = _busdma_dflt_lock;
|
||||
newtag->lockfuncarg = NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user