On 21 April 2015 at 08:39, Alex Bennée <alex.ben...@linaro.org> wrote: > > Peter Maydell <peter.mayd...@linaro.org> writes: > >> Make address_space_rw take transaction attributes, rather >> than always using the 'unspecified' attributes. >> >> Signed-off-by: Peter Maydell <peter.mayd...@linaro.org> >> Reviewed-by: Paolo Bonzini <pbonz...@redhat.com> >> Reviewed-by: Edgar E. Iglesias <edgar.igles...@xilinx.com> >> --- >> dma-helpers.c | 3 ++- >> exec.c | 51 >> ++++++++++++++++++++++++++---------------------- >> hw/mips/mips_jazz.c | 6 ++++-- >> hw/pci-host/prep.c | 6 ++++-- >> include/exec/memory.h | 31 ++++++++++++++++++----------- >> include/sysemu/dma.h | 3 ++- >> ioport.c | 16 +++++++++------ >> kvm-all.c | 3 ++- >> scripts/coverity-model.c | 8 +++++--- >> 9 files changed, 77 insertions(+), 50 deletions(-) >> > <snip> >> diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h >> index 3f2f4c8..efa8b99 100644 >> --- a/include/sysemu/dma.h >> +++ b/include/sysemu/dma.h >> @@ -88,7 +88,8 @@ static inline int dma_memory_rw_relaxed(AddressSpace *as, >> dma_addr_t addr, >> void *buf, dma_addr_t len, >> DMADirection dir) >> { >> - return address_space_rw(as, addr, buf, len, dir == >> DMA_DIRECTION_FROM_DEVICE); >> + return (bool)address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, >> + buf, len, dir == >> DMA_DIRECTION_FROM_DEVICE); >> } > > The return does the right thing but I was wondering if it should be more > explicit: > > return MEMTX_OK==address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED,... > > ?
We rely on the convert-to-bool behaviour elsewhere too; it's just that this one place needs an explicit cast because the dma api makes the odd choice to have a boolean semantic but an int return type. (Coding style frowns on yoda-conditionals, by the way.) -- PMM