1
0
Fork 0
alistair23-linux/arch/xtensa/kernel
Krzysztof Kozlowski 00085f1efa dma-mapping: use unsigned long for dma_attrs
The dma-mapping core and the implementations do not change the DMA
attributes passed by pointer.  Thus the pointer can point to const data.
However the attributes do not have to be a bitfield.  Instead unsigned
long will do fine:

1. This is just simpler.  Both in terms of reading the code and setting
   attributes.  Instead of initializing local attributes on the stack
   and passing pointer to it to dma_set_attr(), just set the bits.

2. It brings safeness and checking for const correctness because the
   attributes are passed by value.

Semantic patches for this change (at least most of them):

    virtual patch
    virtual context

    @r@
    identifier f, attrs;

    @@
    f(...,
    - struct dma_attrs *attrs
    + unsigned long attrs
    , ...)
    {
    ...
    }

    @@
    identifier r.f;
    @@
    f(...,
    - NULL
    + 0
     )

and

    // Options: --all-includes
    virtual patch
    virtual context

    @r@
    identifier f, attrs;
    type t;

    @@
    t f(..., struct dma_attrs *attrs);

    @@
    identifier r.f;
    @@
    f(...,
    - NULL
    + 0
     )

Link: http://lkml.kernel.org/r/1468399300-5399-2-git-send-email-k.kozlowski@samsung.com
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
Acked-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Hans-Christian Noren Egtvedt <egtvedt@samfundet.no>
Acked-by: Mark Salter <msalter@redhat.com> [c6x]
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com> [cris]
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> [drm]
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Acked-by: Joerg Roedel <jroedel@suse.de> [iommu]
Acked-by: Fabien Dessenne <fabien.dessenne@st.com> [bdisp]
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com> [vb2-core]
Acked-by: David Vrabel <david.vrabel@citrix.com> [xen]
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> [xen swiotlb]
Acked-by: Joerg Roedel <jroedel@suse.de> [iommu]
Acked-by: Richard Kuo <rkuo@codeaurora.org> [hexagon]
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> [m68k]
Acked-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> [s390]
Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Hans-Christian Noren Egtvedt <egtvedt@samfundet.no> [avr32]
Acked-by: Vineet Gupta <vgupta@synopsys.com> [arc]
Acked-by: Robin Murphy <robin.murphy@arm.com> [arm64 and dma-iommu]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-08-04 08:50:07 -04:00
..
.gitignore xtensa: tell git to ignore generated files 2013-06-05 10:14:19 -07:00
Makefile xtensa: support hardware breakpoints/watchpoints 2016-03-11 08:53:32 +00:00
align.S xtensa: allow single-stepping through unaligned load/store 2014-08-14 11:59:30 +04:00
asm-offsets.c xtensa: support hardware breakpoints/watchpoints 2016-03-11 08:53:32 +00:00
coprocessor.S xtensa: keep a3 and excsave1 on entry to exception handlers 2013-09-06 09:47:41 -07:00
entry.S xtensa: support hardware breakpoints/watchpoints 2016-03-11 08:53:32 +00:00
head.S xtensa: use context structure for debug exceptions 2016-03-11 08:53:32 +00:00
hw_breakpoint.c xtensa: support hardware breakpoints/watchpoints 2016-03-11 08:53:32 +00:00
irq.c Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-01 14:33:35 -07:00
mcount.S xtensa: add static function tracer support 2013-07-08 01:18:57 -07:00
module.c xtensa: clean up files to make them code-style compliant 2012-12-18 21:10:25 -08:00
mxhead.S xtensa: drop unused sections and remapped reset handlers 2015-11-03 17:19:39 +03:00
pci-dma.c dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
pci.c PCI: Revert "PCI: Call pci_read_bridge_bases() from core instead of arch code" 2015-09-15 13:18:04 -05:00
perf_event.c xtensa/perf: Convert the hotplug notifier to state machine callbacks 2016-07-14 09:34:41 +02:00
platform.c xtensa: cleanup ccount frequency tracking 2013-07-08 01:11:37 -07:00
process.c exit_thread: accept a task parameter to be exited 2016-05-20 17:58:30 -07:00
ptrace.c xtensa: support hardware breakpoints/watchpoints 2016-03-11 08:53:32 +00:00
setup.c xtensa: Partially Revert "xtensa: Remove unnecessary of_platform_populate with default match table" 2016-07-26 15:04:01 -05:00
signal.c Merge branch 'exec_domain_rip_v2' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc 2015-04-15 13:53:55 -07:00
smp.c arch/hotplug: Call into idle with a proper state 2016-03-01 20:36:57 +01:00
stacktrace.c xtensa: move oprofile stack tracing to stacktrace.c 2015-08-17 07:32:49 +03:00
syscall.c xtensa: nommu: don't provide arch_get_unmapped_area 2014-10-21 13:28:48 +04:00
time.c xtensa: Partially Revert "xtensa: Remove unnecessary of_platform_populate with default match table" 2016-07-26 15:04:01 -05:00
traps.c xtensa: support hardware breakpoints/watchpoints 2016-03-11 08:53:32 +00:00
vectors.S xtensa: use context structure for debug exceptions 2016-03-11 08:53:32 +00:00
vmlinux.lds.S xtensa: drop unused sections and remapped reset handlers 2015-11-03 17:19:39 +03:00
xtensa_ksyms.c xtensa: export __{invalidate,flush}_dcache_range 2014-04-02 01:35:50 +04:00