tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: proposal for bus_dma(9) change

On Wed, Mar 04, 2009 at 02:27:02PM +0100, Christoph Egger wrote:
> There are two ways to fix above described problem:

There are not only two ways.  Look at how I handle this in rtw(4),
for example.  Also, look at tlp_attach().  In both of those drivers,
the failure of bus_dmamap_create() is treated explicitly.

Another possible way to handle this is by analogy to sysctl(9):
extend bus_dma(9) with _log(..., bus_dma_log_t *log) variants of
the _alloc()/_create()/_map() routines, and a routine
bus_dma_teardown(bus_dma_log_t).  The variant routines leave traces
in the log.  bus_dma_teardown() uses the log to undo all of the
steps in reverse order.  Going this route, we could save a lot of
mistakes and duplicate code.

Actually, there are many steps to attaching a typical network driver
(mapping registers, creating DMA buffers, mapping the buffers,
mapping the interrupt) that we want to undo in reverse order.
pci(9), bus_dma(9), bus_space(9), et cetera may all call for a
generic record/teardown facility.


David Young             OJC Technologies      Urbana, IL * (217) 278-3933

Home | Main Index | Thread Index | Old Index