Re: bus_get_dma_tag now necessary for drivers using bus_dma

From: John-Mark Gurney <gurney_j_at_resnet.uoregon.edu>
Date: Tue, 5 Sep 2006 12:27:55 -0700
Warner Losh wrote this message on Tue, Sep 05, 2006 at 13:02 -0600:
> In message: <14026.1157478288_at_critter.freebsd.dk>
>             "Poul-Henning Kamp" <phk_at_phk.freebsd.dk> writes:
> : In message <20060905173334.GH9421_at_funkthat.com>, John-Mark Gurney writes:
> : 
> : >This means that for each call to bus_dma_tag_create, instead of passing
> : >a NULL pointer, you should call bus_get_dma_tag(yourdev) and use that
> : >as the parent tag.  I committed some example code to various drivers,
> : >such as ahc, ata, em, and ohci.
> : 
> : If there are never any exeptions to this requirement, why not
> : pass "yourdev" and have the magic hidden, rather than add 17
> : ritual characters to the API ?
> 
> As Scott pointed out, it won't always be NULL.  I like his idea of
> having a variant that takes a device_t...

I thought of something similar.  I like the idea of not having to call
bus_get_dma_tag every time, but at the same time, I didn't like adding
yet another function that does almost the same thing...  If more
arguments were effected, I'd be less inclined to argue, but all we'd
be doing would change:
	bus_dma_tag_create(bus_get_dma_tag(dev),
to:
	bus_dma_tag_dev_create(dev,

Which though less typing, does create another entry point for creating
a bus_dma_tag_t....

I'm split on which is the better way, so if someone wants to change it
to the second, I have no objections....

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."
Received on Tue Sep 05 2006 - 17:28:00 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:00 UTC