1
0
Fork 0
alistair23-linux/drivers/xen
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
..
events xen/events: fifo: use xen_vcpu_id mapping 2016-07-25 13:34:12 +01:00
xen-pciback xen-pciback: drop superfluous variables 2016-07-06 10:35:38 +01:00
xenbus xen: features and fixes for 4.8-rc0 2016-07-27 11:35:37 -07:00
xenfs xen: audit usages of module.h ; remove unnecessary instances 2016-03-21 15:13:32 +00:00
Kconfig ARM64: XEN: Add a function to initialize Xen specific UEFI runtime services 2016-07-06 10:34:46 +01:00
Makefile Xen: ARM: Add support for mapping platform device mmio 2016-07-06 10:34:43 +01:00
acpi.c xen: rename dom0_op to platform_op 2015-12-21 14:40:55 +00:00
arm-device.c Xen: ARM: Add support for mapping AMBA device mmio 2016-07-06 10:34:43 +01:00
balloon.c xen/balloon: Fix declared-but-not-defined warning 2016-06-23 11:36:15 +01:00
biomerge.c xen/biomerge: Don't allow biovec's to be merged when Linux is not using 4KB pages 2015-10-23 14:20:36 +01:00
cpu_hotplug.c xen, cpu_hotplug: call device_offline instead of cpu_down 2015-10-23 14:20:48 +01:00
dbgp.c xen: Use dev_is_pci() to check whether it is pci device 2014-01-07 09:53:33 -05:00
efi.c XEN: EFI: Move x86 specific codes to architecture directory 2016-07-06 10:34:46 +01:00
evtchn.c xen/evtchn: use xen_vcpu_id mapping 2016-07-25 13:34:18 +01:00
fallback.c xen-pciback: notify hypervisor about devices intended to be assigned to guests 2013-03-22 10:20:55 -04:00
features.c xen: audit usages of module.h ; remove unnecessary instances 2016-03-21 15:13:32 +00:00
gntalloc.c xen: use vma_pages(). 2016-07-06 10:34:47 +01:00
gntdev.c xen: use vma_pages(). 2016-07-06 10:34:47 +01:00
grant-table.c xen: audit usages of module.h ; remove unnecessary instances 2016-03-21 15:13:32 +00:00
manage.c xen: Use correctly the Xen memory terminologies 2015-09-08 18:03:49 +01:00
mcelog.c xen/mce: fix up xen_late_init_mcelog() error handling 2015-03-16 14:49:15 +00:00
pci.c xen/pci: Try harder to get PXM information for Xen 2015-04-15 10:57:28 +01:00
pcpu.c xen: rename dom0_op to platform_op 2015-12-21 14:40:55 +00:00
platform-pci.c drivers/xen: make platform-pci.c explicitly non-modular 2016-03-21 15:14:04 +00:00
preempt.c xen/preempt: use need_resched() instead of should_resched() 2015-08-20 12:24:14 +01:00
privcmd.c xen: use vma_pages(). 2016-07-06 10:34:47 +01:00
privcmd.h xen: Add privcmd device driver 2011-12-16 13:29:31 -05:00
swiotlb-xen.c dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
sys-hypervisor.c drivers/xen: make sys-hypervisor.c explicitly non-modular 2016-03-21 15:14:03 +00:00
time.c xen: add static initialization of steal_clock op to xen_time_ops 2016-07-26 14:07:06 +01:00
tmem.c cleancache: constify cleancache_ops structure 2016-01-27 09:09:57 -05:00
xen-acpi-cpuhotplug.c xen: rename dom0_op to platform_op 2015-12-21 14:40:55 +00:00
xen-acpi-memhotplug.c ACPICA: Resources: Provide common part for struct acpi_resource_address structures. 2015-01-26 16:09:56 +01:00
xen-acpi-pad.c xen: rename dom0_op to platform_op 2015-12-21 14:40:55 +00:00
xen-acpi-processor.c xen/acpi: allow xen-acpi-processor driver to load on Xen 4.7 2016-07-08 14:53:13 +01:00
xen-balloon.c drivers/xen: make [xen-]ballon explicitly non-modular 2016-03-21 15:13:44 +00:00
xen-scsiback.c target: make close_session optional 2016-05-10 01:19:26 -07:00
xen-selfballoon.c mm, frontswap: convert frontswap_enabled to static key 2016-07-26 16:19:19 -07:00
xen-stub.c xen/acpi: remove redundant acpi/acpi_drivers.h include 2013-03-11 13:53:02 -04:00
xlate_mmu.c Xen: xlate: Use page_to_xen_pfn instead of page_to_pfn 2016-07-06 10:34:42 +01:00