On Mon, Dec 8, 2008 at 12:45, Hennerich, Michael wrote: >From: Mike Frysinger [mailto:[EMAIL PROTECTED] >>On Mon, Dec 8, 2008 at 05:16, Hennerich, Michael wrote: >>>>comments welcome of course ... one question for sure is volatile >>>>usage. we have no volatile markings on the structures that represent >>>>DMA mmrs. this wasnt really a problem before because the functions >>>>were extern and no function polled a register directly, but now that >>>>they're dedicated, we need volatile marking. ive stuck it on >>>>"volatile struct dma_register *regs", but i'm still not entirely >>>>clear when it comes to pointers ... >>> >>> I think volatile usage in not complete considered evil. >>> >>> Check: linux-2.6.x/Documentation/volatile-considered-harmful.txt >> >>the arguments against volatile there do not apply to us here. the >>volatile markings are for the MMR addresses. so we either use >>volatile, or i switch all the functions to use bfin_read/bfin_write >>macros ... > > Use volatile - the document explicitly notes that this is a legitimate > usage. It actually tells you that exactly for this reason volatile was > originally invented.
sorry, i should have been a little more specific. what i'm worried about is how the volatile gets applied, not whether it's ok to use. struct regs { void *a; unsigned long b; }; volatile struct dma_register *regs; now, we set "regs" to a base address in the MMR space and the offsets in the structure are used to get the right DMA register for a specific channel. what i want to make sure is that the volatile only applies to the structure and not the pointer itself. i.e. i dont want "regs" (the address 0xffc0????) being constantly reloaded as the pointer storage is not volatile, just the memory the pointer is pointing to. i think what i'm using is correct: "volatile struct dma_register *regs". if i were to do "struct dma_register * volatile regs", then i'd get the other case: the pointer storage itself is volatile, but the memory it is pointing to is not. -mike _______________________________________________ Uclinux-dist-devel mailing list Uclinux-dist-devel@blackfin.uclinux.org http://blackfin.uclinux.org/mailman/listinfo/uclinux-dist-devel