Re: can a valid bus_dma_tag_t be NULL ?

From: John-Mark Gurney <gurney_j_at_resnet.uoregon.edu>
Date: Mon, 19 Feb 2007 14:40:06 -0800
Luigi Rizzo wrote this message on Mon, Feb 19, 2007 at 02:07 -0800:
> The original code (if_iwi.c, but the pattern is repeated in other
> drivers too) is the one below. Now, rather than using multiple
> labels, is there a value for the various fields (bus_dma_tag_t,
> bus_dmamap_t, fw_virtaddr, fw_physaddr) that tells me
> that the resource has not been allocated, or i should keep
> track of the success/failure of the various calls separately ?
> 
> E.g. i imagine that a NULL fw_virtaddr means failure, however
> bus_dmamap_load() worries me because the callback may happen later,
> and also i seem to remember that one should not make assumptions
> on bus_dma_tag_t == NULL ... 
> 
> comments anyone ? And, is -stable different from -current ?

Unless we introduce and document that there are magic values that these
can take, I would say no, there are no values that you can depend upon...
Though considering that we now have sys/_bus_dma.h that has the tag and
map as opaque struct pointers, we may..  Original design was to let each
arch have their own defines for the structs so that an extra pointer
wouldn't have to be followed, but we have dropped that idea in recent
years..

>         if (bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT,
				 ^^^^
This is incorrect, and should be: bus_get_dma_tag(dev), though that is
correct for -stable, (or have we introduced bus_get_dma_tag into -stable?)

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

     "All that I will do, has been done, All that I have, has not."
Received on Mon Feb 19 2007 - 22:17:25 UTC

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