Re: [RFT][PATCH] generic device DMA implementation

James Bottomley
2002-12-27T21:39:16Z

david-b@pacbell.net said:
> - DMA mapping calls still return no errors; so BUG() out instead?

That's actually an open question. The line of least resistance (which is what
I followed) is to do what the pci_ API does (i.e. BUG()).

It's not clear to me that adding error returns rather than BUGging would buy
us anything (because now all the drivers have to know about the errors and
process them).

> Consider systems where DMA-able memory is limited (like SA-1111,
> to 1 MByte); clearly it should be possible for these calls to
> fail, when they can't allocate a bounce buffer. Or (see below)
> when an invalid argument is provided to a dma mapping call.

That's pretty much an edge case. I'm not opposed to putting edge cases in the
api (I did it for dma_alloc_noncoherent() to help parisc), but I don't think
the main line should be affected unless there's a good case for it.

Perhaps there is a compromise where the driver flags in the struct
device_driver that it wants error returns otherwise it takes the default
behaviour (i.e. no error return checking and BUG if there's a problem).

James