1
0
Fork 0
alistair23-linux/drivers
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
..
accessibility
acpi Merge branch 'akpm' (patches from Andrew) 2016-08-02 21:08:07 -04:00
amba
android
ata New LED class driver: 2016-07-27 14:03:52 -07:00
atm drivers: atm: nicstar: Use the correct function to free some resources 2016-07-19 11:30:26 -07:00
auxdisplay
base firmware: support loading into a pre-allocated buffer 2016-08-02 19:35:10 -04:00
bcma wireless-drivers-next patches for 4.8 2016-07-25 11:09:19 -07:00
block Merge branch 'akpm' (patches from Andrew) 2016-08-02 21:08:07 -04:00
bluetooth Bluetooth: btmrvl: reset is_suspending flag in failure path 2016-07-18 10:13:02 +02:00
bus ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
cdrom
char Merge tag 'drm-for-v4.8' of git://people.freedesktop.org/~airlied/linux 2016-08-01 21:44:08 -04:00
clk treewide: replace obsolete _refok by __ref 2016-08-02 17:31:41 -04:00
clocksource ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
connector
cpufreq ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
cpuidle powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2016-08-01 14:28:42 -04:00
dax
dca
devfreq
dio
dma dmaengine updates for 4.8-rc1 2016-07-28 15:45:17 -07:00
dma-buf dma-buf: Release module reference on creation failure 2016-07-18 14:10:49 +02:00
edac * Altera Arria10 ethernet FIFO buffer support (Thor Thayer) 2016-07-27 13:40:47 -07:00
eisa
extcon
firewire
firmware tree-wide: replace config_enabled() with IS_ENABLED() 2016-08-04 08:50:07 -04:00
fmc
fpga drivers/fpga/Kconfig: fix build failure 2016-08-04 08:50:07 -04:00
gpio This is the bulk of GPIO changes for the v4.8 kernel cycle. 2016-07-26 19:16:01 -07:00
gpu dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
hid Merge branch 'for-4.8/hid-led' into for-linus 2016-07-28 10:49:23 +02:00
hsi
hv
hwmon hwmon updates for v4.8 (take 2) 2016-08-01 16:49:13 -04:00
hwspinlock
hwtracing Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-29 13:55:30 -07:00
i2c powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
ide Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide 2016-07-29 13:29:06 -07:00
idle Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-30 12:56:26 -07:00
iio
infiniband dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
input ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
iommu dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
ipack
irqchip tree-wide: replace config_enabled() with IS_ENABLED() 2016-08-04 08:50:07 -04:00
isdn
leds powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
lguest
lightnvm block: get rid of bio_rw and READA 2016-07-20 17:37:01 -06:00
macintosh powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
mailbox mailbox: Fix format and type mismatches in Broadcom PDC driver 2016-07-28 21:27:31 +05:30
mcb
md Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md 2016-07-28 18:04:39 -07:00
media dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
memory MTD updates for v4.8: 2016-08-02 17:05:11 -04:00
memstick memstick: don't allocate unused major for ms_block 2016-08-02 17:31:41 -04:00
message
mfd ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
misc dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
mmc MMC core: 2016-07-31 21:36:58 -04:00
mtd tree-wide: replace config_enabled() with IS_ENABLED() 2016-08-04 08:50:07 -04:00
net tree-wide: replace config_enabled() with IS_ENABLED() 2016-08-04 08:50:07 -04:00
nfc NFC 4.8 pull request 2016-07-20 23:39:36 -07:00
ntb
nubus
nvdimm libnvdimm for 4.8 2016-07-28 17:38:16 -07:00
nvme PCI changes for the v4.8 merge window: 2016-08-02 17:12:29 -04:00
nvmem
of powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
oprofile
parisc dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
parport
pci tree-wide: replace config_enabled() with IS_ENABLED() 2016-08-04 08:50:07 -04:00
pcmcia
perf Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-29 13:55:30 -07:00
phy MMC core: 2016-07-31 21:36:58 -04:00
pinctrl This is the bulk of pin control changes for the v4.8 kernel cycle. 2016-07-28 17:06:51 -07:00
platform Merge tag 'drm-for-v4.8' of git://people.freedesktop.org/~airlied/linux 2016-08-01 21:44:08 -04:00
pnp PNP material for v4.8-rc1 2016-07-26 18:27:20 -07:00
power ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
powercap
pps pps: do not crash when failed to register 2016-07-23 10:25:54 +09:00
ps3
ptp
pwm ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
rapidio rapidio/switches: add driver for IDT gen3 switches 2016-08-02 19:35:38 -04:00
ras
regulator ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
remoteproc dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
reset
rpmsg
rtc
s390 - ARM: GICv3 ITS emulation and various fixes. Removal of the old 2016-08-02 16:11:27 -04:00
sbus
scsi PCI changes for the v4.8 merge window: 2016-08-02 17:12:29 -04:00
sfi
sh
sn
soc ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
spi ARM: DT updates for v4.8 2016-08-01 18:37:45 -04:00
spmi
ssb
staging Merge tag 'drm-for-v4.8' of git://people.freedesktop.org/~airlied/linux 2016-08-01 21:44:08 -04:00
target Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2016-07-27 12:03:20 -07:00
tc
thermal
thunderbolt
tty tree-wide: replace config_enabled() with IS_ENABLED() 2016-08-04 08:50:07 -04:00
uio
usb PCI changes for the v4.8 merge window: 2016-08-02 17:12:29 -04:00
uwb
vfio vfio: platform: check reset call return code during release 2016-07-19 10:54:45 -06:00
vhost
video dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
virt
virtio mm: fix build warnings in <linux/compaction.h> 2016-07-26 16:19:19 -07:00
vlynq
vme
w1 w1:omap_hdq: fix regression 2016-08-02 19:35:40 -04:00
watchdog watchdog: gpio_wdt: Fix missing platform_set_drvdata() in gpio_wdt_probe() 2016-07-27 10:47:43 +02:00
xen dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
zorro
Kconfig
Makefile HSI changes for the v4.8 series 2016-07-27 15:18:53 -07:00