Mem-2-Mem DMA - Generalized API

Arnd Bergmann arnd at arndb.de
Sat Jul 7 23:28:00 EST 2007


On Saturday 07 July 2007, Clifford Wolf wrote:
> > > +   // make sure all pending requests have finished before returning
> > > +   down_write(&backend->unreg_sem);
> > > +   up_write(&backend->unreg_sem);
> > > +}
> > 
> > This usage of rw semaphores looks fishy. 
> 
> yep. do you have a better idea how to implement this easily?
> 

I'd guess what you really want is reference counting. Every request
that gets assigned to a backend should get a kref on that backend
and give that up once it gets released itself.

I guess you can then have one more reference that you get in
dmatransfer_register_backend and release in dmatransfer_unregister_backend.
When you release the last reference, you call complete(),
and dmatransfer_unregister_backend() ends with a wait_for_completion().

	Arnd <><



More information about the Linuxppc-embedded mailing list