driver core: platform: Allow using a dedicated dma_mask for platform_device
Subsystems (71)
PATCH 1/1 driver core: platform: Allow using a dedicated dma_mask for platform_device
This patch attempts to solve a long standing situation where dev->dma_mask is a pointer to dev->dma_coherent_mask, meaning that any change to the coherent mask will affect the streaming mask.
The API allows to use different values for both masks, but for now platform_device built from DT will simply make the dma_mask point to the coherent mask.
This is a problem on a least one driver, the PPv2 network driver, which needs different streaming and coherent masks to overcome a HW limitation. In this case, the issue is a performance degradation since the streaming mask isn't as big as it ought to be, causing a lot of buffer bounces.
There were previous attempts to fix this issue. One of them by Brian Brooks, where the dma_mask is reallocated in the driver itself, which wasn't considered to be the best approach :
https://lore.kernel.org/netdev/[email protected]/
This lead to a discussion pointing to another attempt to solve the issue, by Christoph Hellwig :
https://lore.kernel.org/lkml/[email protected]/
This more generic approach ended-up causing regressions on some mfd drivers (the sm501 was one of the reports).
The current patch tries to be a bit less generic, and allows setting-up the dma_mask for platform devices using a dedicated helper. In this case, the dma_mask is allocated in struct platform_object, as suggested by Russell King.
This helper is then used in platform_device creation code from the DT.
---
Hi everyone,
This patch, if suitable, would require a lot of testing to detect drivers that rely on the streaming mask being the same as the coherent mask.
Thanks,
Maxime
drivers/base/platform.c | 17 +++++++++++++++++ drivers/of/platform.c | 7 +++++-- include/linux/platform_device.h | 1 + 3 files changed, 23 insertions(+), 2 deletions(-)
drivers/base/platform.c +17 -0
@@ -256,9 +256,26 @@ EXPORT_SYMBOL_GPL(platform_add_devices);struct platform_object {struct platform_device pdev; +u64 dma_mask;char name[]; }; +/** +* platform_device_setup_dma_mask - Sets the dma_mask pointer +* @pdev: platform device to configure the device's mask +* +* Sets the dma_mask of the underlying device to point to a dedicated region, +* that belongs to the platform_device. +*/ +void platform_device_setup_dma_mask (struct platform_device *pdev) +{ + struct platform_object *pa = container_of(pdev, struct platform_object, + pdev); + + pa->pdev.dev.dma_mask = &pa->dma_mask; +} +EXPORT_SYMBOL_GPL (platform_device_setup_dma_mask); +/** * platform_device_put - destroy a platform device * @pdev: platform device to free
drivers/of/platform.c +5 -2
@@ -186,8 +186,11 @@ static struct platform_device *of_platform_device_create_pdata( goto err_clear_flag; dev->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); -if (!dev->dev.dma_mask) - dev->dev.dma_mask = &dev->dev.coherent_dma_mask; +if (!dev->dev.dma_mask) { +platform_device_setup_dma_mask (dev); + *dev->dev.dma_mask = dev->dev.coherent_dma_mask; + } + dev->dev.bus = &platform_bus_type; dev->dev.platform_data = platform_data;of_msi_configure (&dev->dev, dev->dev.of_node);
include/linux/platform_device.h +1 -0
@@ -181,6 +181,7 @@ extern int platform_device_add_properties(struct platform_device *pdev,extern int platform_device_add (struct platform_device *pdev);extern void platform_device_del (struct platform_device *pdev);extern void platform_device_put (struct platform_device *pdev); +extern void platform_device_setup_dma_mask (struct platform_device *pdev);struct platform_driver {int (*probe)(struct platform_device *);
Signature · 1 line
2.20.1
I'd much rather bite the bullet and make dev->dma_mask a scalar instead of a pointer. The pointer causes way to much boiler plate code, and the semantics are way to subtile. Below is a POV patch that compiles and boots with my usual x86 test config, and at least compiles with the arm and pmac32 defconfigs. It probably breaks just about everything else, but should give us an idea what is involve in the switch:
---
From ea73ba2d29f56ff6413066b10f018a671f2b26ac Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <[email protected]>
Date: Fri, 28 Jun 2019 16:24:01 +0200
Subject: device.h: make dma_mask a scalar instead of a pointer
Kill the dma_mask indirection to clean up the mess we acquired around it.
--- arch/arm/common/locomo.c | 5 +- arch/arm/common/sa1111.c | 5 +- arch/arm/include/asm/dma-direct.h | 2 +- arch/arm/include/asm/dma-mapping.h | 2 +- arch/arm/include/asm/ecard.h | 1 - arch/arm/include/asm/hardware/locomo.h | 2 - arch/arm/include/asm/hardware/sa1111.h | 1 - arch/arm/mach-davinci/devices.c | 12 +--- arch/arm/mach-davinci/dm355.c | 17 ++--- arch/arm/mach-davinci/dm365.c | 4 +- arch/arm/mach-iop13xx/setup.c | 7 +- arch/arm/mach-ixp4xx/common.c | 9 ++- arch/arm/mach-mmp/pxa168.c | 3 +- arch/arm/mach-pxa/devices.c | 80 +++++++---------------- arch/arm/mach-rpc/ecard.c | 3 +- arch/arm/mach-s3c24xx/common.c | 10 ++- arch/arm/mach-s3c64xx/dev-audio.c | 4 +- arch/arm/mach-sa1100/badge4.c | 4 +- arch/arm/mach-sa1100/generic.c | 16 ++--- arch/arm/mach-sa1100/jornada720.c | 4 +- arch/arm/mach-w90x900/dev.c | 10 +-- arch/arm/plat-iop/adma.c | 8 +-- arch/m68k/coldfire/device.c | 6 +- arch/m68k/kernel/dma.c | 7 +- arch/mips/alchemy/common/platform.c | 12 ++-- arch/mips/bcm63xx/dev-enet.c | 8 +-- arch/mips/jz4740/platform.c | 6 +- arch/mips/loongson32/common/platform.c | 4 +- arch/mips/pmcs-msp71xx/msp_usb.c | 8 +-- arch/mips/sgi-ip22/ip22-platform.c | 12 +--- arch/parisc/include/asm/parisc-device.h | 1 - arch/parisc/kernel/drivers.c | 6 +- arch/powerpc/include/asm/device.h | 1 - arch/powerpc/include/asm/dma-direct.h | 2 +- arch/powerpc/include/asm/iommu.h | 8 --- arch/powerpc/kernel/dma-iommu.c | 4 +- arch/powerpc/kernel/pci_of_scan.c | 3 +- arch/powerpc/kernel/setup-common.c | 3 +- arch/powerpc/platforms/pseries/vio.c | 6 +- arch/sh/boards/mach-ecovec24/setup.c | 8 +-- arch/sh/kernel/cpu/sh4a/setup-sh7757.c | 5 +- arch/sparc/kernel/of_device_32.c | 2 +- arch/sparc/kernel/of_device_64.c | 2 +- drivers/acpi/arm64/iort.c | 17 +---- drivers/amba/bus.c | 2 +- drivers/ata/ahci.c | 2 +- drivers/base/isa.c | 2 +- drivers/base/platform.c | 20 +----- drivers/bcma/main.c | 6 +- drivers/bus/fsl-mc/fsl-mc-bus.c | 5 +- drivers/crypto/ccree/cc_driver.c | 3 - drivers/dma/bcm2835-dma.c | 3 - drivers/eisa/eisa-bus.c | 5 +- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 2 +- drivers/gpu/host1x/bus.c | 2 +- drivers/iommu/amd_iommu.c | 10 +-- drivers/iommu/intel-iommu.c | 8 +-- drivers/macintosh/macio_asic.c | 5 +- drivers/media/platform/via-camera.c | 2 +- drivers/misc/mic/bus/mic_bus.c | 2 +- drivers/misc/mic/bus/scif_bus.c | 2 +- drivers/misc/mic/bus/vop_bus.c | 2 +- drivers/misc/mic/card/mic_x100.c | 4 +- drivers/mmc/core/queue.c | 2 +- drivers/mmc/host/mtk-sd.c | 6 +- drivers/mmc/host/sdhci-sprd.c | 3 +- drivers/mmc/host/sdhci.c | 6 +- drivers/mmc/host/sdhci.h | 1 - drivers/nubus/bus.c | 3 +- drivers/of/device.c | 13 +--- drivers/of/platform.c | 4 +- drivers/pci/pci-sysfs.c | 2 +- drivers/pci/probe.c | 3 +- drivers/pcmcia/ds.c | 3 +- drivers/pnp/card.c | 2 +- drivers/pnp/core.c | 5 +- drivers/rapidio/rio-scan.c | 3 +- drivers/s390/virtio/virtio_ccw.c | 2 - drivers/scsi/megaraid/megaraid_sas_base.c | 4 +- drivers/spi/spi-mt65xx.c | 3 - drivers/ssb/main.c | 1 - drivers/staging/media/omap4iss/iss.c | 3 +- drivers/staging/media/omap4iss/iss.h | 2 - drivers/tc/tc.c | 3 +- drivers/tty/goldfish.c | 5 -- drivers/usb/core/hcd.c | 2 +- drivers/usb/dwc2/platform.c | 2 - drivers/usb/gadget/udc/lpc32xx_udc.c | 4 +- drivers/usb/host/bcma-hcd.c | 1 - drivers/usb/host/ehci-grlib.c | 2 - drivers/usb/host/ehci-ps3.c | 6 +- drivers/usb/host/fsl-mph-dr-of.c | 6 +- drivers/usb/host/ohci-ps3.c | 6 +- drivers/usb/host/ssb-hcd.c | 1 - drivers/usb/host/uhci-grlib.c | 2 - drivers/usb/misc/ftdi-elan.c | 2 +- drivers/zorro/zorro.c | 3 +- include/linux/device.h | 2 +- include/linux/dma-direct.h | 2 +- include/linux/dma-mapping.h | 12 ++-- include/linux/eisa.h | 1 - include/linux/fsl/mc.h | 2 - include/linux/pci.h | 6 -- include/linux/pnp.h | 1 - include/linux/rio.h | 2 - include/linux/tc.h | 1 - include/pcmcia/ds.h | 1 - include/trace/events/swiotlb.h | 2 +- kernel/dma/direct.c | 4 +- kernel/dma/mapping.c | 2 +- sound/aoa/soundbus/i2sbus/core.c | 3 +- sound/ppc/snd_ps3.c | 6 +- sound/soc/bcm/cygnus-pcm.c | 5 +- 113 files changed, 184 insertions(+), 411 deletions(-)
arch/arm/common/locomo.c +1 -4
@@ -234,10 +234,7 @@ locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info)* If the parent device has a DMA mask associated with it, * propagate it down to the children. */ -if (lchip->dev->dma_mask) { - dev->dma_mask = *lchip->dev->dma_mask; - dev->dev.dma_mask = &dev->dma_mask; - } + dev->dev.dma_mask = lchip->dev->dma_mask;dev_set_name (&dev->dev,"%s" , info->name); dev->devid = info->devid;
arch/arm/common/sa1111.c +2 -3
@@ -717,7 +717,7 @@ sa1111_configure_smc(struct sa1111 *sachip, int sdram, unsigned int drac,* Chip Specification Update, June 2000, Erratum #7). */ if (sachip->dev->dma_mask) - *sachip->dev->dma_mask &= sa1111_dma_mask[drac >>2 ]; + sachip->dev->dma_mask &= sa1111_dma_mask[drac >>2 ]; sachip->dev->coherent_dma_mask &= sa1111_dma_mask[drac >>2 ]; }
@@ -765,8 +765,7 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent,* this child supports DMA, propagate it down to the children. */ if (info->dma && sachip->dev->dma_mask) { - dev->dma_mask = *sachip->dev->dma_mask; - dev->dev.dma_mask = &dev->dma_mask; + dev->dev.dma_mask = sachip->dev->dma_mask; dev->dev.coherent_dma_mask = sachip->dev->coherent_dma_mask; }
arch/arm/include/asm/dma-direct.h +1 -1
@@ -21,7 +21,7 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)if (!dev->dma_mask)return 0 ; - mask = *dev->dma_mask; + mask = dev->dma_mask; limit = (mask +1 ) & ~mask;if (limit && size > limit)
arch/arm/include/asm/dma-mapping.h +1 -1
@@ -92,7 +92,7 @@ static inline dma_addr_t virt_to_dma(struct device *dev, void *addr)/* The ARM override for dma_max_pfn() */ static inline unsigned long dma_max_pfn (struct device *dev) { -return dma_to_pfn (dev, *dev->dma_mask); +return dma_to_pfn (dev, dev->dma_mask); }#define dma_max_pfn (dev) dma_max_pfn(dev)
arch/arm/include/asm/ecard.h +0 -1
@@ -163,7 +163,6 @@ struct expansion_card {/* Private internal data */ const char *card_desc;/* Card description */ CONST loader_t loader; /* loader program */ -u64 dma_mask; };void ecard_setirq (struct expansion_card *ec,const struct expansion_card_ops *ops,void *irq_data);
arch/arm/include/asm/hardware/locomo.h +0 -2
@@ -175,8 +175,6 @@ struct locomo_dev {void *mapbase;unsigned long length; - -u64 dma_mask; };#define LOCOMO_DEV (_d) container_of((_d), struct locomo_dev, dev)
arch/arm/include/asm/hardware/sa1111.h +0 -1
@@ -391,7 +391,6 @@ struct sa1111_dev {void __iomem *mapbase;unsigned int skpcr_mask;unsigned int hwirq[6 ]; -u64 dma_mask; };#define to_sa1111_device (x) container_of(x, struct sa1111_dev, dev)
arch/arm/mach-davinci/devices.c +3 -9
@@ -89,15 +89,13 @@ static struct resource ide_resources[] = { }, }; -static u64 ide_dma_mask =DMA_BIT_MASK (32 ); -static struct platform_device ide_device = { .name ="palm_bk3710" , .id =-1 , .resource = ide_resources, .num_resources =ARRAY_SIZE (ide_resources), .dev = { - .dma_mask = &ide_dma_mask, + .dma_mask =DMA_BIT_MASK (32 ), .coherent_dma_mask =DMA_BIT_MASK (32 ), }, };
@@ -121,8 +119,6 @@ void __init davinci_init_ide(void) #if IS_ENABLED(CONFIG_MMC_DAVINCI) -static u64 mmcsd0_dma_mask = DMA_BIT_MASK(32); - static struct resource mmcsd0_resources[] = { { /* different on dm355 */
@@ -145,15 +141,13 @@ static struct platform_device davinci_mmcsd0_device = { .name = "dm6441-mmc", .id = 0, .dev = { - .dma_mask = &mmcsd0_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(mmcsd0_resources), .resource = mmcsd0_resources, }; -static u64 mmcsd1_dma_mask =DMA_BIT_MASK (32 ); -static struct resource mmcsd1_resources[] = { { .start =DM355_MMCSD1_BASE ,
@@ -174,7 +168,7 @@ static struct platform_device davinci_mmcsd1_device = { .name = "dm6441-mmc", .id = 1, .dev = { - .dma_mask = &mmcsd1_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(mmcsd1_resources),
arch/arm/mach-davinci/dm355.c +7 -10
@@ -46,8 +46,6 @@*/ #define DM355_REF_FREQ 24000000/* 24 or 36 MHz */ -static u64 dm355_spi0_dma_mask =DMA_BIT_MASK (32 ); -static struct resource dm355_spi0_resources[] = { { .start =0x01c66000 ,
@@ -71,7 +69,7 @@ static struct platform_device dm355_spi0_device = { .name = "spi_davinci", .id = 0, .dev = { - .dma_mask = &dm355_spi0_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = &dm355_spi0_pdata, },
@@ -371,7 +369,6 @@ static struct resource vpfe_resources[] = { }, }; -static u64 vpfe_capture_dma_mask =DMA_BIT_MASK (32 );static struct resource dm355_ccdc_resource[] = {/* CCDC Base address */ {
@@ -386,7 +383,7 @@ static struct platform_device dm355_ccdc_dev = { .num_resources = ARRAY_SIZE(dm355_ccdc_resource), .resource = dm355_ccdc_resource, .dev = { - .dma_mask = &vpfe_capture_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = dm355_ccdc_setup_pinmux, },
@@ -398,7 +395,7 @@ static struct platform_device vpfe_capture_dev = { .num_resources = ARRAY_SIZE(vpfe_resources), .resource = vpfe_resources, .dev = { - .dma_mask = &vpfe_capture_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, };
@@ -417,7 +414,7 @@ static struct platform_device dm355_osd_dev = { .num_resources = ARRAY_SIZE(dm355_osd_resources), .resource = dm355_osd_resources, .dev = { - .dma_mask = &vpfe_capture_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, };
@@ -511,7 +508,7 @@ static struct platform_device dm355_vpbe_display = { .num_resources = ARRAY_SIZE(dm355_v4l2_disp_resources), .resource = dm355_v4l2_disp_resources, .dev = { - .dma_mask = &vpfe_capture_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, };
@@ -527,7 +524,7 @@ static struct platform_device dm355_venc_dev = { .num_resources = ARRAY_SIZE(dm355_venc_resources), .resource = dm355_venc_resources, .dev = { - .dma_mask = &vpfe_capture_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = (void *)&dm355_venc_pdata, },
@@ -537,7 +534,7 @@ static struct platform_device dm355_vpbe_dev = { .name = "vpbe_controller", .id = -1, .dev = { - .dma_mask = &vpfe_capture_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, };
arch/arm/mach-davinci/dm365.c +1 -3
@@ -210,8 +210,6 @@ EVT_CFG(DM365, EVT3_VC_RX, 1, 1, 1, false)#endif }; -static u64 dm365_spi0_dma_mask =DMA_BIT_MASK (32 ); -static struct davinci_spi_platform_data dm365_spi0_pdata = { .version =SPI_VERSION_1 , .num_chipselect =2 ,
@@ -235,7 +233,7 @@ static struct platform_device dm365_spi0_device = { .name = "spi_davinci", .id = 0, .dev = { - .dma_mask = &dm365_spi0_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = &dm365_spi0_pdata, },
arch/arm/mach-iop13xx/setup.c +3 -4
@@ -300,7 +300,6 @@ static struct resource iop13xx_adma_2_resources[] = { } }; -static u64 iop13xx_adma_dmamask =DMA_BIT_MASK (32 );static struct iop_adma_platform_data iop13xx_adma_0_data = { .hw_id =0 , .pool_size =PAGE_SIZE ,
@@ -323,7 +322,7 @@ static struct platform_device iop13xx_adma_0_channel = { .num_resources = 4, .resource = iop13xx_adma_0_resources, .dev = { - .dma_mask = &iop13xx_adma_dmamask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = (void *) &iop13xx_adma_0_data, },
@@ -335,7 +334,7 @@ static struct platform_device iop13xx_adma_1_channel = { .num_resources = 4, .resource = iop13xx_adma_1_resources, .dev = { - .dma_mask = &iop13xx_adma_dmamask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = (void *) &iop13xx_adma_1_data, },
@@ -347,7 +346,7 @@ static struct platform_device iop13xx_adma_2_channel = { .num_resources = 4, .resource = iop13xx_adma_2_resources, .dev = { - .dma_mask = &iop13xx_adma_dmamask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = (void *) &iop13xx_adma_2_data, },
arch/arm/mach-ixp4xx/common.c +4 -5
@@ -300,17 +300,16 @@ static int ixp4xx_platform_notify_remove(struct device *dev)*/ static int ixp4xx_platform_notify (struct device *dev) { - dev->dma_mask = &dev->coherent_dma_mask; + dev->dma_mask =DMA_BIT_MASK (32 );#ifdef CONFIG_PCI if (dev_is_pci (dev)) { - dev->coherent_dma_mask =DMA_BIT_MASK (28 );/* 64 MB */ + dev->dma_mask =DMA_BIT_MASK (28 );/* 64 MB */ dmabounce_register_dev (dev,2048 ,4096 , ixp4xx_needs_bounce); -return 0 ; - } + } else#endif - dev->coherent_dma_mask =DMA_BIT_MASK (32 ); + dev->coherent_dma_mask = dev->dma_mask;return 0 ; }
arch/arm/mach-mmp/pxa168.c +1 -2
@@ -154,12 +154,11 @@ struct resource pxa168_usb_host_resources[] = { }, }; -static u64 pxa168_usb_host_dmamask =DMA_BIT_MASK (32 );struct platform_device pxa168_device_usb_host = { .name ="pxa-sph" , .id =-1 , .dev = { - .dma_mask = &pxa168_usb_host_dmamask, + .dma_mask =DMA_BIT_MASK (32 ), .coherent_dma_mask =DMA_BIT_MASK (32 ), },
arch/arm/mach-pxa/devices.c +23 -57
308 lines not on this page · raw message
arch/arm/mach-rpc/ecard.c +1 -2
@@ -704,8 +704,7 @@ static struct expansion_card *__init ecard_alloc_card(int type, int slot)dev_set_name (&ec->dev,"ecard%d" , slot); ec->dev.parent =NULL ; ec->dev.bus = &ecard_bus_type; - ec->dev.dma_mask = &ec->dma_mask; - ec->dma_mask = (u64 )0xffffffff ; + ec->dev.dma_mask = (u64 )0xffffffff ; ec->dev.coherent_dma_mask = ec->dma_mask;if (slot <4 ) {
arch/arm/mach-s3c24xx/common.c +4 -6
@@ -290,8 +290,6 @@ struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = { }, }; -#define s3c24xx_device_dma_mask (*((u64[]) { DMA_BIT_MASK(32) })) -#if defined(CONFIG_CPU_S3C2410 ) || defined(CONFIG_CPU_S3C2412 ) || \ defined(CONFIG_CPU_S3C2440 ) || defined(CONFIG_CPU_S3C2442 ) static struct resource s3c2410_dma_resource[] = {
@@ -372,7 +370,7 @@ struct platform_device s3c2410_device_dma = { .num_resources = ARRAY_SIZE(s3c2410_dma_resource), .resource = s3c2410_dma_resource, .dev = { - .dma_mask = &s3c24xx_device_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = &s3c2410_dma_platdata, },
@@ -441,7 +439,7 @@ struct platform_device s3c2412_device_dma = { .num_resources = ARRAY_SIZE(s3c2410_dma_resource), .resource = s3c2410_dma_resource, .dev = { - .dma_mask = &s3c24xx_device_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = &s3c2412_dma_platdata, },
@@ -533,7 +531,7 @@ struct platform_device s3c2440_device_dma = { .num_resources = ARRAY_SIZE(s3c2410_dma_resource), .resource = s3c2410_dma_resource, .dev = { - .dma_mask = &s3c24xx_device_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = &s3c2440_dma_platdata, },
@@ -607,7 +605,7 @@ struct platform_device s3c2443_device_dma = { .num_resources = ARRAY_SIZE(s3c2443_dma_resource), .resource = s3c2443_dma_resource, .dev = { - .dma_mask = &s3c24xx_device_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = &s3c2443_dma_platdata, },
arch/arm/mach-s3c64xx/dev-audio.c +1 -3
@@ -189,8 +189,6 @@ static struct resource s3c64xx_ac97_resource[] = {static struct s3c_audio_pdata s3c_ac97_pdata = { }; -static u64 s3c64xx_ac97_dmamask =DMA_BIT_MASK (32 ); -struct platform_device s3c64xx_device_ac97 = { .name ="samsung-ac97" , .id =-1 ,
@@ -198,7 +196,7 @@ struct platform_device s3c64xx_device_ac97 = { .resource = s3c64xx_ac97_resource, .dev = { .platform_data = &s3c_ac97_pdata, - .dma_mask = &s3c64xx_ac97_dmamask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, };
arch/arm/mach-sa1100/badge4.c +1 -3
@@ -64,13 +64,11 @@ static struct sa1111_platform_data sa1111_info = { .disable = badge4_sa1111_disable, }; -static u64 sa1111_dmamask =0xffffffffUL ; -static struct platform_device sa1111_device = { .name ="sa1111" , .id =0 , .dev = { - .dma_mask = &sa1111_dmamask, + .dma_mask =0xffffffffUL , .coherent_dma_mask =0xffffffff , .platform_data = &sa1111_info, },
arch/arm/mach-sa1100/generic.c +4 -12
@@ -126,13 +126,11 @@ static struct resource sa11x0udc_resources[] = { [1] = DEFINE_RES_IRQ(IRQ_Ser0UDC), }; -static u64 sa11x0udc_dma_mask =0xffffffffUL ; -static struct platform_device sa11x0udc_device = { .name ="sa11x0-udc" , .id =-1 , .dev = { - .dma_mask = &sa11x0udc_dma_mask, + .dma_mask =0xffffffffUL , .coherent_dma_mask =0xffffffff , }, .num_resources =ARRAY_SIZE (sa11x0udc_resources),
@@ -169,13 +167,11 @@ static struct resource sa11x0mcp_resources[] = { [2] = DEFINE_RES_IRQ(IRQ_Ser4MCP), }; -static u64 sa11x0mcp_dma_mask =0xffffffffUL ; -static struct platform_device sa11x0mcp_device = { .name ="sa11x0-mcp" , .id =-1 , .dev = { - .dma_mask = &sa11x0mcp_dma_mask, + .dma_mask =0xffffffffUL , .coherent_dma_mask =0xffffffff , }, .num_resources =ARRAY_SIZE (sa11x0mcp_resources),
@@ -202,13 +198,11 @@ static struct resource sa11x0ssp_resources[] = { [1] = DEFINE_RES_IRQ(IRQ_Ser4SSP), }; -static u64 sa11x0ssp_dma_mask =0xffffffffUL ; -static struct platform_device sa11x0ssp_device = { .name ="sa11x0-ssp" , .id =-1 , .dev = { - .dma_mask = &sa11x0ssp_dma_mask, + .dma_mask =0xffffffffUL , .coherent_dma_mask =0xffffffff , }, .num_resources =ARRAY_SIZE (sa11x0ssp_resources),
@@ -298,13 +292,11 @@ static struct resource sa11x0dma_resources[] = { DEFINE_RES_IRQ(IRQ_DMA5), }; -static u64 sa11x0dma_dma_mask =DMA_BIT_MASK (32 ); -static struct platform_device sa11x0dma_device = { .name ="sa11x0-dma" , .id =-1 , .dev = { - .dma_mask = &sa11x0dma_dma_mask, + .dma_mask =DMA_BIT_MASK (32 ), .coherent_dma_mask =0xffffffff , }, .num_resources =ARRAY_SIZE (sa11x0dma_resources),
arch/arm/mach-sa1100/jornada720.c +1 -3
@@ -210,13 +210,11 @@ static struct sa1111_platform_data sa1111_info = { .disable_devs = SA1111_DEVID_PS2_MSE, }; -static u64 sa1111_dmamask =0xffffffffUL ; -static struct platform_device sa1111_device = { .name ="sa1111" , .id =0 , .dev = { - .dma_mask = &sa1111_dmamask, + .dma_mask =0xffffffffUL , .coherent_dma_mask =0xffffffff , .platform_data = &sa1111_info, },
arch/arm/mach-w90x900/dev.c +3 -7
@@ -107,15 +107,13 @@ static struct resource nuc900_usb_ehci_resource[] = { } }; -static u64 nuc900_device_usb_ehci_dmamask =0xffffffffUL ; -static struct platform_device nuc900_device_usb_ehci = { .name ="nuc900-ehci" , .id =-1 , .num_resources =ARRAY_SIZE (nuc900_usb_ehci_resource), .resource = nuc900_usb_ehci_resource, .dev = { - .dma_mask = &nuc900_device_usb_ehci_dmamask, + .dma_mask =0xffffffffUL , .coherent_dma_mask =0xffffffffUL } };
@@ -135,14 +133,13 @@ static struct resource nuc900_usb_ohci_resource[] = { } }; -static u64 nuc900_device_usb_ohci_dmamask =0xffffffffUL ;static struct platform_device nuc900_device_usb_ohci = { .name ="nuc900-ohci" , .id =-1 , .num_resources =ARRAY_SIZE (nuc900_usb_ohci_resource), .resource = nuc900_usb_ohci_resource, .dev = { - .dma_mask = &nuc900_device_usb_ohci_dmamask, + .dma_mask =0xffffffffUL , .coherent_dma_mask =0xffffffffUL } };
@@ -189,14 +186,13 @@ static struct resource nuc900_emc_resource[] = { } }; -static u64 nuc900_device_emc_dmamask =0xffffffffUL ;static struct platform_device nuc900_device_emc = { .name ="nuc900-emc" , .id =-1 , .num_resources =ARRAY_SIZE (nuc900_emc_resource), .resource = nuc900_emc_resource, .dev = { - .dma_mask = &nuc900_device_emc_dmamask, + .dma_mask =0xffffffffUL , .coherent_dma_mask =0xffffffffUL } };
arch/arm/plat-iop/adma.c +3 -5
@@ -119,8 +119,6 @@ static struct resource iop3xx_aau_resources[] = { } }; -static u64 iop3xx_adma_dmamask =DMA_BIT_MASK (32 ); -static struct iop_adma_platform_data iop3xx_dma_0_data = { .hw_id =DMA0_ID , .pool_size =PAGE_SIZE ,
@@ -142,7 +140,7 @@ struct platform_device iop3xx_dma_0_channel = { .num_resources = 4, .resource = iop3xx_dma_0_resources, .dev = { - .dma_mask = &iop3xx_adma_dmamask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = (void *) &iop3xx_dma_0_data, },
@@ -154,7 +152,7 @@ struct platform_device iop3xx_dma_1_channel = { .num_resources = 4, .resource = iop3xx_dma_1_resources, .dev = { - .dma_mask = &iop3xx_adma_dmamask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = (void *) &iop3xx_dma_1_data, },
@@ -166,7 +164,7 @@ struct platform_device iop3xx_aau_channel = { .num_resources = 4, .resource = iop3xx_aau_resources, .dev = { - .dma_mask = &iop3xx_adma_dmamask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = (void *) &iop3xx_aau_data, },
arch/m68k/coldfire/device.c +3 -3
@@ -139,7 +139,7 @@ static struct platform_device mcf_fec0 = { .num_resources = ARRAY_SIZE(mcf_fec0_resources), .resource = mcf_fec0_resources, .dev = { - .dma_mask = &mcf_fec0.dev.coherent_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = FEC_PDATA, }
@@ -175,7 +175,7 @@ static struct platform_device mcf_fec1 = { .num_resources = ARRAY_SIZE(mcf_fec1_resources), .resource = mcf_fec1_resources, .dev = { - .dma_mask = &mcf_fec1.dev.coherent_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = FEC_PDATA, }
@@ -546,7 +546,7 @@ static struct platform_device mcf_edma = { .num_resources = ARRAY_SIZE(mcf_edma_resources), .resource = mcf_edma_resources, .dev = { - .dma_mask = &mcf_edma_dmamask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = &mcf_edma_data, }
arch/m68k/kernel/dma.c +3 -4
@@ -78,7 +78,7 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, {void *ret; -if (dev ==NULL || (*dev->dma_mask <0xffffffff )) +if (dev ==NULL || (dev->dma_mask <0xffffffff )) gfp |=GFP_DMA ; ret = (void *)__get_free_pages (gfp,get_order (size));
@@ -117,9 +117,8 @@ void arch_sync_dma_for_device(struct device *dev, phys_addr_t handle,void arch_setup_pdev_archdata (struct platform_device *pdev) { -if (pdev->dev.coherent_dma_mask ==DMA_MASK_NONE && - pdev->dev.dma_mask ==NULL ) { +if (!pdev->dev.coherent_dma_mask && !pdev->dev.dma_mask) { pdev->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); - pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; + pdev->dev.dma_mask =DMA_BIT_MASK (32 ); } }
arch/mips/alchemy/common/platform.c +5 -7
@@ -131,8 +131,6 @@ static void __init alchemy_setup_uarts(int ctype) } -static u64 alchemy_all_dmamask =DMA_BIT_MASK (32 ); -/* Power on callback for the ehci platform driver */ static int alchemy_ehci_power_on (struct platform_device *pdev) {
@@ -229,7 +227,7 @@ static void __init alchemy_setup_usb(int ctype) res[1 ].flags =IORESOURCE_IRQ ; pdev->name ="ohci-platform" ; pdev->id =0 ; - pdev->dev.dma_mask = &alchemy_all_dmamask; + pdev->dev.dma_mask =DMA_BIT_MASK (32 ); pdev->dev.platform_data = &alchemy_ohci_pdata;if (platform_device_register (pdev))
@@ -249,7 +247,7 @@ static void __init alchemy_setup_usb(int ctype) res[1 ].flags =IORESOURCE_IRQ ; pdev->name ="ehci-platform" ; pdev->id =0 ; - pdev->dev.dma_mask = &alchemy_all_dmamask; + pdev->dev.dma_mask =DMA_BIT_MASK (32 ); pdev->dev.platform_data = &alchemy_ehci_pdata;if (platform_device_register (pdev))
@@ -269,7 +267,7 @@ static void __init alchemy_setup_usb(int ctype) res[1 ].flags =IORESOURCE_IRQ ; pdev->name ="ohci-platform" ; pdev->id =1 ; - pdev->dev.dma_mask = &alchemy_all_dmamask; + pdev->dev.dma_mask =DMA_BIT_MASK (32 ); pdev->dev.platform_data = &alchemy_ohci_pdata;if (platform_device_register (pdev))
@@ -337,7 +335,7 @@ static struct platform_device au1xxx_eth0_device = { .id = 0, .num_resources = MAC_RES_COUNT, .dev = { - .dma_mask = &alchemy_all_dmamask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = &au1xxx_eth0_platform_data, },
@@ -373,7 +371,7 @@ static struct platform_device au1xxx_eth1_device = { .id = 1, .num_resources = MAC_RES_COUNT, .dev = { - .dma_mask = &alchemy_all_dmamask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = &au1xxx_eth1_platform_data, },
arch/mips/bcm63xx/dev-enet.c +3 -5
@@ -70,8 +70,6 @@ static struct platform_device bcm63xx_enet_shared_device = {static int shared_device_registered; -static u64 enet_dmamask =DMA_BIT_MASK (32 ); -static struct resource enet0_res[] = { { .start =-1 ,/* filled at runtime */
@@ -101,7 +99,7 @@ static struct platform_device bcm63xx_enet0_device = { .resource = enet0_res, .dev = { .platform_data = &enet0_pd, - .dma_mask = &enet_dmamask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, };
@@ -135,7 +133,7 @@ static struct platform_device bcm63xx_enet1_device = { .resource = enet1_res, .dev = { .platform_data = &enet1_pd, - .dma_mask = &enet_dmamask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, };
@@ -163,7 +161,7 @@ static struct platform_device bcm63xx_enetsw_device = { .resource = enetsw_res, .dev = { .platform_data = &enetsw_pd, - .dma_mask = &enet_dmamask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, };
arch/mips/jz4740/platform.c +3 -3
@@ -56,7 +56,7 @@ struct platform_device jz4740_udc_device = { .name = "musb-jz4740", .id = -1, .dev = { - .dma_mask = &jz4740_udc_device.dev.coherent_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(jz4740_udc_resources),
@@ -81,7 +81,7 @@ struct platform_device jz4740_mmc_device = { .name = "jz4740-mmc", .id = 0, .dev = { - .dma_mask = &jz4740_mmc_device.dev.coherent_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(jz4740_mmc_resources),
@@ -164,7 +164,7 @@ struct platform_device jz4740_framebuffer_device = { .num_resources = ARRAY_SIZE(jz4740_framebuffer_resources), .resource = jz4740_framebuffer_resources, .dev = { - .dma_mask = &jz4740_framebuffer_device.dev.coherent_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, };
arch/mips/loongson32/common/platform.c +1 -3
@@ -256,8 +256,6 @@ struct platform_device ls1x_gpio1_pdev = { };/* USB EHCI */ -static u64 ls1x_ehci_dmamask =DMA_BIT_MASK (32 ); -static struct resource ls1x_ehci_resources[] = { [0 ] = { .start =LS1X_EHCI_BASE ,
@@ -279,7 +277,7 @@ struct platform_device ls1x_ehci_pdev = { .num_resources = ARRAY_SIZE(ls1x_ehci_resources), .resource = ls1x_ehci_resources, .dev = { - .dma_mask = &ls1x_ehci_dmamask, + .dma_mask = DMA_BIT_MASK(32), .platform_data = &ls1x_ehci_pdata, }, };
arch/mips/pmcs-msp71xx/msp_usb.c +2 -6
@@ -61,14 +61,12 @@ static struct resource msp_usbhost0_resources[] = { }, }; -static u64 msp_usbhost0_dma_mask =0xffffffffUL ; -static struct mspusb_device msp_usbhost0_device = { .dev = { .name ="pmcmsp-ehci" , .id =0 , .dev = { - .dma_mask = &msp_usbhost0_dma_mask, + .dma_mask =0xffffffffUL , .coherent_dma_mask =0xffffffffUL , }, .num_resources =ARRAY_SIZE (msp_usbhost0_resources),
@@ -101,15 +99,13 @@ static struct resource msp_usbdev0_resources[] = { }, }; -static u64 msp_usbdev_dma_mask =0xffffffffUL ; -/* This may need to be converted to a mspusb_device, too. */ static struct mspusb_device msp_usbdev0_device = { .dev = { .name ="msp71xx_udc" , .id =0 , .dev = { - .dma_mask = &msp_usbdev_dma_mask, + .dma_mask =0xffffffffUL , .coherent_dma_mask =0xffffffffUL , }, .num_resources =ARRAY_SIZE (msp_usbdev0_resources),
arch/mips/sgi-ip22/ip22-platform.c +3 -9
@@ -26,8 +26,6 @@ static struct sgiwd93_platform_data sgiwd93_0_pd = { .irq = SGI_WD93_0_IRQ, }; -static u64 sgiwd93_0_dma_mask =DMA_BIT_MASK (32 ); -static struct platform_device sgiwd93_0_device = { .name ="sgiwd93" , .id =0 ,
@@ -35,7 +33,7 @@ static struct platform_device sgiwd93_0_device = { .resource = sgiwd93_0_resources, .dev = { .platform_data = &sgiwd93_0_pd, - .dma_mask = &sgiwd93_0_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, };
@@ -54,8 +52,6 @@ static struct sgiwd93_platform_data sgiwd93_1_pd = { .irq = SGI_WD93_1_IRQ, }; -static u64 sgiwd93_1_dma_mask =DMA_BIT_MASK (32 ); -static struct platform_device sgiwd93_1_device = { .name ="sgiwd93" , .id =1 ,
@@ -63,7 +59,7 @@ static struct platform_device sgiwd93_1_device = { .resource = sgiwd93_1_resources, .dev = { .platform_data = &sgiwd93_1_pd, - .dma_mask = &sgiwd93_1_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, };
@@ -105,8 +101,6 @@ static struct resource sgiseeq_0_resources[] = {static struct sgiseeq_platform_data eth0_pd; -static u64 sgiseeq_dma_mask =DMA_BIT_MASK (32 ); -static struct platform_device eth0_device = { .name ="sgiseeq" , .id =0 ,
@@ -114,7 +108,7 @@ static struct platform_device eth0_device = { .resource = sgiseeq_0_resources, .dev = { .platform_data = ð0_pd, - .dma_mask = &sgiseeq_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, };
arch/parisc/include/asm/parisc-device.h +0 -1
@@ -26,7 +26,6 @@ struct parisc_device {unsigned long pmod_loc;/* physical Module location */ unsigned long mod0;#endif -u64 dma_mask;/* DMA mask for I/O */ struct device dev; };
arch/parisc/kernel/drivers.c +2 -4
@@ -432,11 +432,9 @@ struct parisc_device * __init create_tree_node(char id, struct device *parent)setup_bus_id (dev); dev->dev.bus = &parisc_bus_type; - dev->dma_mask =0xffffffffUL ;/* PARISC devices are 32-bit */ -/* make the generic dma mask a pointer to the parisc one */ - dev->dev.dma_mask = &dev->dma_mask; - dev->dev.coherent_dma_mask = dev->dma_mask; + dev->dev.dma_mask =0xffffffffUL ;/* PARISC devices are 32-bit */ + dev->dev.coherent_dma_mask =0xffffffffUL ;if (device_register (&dev->dev)) {kfree (dev);return NULL ;
arch/powerpc/include/asm/device.h +0 -1
@@ -53,7 +53,6 @@ struct dev_archdata { };struct pdev_archdata { -u64 dma_mask; };#endif /* _ASM_POWERPC_DEVICE_H */
arch/powerpc/include/asm/dma-direct.h +1 -1
@@ -8,7 +8,7 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)return false;return addr + size -1 <= -min_not_zero (*dev->dma_mask, dev->bus_dma_mask); +min_not_zero (dev->dma_mask, dev->bus_dma_mask); }static inline dma_addr_t __phys_to_dma (struct device *dev,phys_addr_t paddr)
arch/powerpc/include/asm/iommu.h +0 -8
@@ -327,13 +327,5 @@ extern bool iommu_fixed_is_weak;extern const struct dma_map_ops dma_iommu_ops; -static inline unsigned long device_to_mask (struct device *dev) -{ -if (dev->dma_mask && *dev->dma_mask) -return *dev->dma_mask; -/* Assume devices without mask can take 32 bit addresses */ -return 0xfffffffful ; -} -#endif /* __KERNEL__ */ #endif /* _ASM_IOMMU_H */
arch/powerpc/kernel/dma-iommu.c +2 -2
@@ -71,7 +71,7 @@ static dma_addr_t dma_iommu_map_page(struct device *dev, struct page *page,return dma_direct_map_page (dev, page, offset, size, direction, attrs);return iommu_map_page (dev,get_iommu_table_base (dev), page, offset, - size,device_to_mask (dev), direction, attrs); + size,dma_get_mask (dev), direction, attrs); }
@@ -92,7 +92,7 @@ static int dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,if (dma_iommu_map_bypass (dev, attrs))return dma_direct_map_sg (dev, sglist, nelems, direction, attrs);return ppc_iommu_map_sg (dev,get_iommu_table_base (dev), sglist, nelems, -device_to_mask (dev), direction, attrs); +dma_get_mask (dev), direction, attrs); } static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist,
arch/powerpc/kernel/pci_of_scan.c +2 -1
@@ -159,7 +159,8 @@ struct pci_dev *of_create_pci_dev(struct device_node *node, dev->current_state =PCI_UNKNOWN ;/* unknown power state */ dev->error_state = pci_channel_io_normal; - dev->dma_mask =0xffffffff ; + dev->dev.dma_mask =0xffffffff ; + dev->dev.coherent_dma_mask =0xffffffff ;/* Early fixups, before probing the BARs */ pci_fixup_device (pci_fixup_early, dev);
arch/powerpc/kernel/setup-common.c +1 -2
@@ -784,8 +784,7 @@ void ppc_printk_progress(char *s, unsigned short hex)void arch_setup_pdev_archdata (struct platform_device *pdev) { - pdev->archdata.dma_mask =DMA_BIT_MASK (32 ); - pdev->dev.dma_mask = &pdev->archdata.dma_mask; + pdev->dev.dma_mask =DMA_BIT_MASK (32 ); }static __init void print_system_info (void )
arch/powerpc/platforms/pseries/vio.c +3 -3
@@ -524,7 +524,7 @@ static dma_addr_t vio_dma_iommu_map_page(struct device *dev, struct page *page,if (vio_cmo_alloc (viodev,roundup (size,IOMMU_PAGE_SIZE (tbl)))) goto out_fail; - ret =iommu_map_page (dev, tbl, page, offset, size,device_to_mask (dev), + ret =iommu_map_page (dev, tbl, page, offset, size,dma_get_mask (dev), direction, attrs);if (unlikely (ret ==DMA_MAPPING_ERROR )) goto out_deallocate;
@@ -564,7 +564,7 @@ static int vio_dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,if (vio_cmo_alloc (viodev, alloc_size)) goto out_fail; - ret =ppc_iommu_map_sg (dev, tbl, sglist, nelems,device_to_mask (dev), + ret =ppc_iommu_map_sg (dev, tbl, sglist, nelems,dma_get_mask (dev), direction, attrs);if (unlikely (!ret)) goto out_deallocate;
@@ -1430,7 +1430,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)/* needed to ensure proper operation of coherent allocations * later, in case driver doesn't set it explicitly */ viodev->dev.coherent_dma_mask =DMA_BIT_MASK (64 ); - viodev->dev.dma_mask = &viodev->dev.coherent_dma_mask; + viodev->dev.dma_mask =DMA_BIT_MASK (64 ); }/* register with generic device framework */
arch/sh/boards/mach-ecovec24/setup.c +4 -4
@@ -205,7 +205,7 @@ static struct platform_device usb0_host_device = { .name = "r8a66597_hcd", .id = 0, .dev = { - .dma_mask = NULL, /* not use dma */ + .dma_mask = 0, /* not use dma */ .coherent_dma_mask = 0xffffffff, .platform_data = &usb0_host_data, },
@@ -241,7 +241,7 @@ static struct platform_device usb1_common_device = {/* .name will be added in arch_setup */ .id = 1, .dev = { - .dma_mask = NULL, /* not use dma */ + .dma_mask = 0, /* not use dma */ .coherent_dma_mask = 0xffffffff, .platform_data = &usb1_common_data, },
@@ -298,7 +298,7 @@ static struct platform_device usbhs_device = { .name = "renesas_usbhs", .id = 1, .dev = { - .dma_mask = NULL, /* not use dma */ + .dma_mask = 0, /* not use dma */ .coherent_dma_mask = 0xffffffff, .platform_data = &usbhs_info, },
@@ -887,7 +887,7 @@ static struct platform_device fsi_da7210_device = { .dev = { .platform_data = &fsi_da7210_info, .coherent_dma_mask = DMA_BIT_MASK(32), - .dma_mask = &fsi_da7210_device.dev.coherent_dma_mask, + .dma_mask = DMA_BIT_MASK(32), }, };
arch/sh/kernel/cpu/sh4a/setup-sh7757.c +2 -3
@@ -639,7 +639,6 @@ static struct platform_device spi0_device = { .name = "sh_spi", .id = 0, .dev = { - .dma_mask = NULL, .coherent_dma_mask = 0xffffffff, }, .num_resources = ARRAY_SIZE(spi0_resources),
@@ -701,7 +700,7 @@ static struct platform_device usb_ehci_device = { .name = "sh_ehci", .id = -1, .dev = { - .dma_mask = &usb_ehci_device.dev.coherent_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), }, .num_resources = ARRAY_SIZE(usb_ehci_resources),
@@ -727,7 +726,7 @@ static struct platform_device usb_ohci_device = { .name = "ohci-platform", .id = -1, .dev = { - .dma_mask = &usb_ohci_device.dev.coherent_dma_mask, + .dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = &usb_ohci_pdata, },
arch/sparc/kernel/of_device_32.c +1 -1
@@ -383,7 +383,7 @@ static struct platform_device * __init scan_one_device(struct device_node *dp,dev_set_name (&op->dev,"%08x" , dp->phandle); op->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); - op->dev.dma_mask = &op->dev.coherent_dma_mask; + op->dev.dma_mask =DMA_BIT_MASK (32 );if (of_device_register (op)) {printk ("%pOF: Could not register of device.\n" , dp);
arch/sparc/kernel/of_device_64.c +1 -1
@@ -676,7 +676,7 @@ static struct platform_device * __init scan_one_device(struct device_node *dp,else dev_set_name (&op->dev,"%08x" , dp->phandle); op->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); - op->dev.dma_mask = &op->dev.coherent_dma_mask; + op->dev.dma_mask =DMA_BIT_MASK (32 );if (of_device_register (op)) {printk ("%pOF: Could not register of device.\n" , dp);
drivers/acpi/arm64/iort.c +3 -14
@@ -1068,17 +1068,6 @@ void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *dma_size)u64 mask, dmaaddr =0 , size =0 , offset =0 ;int ret, msb; -/* -* If @dev is expected to be DMA-capable then the bus code that created -* it should have initialised its dma_mask pointer by this point. For -* now, we'll continue the legacy behaviour of coercing it to the -* coherent mask if not, but we'll no longer do so quietly. -*/ -if (!dev->dma_mask) { -dev_warn (dev,"DMA mask not set\n" ); - dev->dma_mask = &dev->coherent_dma_mask; - } -if (dev->coherent_dma_mask) size =max (dev->coherent_dma_mask, dev->coherent_dma_mask +1 );else
@@ -1107,7 +1096,7 @@ void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *dma_size)*/ dev->bus_dma_mask = mask; dev->coherent_dma_mask = mask; - *dev->dma_mask = mask; + dev->dma_mask = mask; } *dma_addr = dmaaddr;
@@ -1247,7 +1236,7 @@ static void __init arm_smmu_v3_dma_configure(struct device *dev, DEV_DMA_COHERENT :DEV_DMA_NON_COHERENT ;/* We expect the dma masks to be equivalent for all SMMUv3 set-ups */ - dev->dma_mask = &dev->coherent_dma_mask; + dev->dma_mask = dev->coherent_dma_mask;/* Configure DMA for the page table walker */ acpi_dma_configure (dev, attr);
@@ -1345,7 +1334,7 @@ static void __init arm_smmu_dma_configure(struct device *dev, DEV_DMA_COHERENT :DEV_DMA_NON_COHERENT ;/* We expect the dma masks to be equivalent for SMMU set-ups */ - dev->dma_mask = &dev->coherent_dma_mask; + dev->dma_mask = dev->coherent_dma_mask;/* Configure DMA for the page table walker */ acpi_dma_configure (dev, attr);
drivers/amba/bus.c +1 -1
@@ -559,6 +559,7 @@ amba_aphb_device_add(struct device *parent, const char *name,if (!dev)return ERR_PTR (-ENOMEM ); + dev->dev.dma_mask = dma_mask; dev->dev.coherent_dma_mask = dma_mask; dev->irq[0 ] = irq1; dev->irq[1 ] = irq2;
@@ -625,7 +626,6 @@ static void amba_device_initialize(struct amba_device *dev, const char *name)dev_set_name (&dev->dev,"%s" , name); dev->dev.release = amba_device_release; dev->dev.bus = &amba_bustype; - dev->dev.dma_mask = &dev->dev.coherent_dma_mask; dev->res.name =dev_name (&dev->dev); }
drivers/ata/ahci.c +1 -1
@@ -907,7 +907,7 @@ static int ahci_configure_dma_masks(struct pci_dev *pdev, int using_dac)* If the device fixup already set the dma_mask to some non-standard * value, don't extend it here. This happens on STA2X11, for example. */ -if (pdev->dma_mask && pdev->dma_mask <DMA_BIT_MASK (32 )) +if (pdev->dev.dma_mask && pdev->dev.dma_mask <DMA_BIT_MASK (32 ))return 0 ; if (using_dac &&
drivers/base/isa.c +1 -1
@@ -143,7 +143,7 @@ int isa_register_driver(struct isa_driver *isa_driver, unsigned int ndev) isa_dev->id = id; isa_dev->dev.coherent_dma_mask =DMA_BIT_MASK (24 ); - isa_dev->dev.dma_mask = &isa_dev->dev.coherent_dma_mask; + isa_dev->dev.dma_mask =DMA_BIT_MASK (24 ); error =device_register (&isa_dev->dev);if (error) {
drivers/base/platform.c +2 -18
@@ -550,23 +550,8 @@ struct platform_device *platform_device_register_full( pdev->dev.of_node =of_node_get (to_of_node (pdev->dev.fwnode)); pdev->dev.of_node_reused = pdevinfo->of_node_reused; -if (pdevinfo->dma_mask) { -/* -* This memory isn't freed when the device is put, -* I don't have a nice idea for that though. Conceptually -* dma_mask in struct device should not be a pointer. -* See http://thread.gmane.org/gmane.linux.kernel.pci/9081 -*/ - pdev->dev.dma_mask = -kmalloc (sizeof (*pdev->dev.dma_mask),GFP_KERNEL ); -if (!pdev->dev.dma_mask) - goto err; - -kmemleak_ignore (pdev->dev.dma_mask); - - *pdev->dev.dma_mask = pdevinfo->dma_mask; - pdev->dev.coherent_dma_mask = pdevinfo->dma_mask; - } +if (dma_set_mask_and_coherent (&pdev->dev, pdevinfo->dma_mask) <0 ) +WARN_ON_ONCE (1 ); ret =platform_device_add_resources (pdev, pdevinfo->res, pdevinfo->num_res);
@@ -589,7 +574,6 @@ struct platform_device *platform_device_register_full(if (ret) { err:ACPI_COMPANION_SET (&pdev->dev,NULL ); -kfree (pdev->dev.dma_mask);platform_device_put (pdev);return ERR_PTR (ret); }
drivers/bcma/main.c +2 -4
@@ -249,12 +249,10 @@ void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core) core->irq = bus->host_pci->irq;break ;case BCMA_HOSTTYPE_SOC : -if (IS_ENABLED (CONFIG_OF ) && bus->dev) { +if (IS_ENABLED (CONFIG_OF ) && bus->dev) core->dma_dev = bus->dev; - }else { - core->dev.dma_mask = &core->dev.coherent_dma_mask; +else core->dma_dev = &core->dev; - }break ;case BCMA_HOSTTYPE_SDIO :break ;
drivers/bus/fsl-mc/fsl-mc-bus.c +2 -3
@@ -630,9 +630,8 @@ int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,* parent's ICID and interrupt domain. */ mc_dev->icid = parent_mc_dev->icid; - mc_dev->dma_mask =FSL_MC_DEFAULT_DMA_MASK ; - mc_dev->dev.dma_mask = &mc_dev->dma_mask; - mc_dev->dev.coherent_dma_mask = mc_dev->dma_mask; + mc_dev->dev.dma_mask =FSL_MC_DEFAULT_DMA_MASK ; + mc_dev->dev.coherent_dma_mask =FSL_MC_DEFAULT_DMA_MASK ;dev_set_msi_domain (&mc_dev->dev,dev_get_msi_domain (&parent_mc_dev->dev)); }
drivers/crypto/ccree/cc_driver.c +0 -3
@@ -326,9 +326,6 @@ static int init_cc_resources(struct platform_device *plat_dev)init_completion (&new_drvdata->hw_queue_avail); -if (!plat_dev->dev.dma_mask) - plat_dev->dev.dma_mask = &plat_dev->dev.coherent_dma_mask; - dma_mask =DMA_BIT_MASK (DMA_BIT_MASK_LEN );while (dma_mask >0x7fffffffUL ) {if (dma_supported (&plat_dev->dev, dma_mask)) {
drivers/dma/bcm2835-dma.c +0 -3
@@ -867,9 +867,6 @@ static int bcm2835_dma_probe(struct platform_device *pdev)uint32_t chans_available;char chan_name[BCM2835_DMA_CHAN_NAME_SIZE ]; -if (!pdev->dev.dma_mask) - pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; - rc =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ));if (rc)return rc;
drivers/eisa/eisa-bus.c +2 -3
@@ -204,12 +204,11 @@ static int __init eisa_init_device(struct eisa_root_device *root, edev->state =inb (SLOT_ADDRESS (root, slot) +EISA_CONFIG_OFFSET ) &EISA_CONFIG_ENABLED ; edev->base_addr =SLOT_ADDRESS (root, slot); - edev->dma_mask = root->dma_mask;/* Default DMA mask */ eisa_name_device (edev); edev->dev.parent = root->dev; edev->dev.bus = &eisa_bus_type; - edev->dev.dma_mask = &edev->dma_mask; - edev->dev.coherent_dma_mask = edev->dma_mask; + edev->dev.dma_mask = root->dma_mask; + edev->dev.coherent_dma_mask = root->dma_mask;dev_set_name (&edev->dev,"%02X:%02X" , root->bus_nr, slot);for (i =0 ; i <EISA_MAX_RESOURCES ; i++) {
drivers/gpu/drm/etnaviv/etnaviv_drv.c +1 -1
@@ -653,7 +653,7 @@ static int __init etnaviv_init(void) goto unregister_platform_driver; } pdev->dev.coherent_dma_mask =DMA_BIT_MASK (40 ); - pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; + pdev->dev.dma_mask =DMA_BIT_MASK (40 );/* * Apply the same DMA configuration to the virtual etnaviv
drivers/gpu/host1x/bus.c +1 -1
@@ -416,7 +416,7 @@ static int host1x_device_add(struct host1x *host1x, device->driver = driver; device->dev.coherent_dma_mask = host1x->dev->coherent_dma_mask; - device->dev.dma_mask = &device->dev.coherent_dma_mask; + device->dev.dma_mask = device->dev.coherent_dma_mask;dev_set_name (&device->dev,"%s" , driver->driver.name); device->dev.release = host1x_device_release; device->dev.of_node = host1x->dev->of_node;
drivers/iommu/amd_iommu.c +3 -7
@@ -2454,7 +2454,6 @@ static dma_addr_t map_page(struct device *dev, struct page *page,phys_addr_t paddr =page_to_phys (page) + offset;struct protection_domain *domain;struct dma_ops_domain *dma_dom; -u64 dma_mask; domain =get_domain (dev);if (PTR_ERR (domain) == -EINVAL )
@@ -2462,10 +2461,9 @@ static dma_addr_t map_page(struct device *dev, struct page *page,else if (IS_ERR (domain))return DMA_MAPPING_ERROR ; - dma_mask = *dev->dma_mask; dma_dom =to_dma_ops_domain (domain); -return __map_single (dev, dma_dom, paddr, size, dir, dma_mask); +return __map_single (dev, dma_dom, paddr, size, dir, dev->dma_mask); }/*
@@ -2525,7 +2523,6 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,struct dma_ops_domain *dma_dom;struct scatterlist *s;unsigned long address; -u64 dma_mask;int ret; domain =get_domain (dev);
@@ -2533,11 +2530,10 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,return 0 ; dma_dom =to_dma_ops_domain (domain); - dma_mask = *dev->dma_mask; npages =sg_num_pages (dev, sglist, nelems); - address =dma_ops_alloc_iova (dev, dma_dom, npages, dma_mask); + address =dma_ops_alloc_iova (dev, dma_dom, npages, dev->dma_mask);if (address ==DMA_MAPPING_ERROR ) goto out_err;
@@ -2660,7 +2656,7 @@ static void *alloc_coherent(struct device *dev, size_t size, }if (!dma_mask) - dma_mask = *dev->dma_mask; + dma_mask = dev->dma_mask; *dma_addr =__map_single (dev, dma_dom,page_to_phys (page), size,DMA_BIDIRECTIONAL , dma_mask);
drivers/iommu/intel-iommu.c +4 -4
@@ -2999,7 +2999,7 @@ static int iommu_should_identity_map(struct device *dev, int startup)* If the device's dma_mask is less than the system's memory * size then this is not a candidate for identity mapping. */ -u64 dma_mask = *dev->dma_mask; +u64 dma_mask = dev->dma_mask;if (dev->coherent_dma_mask && dev->coherent_dma_mask < dma_mask)
@@ -3717,7 +3717,7 @@ static dma_addr_t intel_map_page(struct device *dev, struct page *page, {if (iommu_need_mapping (dev))return __intel_map_single (dev,page_to_phys (page) + offset, - size, dir, *dev->dma_mask); + size, dir, dev->dma_mask);return dma_direct_map_page (dev, page, offset, size, dir, attrs); }
@@ -3727,7 +3727,7 @@ static dma_addr_t intel_map_resource(struct device *dev, phys_addr_t phys_addr, {if (iommu_need_mapping (dev))return __intel_map_single (dev, phys_addr, size, dir, - *dev->dma_mask); + dev->dma_mask);return dma_direct_map_resource (dev, phys_addr, size, dir, attrs); }
@@ -3892,7 +3892,7 @@ static int intel_map_sg(struct device *dev, struct scatterlist *sglist, int nele size +=aligned_nrpages (sg->offset, sg->length); iova_pfn =intel_alloc_iova (dev, domain,dma_to_mm_pfn (size), - *dev->dma_mask); + dev->dma_mask);if (!iova_pfn) { sglist->dma_length =0 ;return 0 ;
drivers/macintosh/macio_asic.c +2 -3
@@ -374,9 +374,8 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, dev->bus = &chip->lbus; dev->media_bay = in_bay; dev->ofdev.dev.of_node = np; - dev->ofdev.archdata.dma_mask =0xffffffffUL ; - dev->ofdev.dev.dma_mask = &dev->ofdev.archdata.dma_mask; - dev->ofdev.dev.coherent_dma_mask = dev->ofdev.archdata.dma_mask; + dev->ofdev.dev.dma_mask =0xffffffffUL ; + dev->ofdev.dev.coherent_dma_mask =0xffffffffUL ; dev->ofdev.dev.parent = parent; dev->ofdev.dev.bus = &macio_bus_type; dev->ofdev.dev.release = macio_release_dev;
drivers/media/platform/via-camera.c +1 -1
@@ -1386,7 +1386,7 @@ static int viacam_probe(struct platform_device *pdev)/* * Convince the system that we can do DMA. */ - pdev->dev.dma_mask = &viadev->pdev->dma_mask; + pdev->dev.dma_mask = viadev->pdev->dev.dma_mask;dma_set_mask (&pdev->dev,0xffffffff );/* * Fire up the capture port. The write to 0x78 looks purely
drivers/misc/mic/bus/mic_bus.c +1 -1
@@ -159,7 +159,7 @@ mbus_register_device(struct device *pdev, int id, const struct dma_map_ops *dma_ mbdev->id.device = id; mbdev->id.vendor =MBUS_DEV_ANY_ID ; mbdev->dev.dma_ops = dma_ops; - mbdev->dev.dma_mask = &mbdev->dev.coherent_dma_mask; + mbdev->dev.dma_mask =DMA_BIT_MASK (64 );dma_set_mask (&mbdev->dev,DMA_BIT_MASK (64 )); mbdev->dev.release = mbus_release_dev; mbdev->hw_ops = hw_ops;
drivers/misc/mic/bus/scif_bus.c +1 -1
@@ -165,7 +165,7 @@ scif_register_device(struct device *pdev, int id, const struct dma_map_ops *dma_ sdev->aper = aper; sdev->dp = dp; sdev->rdp = rdp; - sdev->dev.dma_mask = &sdev->dev.coherent_dma_mask; + sdev->dev.dma_mask =DMA_BIT_MASK (64 );dma_set_mask (&sdev->dev,DMA_BIT_MASK (64 )); sdev->dma_ch = chan; sdev->num_dma_ch = num_chan;
drivers/misc/mic/bus/vop_bus.c +1 -1
@@ -157,7 +157,7 @@ vop_register_device(struct device *pdev, int id, vdev->id.device = id; vdev->id.vendor =VOP_DEV_ANY_ID ; vdev->dev.dma_ops = dma_ops; - vdev->dev.dma_mask = &vdev->dev.coherent_dma_mask; + vdev->dev.dma_mask =DMA_BIT_MASK (64 );dma_set_mask (&vdev->dev,DMA_BIT_MASK (64 )); vdev->dev.release = vop_release_dev; vdev->hw_ops = hw_ops;
drivers/misc/mic/card/mic_x100.c +1 -3
@@ -294,14 +294,12 @@ static void mic_platform_shutdown(struct platform_device *pdev)mic_remove (pdev); } -static u64 mic_dma_mask =DMA_BIT_MASK (64 ); -static struct platform_device mic_platform_dev = { .name = mic_driver_name, .id =0 , .num_resources =0 , .dev = { - .dma_mask = &mic_dma_mask, + .dma_mask =DMA_BIT_MASK (64 ), .coherent_dma_mask =DMA_BIT_MASK (64 ), }, };
drivers/mmc/core/queue.c +1 -1
@@ -357,7 +357,7 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card)u64 limit =BLK_BOUNCE_HIGH ;unsigned block_size =512 ; -if (mmc_dev (host)->dma_mask && *mmc_dev (host)->dma_mask) +if (mmc_dev (host)->dma_mask &&mmc_dev (host)->dma_mask) limit = (u64 )dma_max_pfn (mmc_dev (host)) <<PAGE_SHIFT ;blk_queue_flag_set (QUEUE_FLAG_NONROT , mq->queue);
drivers/mmc/host/mtk-sd.c +2 -4
@@ -407,7 +407,6 @@ struct msdc_host {void __iomem *top_base;/* host top register base address */ struct msdc_dma dma;/* dma channel */ -u64 dma_mask;u32 timeout_ns;/* data timeout ns */ u32 timeout_clks;/* data timeout clks */
@@ -2283,10 +2282,9 @@ static int msdc_drv_probe(struct platform_device *pdev) mmc->max_req_size =512 *1024 ; mmc->max_blk_count = mmc->max_req_size /512 ;if (host->dev_comp->support_64g) - host->dma_mask =DMA_BIT_MASK (36 ); +mmc_dev (mmc)->dma_mask =DMA_BIT_MASK (36 );else - host->dma_mask =DMA_BIT_MASK (32 ); -mmc_dev (mmc)->dma_mask = &host->dma_mask; +mmc_dev (mmc)->dma_mask =DMA_BIT_MASK (32 ); host->timeout_clks =3 *1048576 ; host->dma.gpd = dma_alloc_coherent(&pdev->dev,
drivers/mmc/host/sdhci-sprd.c +1 -2
@@ -335,8 +335,7 @@ static int sdhci_sprd_probe(struct platform_device *pdev)if (IS_ERR (host))return PTR_ERR (host); - host->dma_mask =DMA_BIT_MASK (64 ); - pdev->dev.dma_mask = &host->dma_mask; + pdev->dev.dma_mask =DMA_BIT_MASK (64 ); host->mmc_host_ops.request = sdhci_sprd_request; host->mmc->caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED |
drivers/mmc/host/sdhci.c +2 -4
@@ -3834,10 +3834,8 @@ int sdhci_setup_host(struct sdhci_host *host)* mask, but PIO does not need the hw shim so we set a new * mask here in that case. */ -if (!(host->flags & (SDHCI_USE_SDMA |SDHCI_USE_ADMA ))) { - host->dma_mask =DMA_BIT_MASK (64 ); -mmc_dev (mmc)->dma_mask = &host->dma_mask; - } +if (!(host->flags & (SDHCI_USE_SDMA |SDHCI_USE_ADMA ))) +mmc_dev (mmc)->dma_mask =DMA_BIT_MASK (64 );if (host->version >=SDHCI_SPEC_300 ) host->max_clk = (host->caps &SDHCI_CLOCK_V3_BASE_MASK )
drivers/mmc/host/sdhci.h +0 -1
@@ -497,7 +497,6 @@ struct sdhci_host {/* Internal data */ struct mmc_host *mmc;/* MMC structure */ struct mmc_host_ops mmc_host_ops;/* MMC host ops */ -u64 dma_mask;/* custom DMA mask */ #if IS_ENABLED (CONFIG_LEDS_CLASS )struct led_classdev led;/* LED control */
drivers/nubus/bus.c +1 -2
@@ -94,8 +94,7 @@ int nubus_device_register(struct nubus_board *board) board->dev.release = nubus_device_release; board->dev.bus = &nubus_bus_type;dev_set_name (&board->dev,"slot.%X" , board->slot); - board->dev.dma_mask = &board->dev.coherent_dma_mask; -dma_set_mask (&board->dev,DMA_BIT_MASK (32 )); +dma_set_mask_and_coherent (&board->dev,DMA_BIT_MASK (32 ));return device_register (&board->dev); }
drivers/of/device.c +1 -12
@@ -126,17 +126,6 @@ int of_dma_configure(struct device *dev, struct device_node *np, bool force_dma)dev_dbg (dev,"dma_pfn_offset(%#08lx)\n" , offset); } -/* -* If @dev is expected to be DMA-capable then the bus code that created -* it should have initialised its dma_mask pointer by this point. For -* now, we'll continue the legacy behaviour of coercing it to the -* coherent mask if not, but we'll no longer do so quietly. -*/ -if (!dev->dma_mask) { -dev_warn (dev,"DMA mask not set\n" ); - dev->dma_mask = &dev->coherent_dma_mask; - } -if (!size && dev->coherent_dma_mask) size =max (dev->coherent_dma_mask, dev->coherent_dma_mask +1 );else if (!size)
@@ -150,7 +139,7 @@ int of_dma_configure(struct device *dev, struct device_node *np, bool force_dma)*/ mask =DMA_BIT_MASK (ilog2 (dma_addr + size -1 ) +1 ); dev->coherent_dma_mask &= mask; - *dev->dma_mask &= mask; + dev->dma_mask &= mask;/* ...but only set bus mask if we found valid dma-ranges earlier */ if (!ret) dev->bus_dma_mask = mask;
drivers/of/platform.c +2 -2
@@ -187,7 +187,7 @@ static struct platform_device *of_platform_device_create_pdata( dev->dev.coherent_dma_mask =DMA_BIT_MASK (32 );if (!dev->dev.dma_mask) - dev->dev.dma_mask = &dev->dev.coherent_dma_mask; + dev->dev.dma_mask = dev->dev.coherent_dma_mask; dev->dev.bus = &platform_bus_type; dev->dev.platform_data = platform_data;of_msi_configure (&dev->dev, dev->dev.of_node);
@@ -243,7 +243,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node,/* AMBA devices only support a single DMA mask */ dev->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); - dev->dev.dma_mask = &dev->dev.coherent_dma_mask; + dev->dev.dma_mask =DMA_BIT_MASK (32 );/* setup generic device info */ dev->dev.of_node =of_node_get (node);
drivers/pci/pci-sysfs.c +1 -1
@@ -353,7 +353,7 @@ static ssize_t dma_mask_bits_show(struct device *dev, {struct pci_dev *pdev =to_pci_dev (dev); -return sprintf (buf,"%d\n" ,fls64 (pdev->dma_mask)); +return sprintf (buf,"%d\n" ,fls64 (pdev->dev.dma_mask)); }static DEVICE_ATTR_RO (dma_mask_bits);
drivers/pci/probe.c +1 -2
@@ -1731,7 +1731,7 @@ int pci_setup_device(struct pci_dev *dev)* Assume 32-bit PCI; let 64-bit PCI cards (which are far rarer) * set this higher, assuming the system even supports it. */ - dev->dma_mask =0xffffffff ; + dev->dev.dma_mask =0xffffffff ; dev_set_name(&dev->dev, "%04x:%02x:%02x.%d", pci_domain_nr(dev->bus), dev->bus->number, PCI_SLOT(dev->devfn),
@@ -2664,7 +2664,6 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) dev->dev.release = pci_release_dev;set_dev_node (&dev->dev,pcibus_to_node (bus)); - dev->dev.dma_mask = &dev->dma_mask; dev->dev.dma_parms = &dev->dma_parms; dev->dev.coherent_dma_mask =0xffffffffull ;
drivers/pcmcia/ds.c +1 -2
@@ -519,8 +519,7 @@ static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, p_dev->dev.parent = s->dev.parent; p_dev->dev.release = pcmcia_release_dev;/* by default don't allow DMA */ - p_dev->dma_mask =DMA_MASK_NONE ; - p_dev->dev.dma_mask = &p_dev->dma_mask; + p_dev->dev.dma_mask =DMA_MASK_NONE ;dev_set_name (&p_dev->dev,"%d.%d" , p_dev->socket->sock, p_dev->device_no);if (!dev_name (&p_dev->dev)) goto err_free;
drivers/pnp/card.c +1 -1
@@ -170,7 +170,7 @@ struct pnp_card *pnp_alloc_card(struct pnp_protocol *protocol, int id, char *pnpdev_set_name (&card->dev,"%02x:%02x" , card->protocol->number, card->number); card->dev.coherent_dma_mask =DMA_BIT_MASK (24 ); - card->dev.dma_mask = &card->dev.coherent_dma_mask; + card->dev.dma_mask =DMA_BIT_MASK (24 ); dev_id =pnp_add_card_id (card, pnpid);if (!dev_id) {
drivers/pnp/core.c +2 -3
@@ -152,12 +152,11 @@ struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id,INIT_LIST_HEAD (&dev->options); dev->protocol = protocol; dev->number = id; - dev->dma_mask =DMA_BIT_MASK (24 ); dev->dev.parent = &dev->protocol->dev; dev->dev.bus = &pnp_bus_type; - dev->dev.dma_mask = &dev->dma_mask; - dev->dev.coherent_dma_mask = dev->dma_mask; + dev->dev.dma_mask =DMA_BIT_MASK (24 ); + dev->dev.coherent_dma_mask =DMA_BIT_MASK (24 ); dev->dev.release = &pnp_release_device;dev_set_name (&dev->dev,"%02x:%02x" , dev->protocol->number, dev->number);
drivers/rapidio/rio-scan.c +1 -2
@@ -452,8 +452,7 @@ static struct rio_dev *rio_setup_device(struct rio_net *net,rio_attach_device (rdev); rdev->dev.release = rio_release_dev; rdev->dma_mask =DMA_BIT_MASK (32 ); - rdev->dev.dma_mask = &rdev->dma_mask; - rdev->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); + rdev->dev.dma_mask =DMA_BIT_MASK (32 );if (rdev->dst_ops &RIO_DST_OPS_DOORBELL ) rio_init_dbell_res(&rdev->riores[RIO_DOORBELL_RESOURCE],
drivers/s390/virtio/virtio_ccw.c +0 -2
@@ -66,7 +66,6 @@ struct virtio_ccw_device {bool device_lost;unsigned int config_ready;void *airq_info; -u64 dma_mask; };struct vq_info_block_legacy {
@@ -1257,7 +1256,6 @@ static int virtio_ccw_online(struct ccw_device *cdev) } vcdev->vdev.dev.parent = &cdev->dev; - cdev->dev.dma_mask = &vcdev->dma_mask;/* we are fine with common virtio infrastructure using 64 bit DMA */ ret =dma_set_mask_and_coherent (&cdev->dev,DMA_BIT_MASK (64 ));if (ret) {
drivers/scsi/megaraid/megaraid_sas_base.c +2 -2
@@ -6344,7 +6344,7 @@ megasas_set_dma_mask(struct megasas_instance *instance) dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) goto fail_set_dma_mask; -if ((*pdev->dev.dma_mask ==DMA_BIT_MASK (63 )) && +if ((pdev->dev.dma_mask ==DMA_BIT_MASK (63 )) && (dma_set_coherent_mask (&pdev->dev, consistent_mask) &&dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 )))) {/*
@@ -6369,7 +6369,7 @@ megasas_set_dma_mask(struct megasas_instance *instance) instance->consistent_mask_64bit = true;dev_info (&pdev->dev,"%s bit DMA mask and %s bit consistent mask\n" , - ((*pdev->dev.dma_mask ==DMA_BIT_MASK (63 )) ?"63" :"32" ), + ((pdev->dev.dma_mask ==DMA_BIT_MASK (63 )) ?"63" :"32" ), (instance->consistent_mask_64bit ?"63" :"32" ));return 0 ;
drivers/spi/spi-mt65xx.c +0 -3
@@ -680,9 +680,6 @@ static int mtk_spi_probe(struct platform_device *pdev) goto err_put_master; } -if (!pdev->dev.dma_mask) - pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; - ret =devm_request_irq (&pdev->dev, irq, mtk_spi_interrupt,IRQF_TRIGGER_NONE ,dev_name (&pdev->dev), master);if (ret) {
drivers/ssb/main.c +0 -1
@@ -511,7 +511,6 @@ static int ssb_devices_register(struct ssb_bus *bus)#endif break ;case SSB_BUSTYPE_SSB : - dev->dma_mask = &dev->coherent_dma_mask; sdev->dma_dev = dev;break ; }
drivers/staging/media/omap4iss/iss.c +1 -2
@@ -1215,8 +1215,7 @@ static int iss_probe(struct platform_device *pdev) iss->dev = &pdev->dev; iss->pdata = pdata; - iss->raw_dmamask =DMA_BIT_MASK (32 ); - iss->dev->dma_mask = &iss->raw_dmamask; + iss->dev->dma_mask =DMA_BIT_MASK (32 ); iss->dev->coherent_dma_mask =DMA_BIT_MASK (32 );platform_set_drvdata (pdev, iss);
drivers/staging/media/omap4iss/iss.h +0 -2
@@ -96,8 +96,6 @@ struct iss_device {void __iomem *regs[OMAP4_ISS_MEM_LAST ];struct regmap *syscon; -u64 raw_dmamask; -struct mutex iss_mutex;/* For handling ref_count field */ struct media_entity_enum crashed;int has_context;
drivers/tc/tc.c +1 -2
@@ -94,8 +94,7 @@ static void __init tc_bus_add_devices(struct tc_bus *tbus) tdev->slot = slot;/* TURBOchannel has 34-bit DMA addressing (16GiB space). */ - tdev->dma_mask =DMA_BIT_MASK (34 ); - tdev->dev.dma_mask = &tdev->dma_mask; + tdev->dev.dma_mask =DMA_BIT_MASK (34 ); tdev->dev.coherent_dma_mask =DMA_BIT_MASK (34 );for (i =0 ; i <8 ; i++) {
drivers/tty/goldfish.c +0 -5
@@ -364,11 +364,6 @@ static int goldfish_tty_probe(struct platform_device *pdev)* will use DMA for read/write IO operations. */ if (qtty->version >0 ) { -/* -* Initialize dma_mask to 32-bits. -*/ -if (!pdev->dev.dma_mask) - pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; ret =dma_set_mask (&pdev->dev,DMA_BIT_MASK (32 ));if (ret) {dev_err (&pdev->dev,"No suitable DMA available.\n" );
drivers/usb/core/hcd.c +1 -1
@@ -2554,7 +2554,7 @@ struct usb_hcd *__usb_create_hcd(const struct hc_driver *driver, hcd->self.controller = dev; hcd->self.sysdev = sysdev; hcd->self.bus_name = bus_name; - hcd->self.uses_dma = (sysdev->dma_mask !=NULL ); + hcd->self.uses_dma = (sysdev->dma_mask !=0 );timer_setup (&hcd->rh_timer, rh_timer_func,0 );#ifdef CONFIG_PM
drivers/usb/dwc2/platform.c +0 -2
@@ -393,8 +393,6 @@ static int dwc2_driver_probe(struct platform_device *dev)/* * Use reasonable defaults so platforms don't have to provide these. */ -if (!dev->dev.dma_mask) - dev->dev.dma_mask = &dev->dev.coherent_dma_mask; retval =dma_set_coherent_mask (&dev->dev,DMA_BIT_MASK (32 ));if (retval) {dev_err (&dev->dev,"can't set coherent DMA mask: %d\n" , retval);
drivers/usb/gadget/udc/lpc32xx_udc.c +1 -3
@@ -2998,8 +2998,6 @@ struct lpc32xx_usbd_cfg lpc32xx_usbddata = { }; -static u64 lpc32xx_usbd_dmamask = ~(u32 )0x7F ; -static int lpc32xx_udc_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -3038,7 +3036,7 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)dev_info (udc->dev,"ISP1301 I2C device at address 0x%x\n" , udc->isp1301_i2c_client->addr); - pdev->dev.dma_mask = &lpc32xx_usbd_dmamask; + pdev->dev.dma_mask = ~(u32 )0x7F ; retval =dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (32 ));if (retval)return retval;
drivers/usb/host/bcma-hcd.c +0 -1
@@ -320,7 +320,6 @@ static struct platform_device *bcma_hcd_create_pdev(struct bcma_device *dev,return ERR_PTR (-ENOMEM ); hci_dev->dev.parent = &dev->dev; - hci_dev->dev.dma_mask = &hci_dev->dev.coherent_dma_mask; ret =platform_device_add_resources (hci_dev, hci_res,ARRAY_SIZE (hci_res));
drivers/usb/host/ehci-grlib.c +0 -2
@@ -88,8 +88,6 @@ static int ehci_hcd_grlib_probe(struct platform_device *op)if (rv)return rv; -/* usb_create_hcd requires dma_mask != NULL */ - op->dev.dma_mask = &op->dev.coherent_dma_mask; hcd =usb_create_hcd (&ehci_grlib_hc_driver, &op->dev,"GRUSBHC EHCI USB" );if (!hcd)
drivers/usb/host/ehci-ps3.c +2 -4
@@ -86,7 +86,6 @@ static int ps3_ehci_probe(struct ps3_system_bus_device *dev)int result;struct usb_hcd *hcd;unsigned int virq; -static u64 dummy_mask;if (usb_disabled ()) { result = -ENODEV ;
@@ -131,9 +130,8 @@ static int ps3_ehci_probe(struct ps3_system_bus_device *dev) goto fail_irq; } - dummy_mask =DMA_BIT_MASK (32 ); - dev->core.dma_mask = &dummy_mask; -dma_set_coherent_mask (&dev->core, dummy_mask); + dev->core.dma_mask =DMA_BIT_MASK (32 ); +dma_set_coherent_mask (&dev->core,DMA_BIT_MASK (32 )); hcd =usb_create_hcd (&ps3_ehci_hc_driver, &dev->core,dev_name (&dev->core));
drivers/usb/host/fsl-mph-dr-of.c +1 -5
@@ -93,11 +93,7 @@ static struct platform_device *fsl_usb2_device_register( pdev->dev.parent = &ofdev->dev; pdev->dev.coherent_dma_mask = ofdev->dev.coherent_dma_mask; - -if (!pdev->dev.dma_mask) - pdev->dev.dma_mask = &ofdev->dev.coherent_dma_mask; -else -dma_set_mask (&pdev->dev,DMA_BIT_MASK (32 )); +dma_set_mask (&pdev->dev,DMA_BIT_MASK (32 )); retval =platform_device_add_data (pdev, pdata,sizeof (*pdata));if (retval)
drivers/usb/host/ohci-ps3.c +2 -4
@@ -69,7 +69,6 @@ static int ps3_ohci_probe(struct ps3_system_bus_device *dev)int result;struct usb_hcd *hcd;unsigned int virq; -static u64 dummy_mask;if (usb_disabled ()) { result = -ENODEV ;
@@ -115,9 +114,8 @@ static int ps3_ohci_probe(struct ps3_system_bus_device *dev) goto fail_irq; } - dummy_mask =DMA_BIT_MASK (32 ); - dev->core.dma_mask = &dummy_mask; -dma_set_coherent_mask (&dev->core, dummy_mask); + dev->core.dma_mask =DMA_BIT_MASK (32 ); +dma_set_coherent_mask (&dev->core,DMA_BIT_MASK (32 )); hcd =usb_create_hcd (&ps3_ohci_hc_driver, &dev->core,dev_name (&dev->core));
drivers/usb/host/ssb-hcd.c +0 -1
@@ -121,7 +121,6 @@ static struct platform_device *ssb_hcd_create_pdev(struct ssb_device *dev, boolreturn ERR_PTR (-ENOMEM ); hci_dev->dev.parent = dev->dev; - hci_dev->dev.dma_mask = &hci_dev->dev.coherent_dma_mask; ret =platform_device_add_resources (hci_dev, hci_res,ARRAY_SIZE (hci_res));
drivers/usb/host/uhci-grlib.c +0 -2
@@ -105,8 +105,6 @@ static int uhci_hcd_grlib_probe(struct platform_device *op)if (rv)return rv; -/* usb_create_hcd requires dma_mask != NULL */ - op->dev.dma_mask = &op->dev.coherent_dma_mask; hcd =usb_create_hcd (&uhci_grlib_hc_driver, &op->dev,"GRUSBHC UHCI USB" );if (!hcd)
drivers/usb/misc/ftdi-elan.c +1 -1
@@ -313,7 +313,7 @@ static int ftdi_elan_hcd_init(struct usb_ftdi *ftdi) ftdi->platform_dev.dev.platform_data = &ftdi->platform_data; ftdi->platform_dev.dev.parent =NULL ; ftdi->platform_dev.dev.release = ftdi_release_platform_dev; - ftdi->platform_dev.dev.dma_mask =NULL ; + ftdi->platform_dev.dev.dma_mask =0 ;snprintf (ftdi->device_name,sizeof (ftdi->device_name),"u132_hcd" ); ftdi->platform_dev.name = ftdi->device_name;dev_info (&ftdi->udev->dev,"requesting module '%s'\n" ,"u132_hcd" );
drivers/zorro/zorro.c +2 -1
@@ -190,15 +190,16 @@ static int __init amiga_zorro_probe(struct platform_device *pdev) z->dev.id = i;switch (z->rom.er_Type &ERT_TYPEMASK ) {case ERT_ZORROIII : + z->dev.dma_mask =DMA_BIT_MASK (32 ); z->dev.coherent_dma_mask =DMA_BIT_MASK (32 );break ;case ERT_ZORROII :default : + z->dev.dma_mask =DMA_BIT_MASK (24 ); z->dev.coherent_dma_mask =DMA_BIT_MASK (24 );break ; } - z->dev.dma_mask = &z->dev.coherent_dma_mask; }/* ... then register them */
include/linux/device.h +1 -1
@@ -1010,7 +1010,7 @@ struct device {#endif const struct dma_map_ops *dma_ops; -u64 *dma_mask;/* dma mask (if dma'able device) */ +u64 dma_mask;/* dma mask (if dma'able device) */ u64 coherent_dma_mask;/* Like dma_mask, but for alloc_coherent mappings as not all hardware supports
include/linux/dma-direct.h +1 -1
@@ -28,7 +28,7 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)return false;return addr + size -1 <= - min_not_zero(*dev->dma_mask, dev->bus_dma_mask); + min_not_zero(dev->dma_mask, dev->bus_dma_mask); }#endif /* !CONFIG_ARCH_HAS_PHYS_TO_DMA */
include/linux/dma-mapping.h +5 -7
@@ -151,7 +151,7 @@ static inline int valid_dma_direction(int dma_direction)static inline int is_device_dma_capable (struct device *dev) { -return dev->dma_mask !=NULL && *dev->dma_mask !=DMA_MASK_NONE ; +return dev->dma_mask !=DMA_MASK_NONE ; }#ifdef CONFIG_DMA_DECLARE_COHERENT
@@ -650,8 +650,8 @@ static inline void dma_free_coherent(struct device *dev, size_t size,static inline u64 dma_get_mask (struct device *dev) { -if (dev->dma_mask && *dev->dma_mask) -return *dev->dma_mask; +if (dev->dma_mask) +return dev->dma_mask;return DMA_BIT_MASK (32 ); }
@@ -670,12 +670,10 @@ static inline int dma_set_mask_and_coherent(struct device *dev, u64 mask) }/* -* Similar to the above, except it deals with the case where the device -* does not have dev->dma_mask appropriately setup. +* Don't use in new code. */ static inline int dma_coerce_mask_and_coherent (struct device *dev,u64 mask) { - dev->dma_mask = &dev->coherent_dma_mask;return dma_set_mask_and_coherent (dev, mask); }
@@ -732,7 +730,7 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask)#ifndef dma_max_pfnstatic inline unsigned long dma_max_pfn (struct device *dev) { -return (*dev->dma_mask >>PAGE_SHIFT ) + dev->dma_pfn_offset; +return (dev->dma_mask >>PAGE_SHIFT ) + dev->dma_pfn_offset; }#endif
include/linux/eisa.h +0 -1
@@ -38,7 +38,6 @@ struct eisa_device {int state;unsigned long base_addr;struct resource res[EISA_MAX_RESOURCES ]; -u64 dma_mask;struct device dev;/* generic device */ #ifdef CONFIG_EISA_NAMES char pretty_name[50 ];
include/linux/fsl/mc.h +0 -2
@@ -151,7 +151,6 @@ struct fsl_mc_obj_desc {/** * struct fsl_mc_device - MC object device object * @dev: Linux driver model device object -* @dma_mask: Default DMA mask * @flags: MC object device flags * @icid: Isolation context ID for the device * @mc_handle: MC handle for the corresponding MC object opened
@@ -184,7 +183,6 @@ struct fsl_mc_obj_desc {*/ struct fsl_mc_device {struct device dev; -u64 dma_mask;u16 flags;u16 icid;u16 mc_handle;
include/linux/pci.h +0 -6
@@ -315,12 +315,6 @@ struct pci_dev {unsigned long *dma_alias_mask;/* Mask of enabled devfn aliases */ struct pci_driver *driver;/* Driver bound to this device */ -u64 dma_mask;/* Mask of the bits of bus address this -device implements. Normally this is -0xffffffff. You only need to change -this if your device has broken DMA -or supports 64-bit transfers. */ -struct device_dma_parameters dma_parms;pci_power_t current_state;/* Current operating state. In ACPI,
include/linux/pnp.h +0 -1
@@ -244,7 +244,6 @@ static inline void pnp_set_card_drvdata(struct pnp_card_link *pcard, void *data)struct pnp_dev {struct device dev;/* Driver Model device interface */ -u64 dma_mask;unsigned int number;/* used as an index, must be unique */ int status;
include/linux/rio.h +0 -2
@@ -165,7 +165,6 @@ enum rio_device_state {* @phys_efptr: RIO device extended features pointer * @phys_rmap: LP-Serial Register Map Type (1 or 2) * @em_efptr: RIO Error Management features pointer -* @dma_mask: Mask of bits of RIO address this device implements * @driver: Driver claiming this device * @dev: Device model device * @riores: RIO resources this device owns
@@ -196,7 +195,6 @@ struct rio_dev {u32 phys_efptr;u32 phys_rmap;u32 em_efptr; -u64 dma_mask;struct rio_driver *driver;/* RIO driver claiming this device */ struct device dev;/* LDM device structure */ struct resource riores[RIO_MAX_DEV_RESOURCES ];
include/linux/tc.h +0 -1
@@ -84,7 +84,6 @@ struct tc_dev {device. */ struct device dev;/* Generic device interface. */ struct resource resource;/* Address space of this device. */ -u64 dma_mask;/* DMA addressable range. */ char vendor[9 ];char name[9 ];char firmware[9 ];
include/pcmcia/ds.h +0 -1
@@ -143,7 +143,6 @@ struct pcmcia_device {char *prod_id[4 ]; -u64 dma_mask;struct device dev;/* data private to drivers */
include/trace/events/swiotlb.h +1 -1
@@ -26,7 +26,7 @@ TRACE_EVENT(swiotlb_bounced,TP_fast_assign ( __assign_str(dev_name, dev_name(dev)); - __entry->dma_mask = (dev->dma_mask ? *dev->dma_mask :0 ); + __entry->dma_mask = dev->dma_mask; __entry->dev_addr = dev_addr; __entry->size = size; __entry->swiotlb_force = swiotlb_force;
kernel/dma/direct.c +2 -2
@@ -35,10 +35,10 @@ static void report_addr(struct device *dev, dma_addr_t dma_addr, size_t size) {if (!dev->dma_mask) {dev_err_once (dev,"DMA map on device without dma_mask\n" ); - }else if (*dev->dma_mask >=DMA_BIT_MASK (32 ) || dev->bus_dma_mask) { + }else if (dev->dma_mask >=DMA_BIT_MASK (32 ) || dev->bus_dma_mask) {dev_err_once (dev,"overflow %pad+%zu of DMA mask %llx bus mask %llx\n" , - &dma_addr, size, *dev->dma_mask, dev->bus_dma_mask); + &dma_addr, size, dev->dma_mask, dev->bus_dma_mask); }WARN_ON_ONCE (1 ); }
kernel/dma/mapping.c +1 -1
@@ -328,7 +328,7 @@ int dma_set_mask(struct device *dev, u64 mask)arch_dma_set_mask (dev, mask);dma_check_mask (dev, mask); - *dev->dma_mask = mask; + dev->dma_mask = mask;return 0 ; }EXPORT_SYMBOL (dma_set_mask);
sound/aoa/soundbus/i2sbus/core.c +1 -2
@@ -219,9 +219,8 @@ static int i2sbus_add_dev(struct macio_dev *macio,mutex_init (&dev->lock);spin_lock_init (&dev->low_lock); - dev->sound.ofdev.archdata.dma_mask = macio->ofdev.archdata.dma_mask; dev->sound.ofdev.dev.of_node = np; - dev->sound.ofdev.dev.dma_mask = &dev->sound.ofdev.archdata.dma_mask; + dev->sound.ofdev.dev.dma_mask = macio->ofdev.dev.dma_mask; dev->sound.ofdev.dev.parent = &macio->ofdev.dev; dev->sound.ofdev.dev.release = i2sbus_release_dev; dev->sound.attach_codec = i2sbus_attach_codec;
sound/ppc/snd_ps3.c +2 -4
@@ -926,7 +926,6 @@ static int snd_ps3_driver_probe(struct ps3_system_bus_device *dev) {int i, ret;u64 lpar_addr, lpar_size; -static u64 dummy_mask;if (WARN_ON (!firmware_has_feature (FW_FEATURE_PS3_LV1 )))return -ENODEV ;
@@ -967,9 +966,8 @@ static int snd_ps3_driver_probe(struct ps3_system_bus_device *dev) goto clean_mmio; } - dummy_mask =DMA_BIT_MASK (32 ); - dev->core.dma_mask = &dummy_mask; -dma_set_coherent_mask (&dev->core, dummy_mask); + dev->core.dma_mask =DMA_BIT_MASK (32 ); +dma_set_coherent_mask (&dev->core,DMA_BIT_MASK (32 ));snd_ps3_audio_set_base_addr (dev->d_region->bus_addr);
sound/soc/bcm/cygnus-pcm.c +2 -3
@@ -202,8 +202,6 @@ static const struct snd_pcm_hardware cygnus_pcm_hw = { .buffer_bytes_max = 4 * 0x8000, }; -static u64 cygnus_dma_dmamask =DMA_BIT_MASK (32 ); -static struct cygnus_aio_port *cygnus_dai_get_dma_data (struct snd_pcm_substream *substream) {
@@ -796,8 +794,9 @@ static int cygnus_dma_new(struct snd_soc_pcm_runtime *rtd)struct snd_pcm *pcm = rtd->pcm;int ret; +/* XXX: this should really use dma_set_mask_and_coherent().. */ if (!card->dev->dma_mask) - card->dev->dma_mask = &cygnus_dma_dmamask; + card->dev->dma_mask =DMA_BIT_MASK (32 );if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask =DMA_BIT_MASK (32 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerQuoted 8 lines · Christoph Hellwig
I'd much rather bite the bullet and make
dev->dma_maska scalar instead of a pointer. The pointer causes way to much boiler plate code, and the semantics are way to subtile. Below is a POV patch that compiles and boots with my usual x86 test config, and at least compiles with the arm and pmac32 defconfigs. It probably breaks just about everything else, but should give us an idea what is involve in the switch:
Quoted 8 lines
---
Quoted 1 line
From
ea73ba2d29f56ff6413066b10f018a671f2b26acMon Sep 17 00:00:00 2001From: Christoph Hellwig <[email protected]>
Date: Fri, 28 Jun 2019 16:24:01 +0200
Subject:device.h: makedma_maska scalar instead of a pointerKill the
dma_maskindirection to clean up the mess we acquired around it.
I have no objection to this at all. I would love to see the indirection go away.
thanks,
greg k-h
Hi Christoph,
Quoted 3 lines · On Fri, 28 Jun 2019 08:59:46 -0700 Christoph Hellwig <[email protected]> wrote:
I'd much rather bite the bullet and make
dev->dma_maska scalar instead of a pointer. The pointer causes way to much boiler plate code, and the semantics are way to subtile.
I agree that this the real solution, it just seemed a bit overwhelming to me. I'll be happy to help with this though, now that you took a big first step.
Quoted 5 lines
Below is a POV patch that
compiles and boots with my usual x86 test config, and at least compiles with the arm and pmac32 defconfigs. It probably breaks just about everything else, but should give us an idea what is involve in the switch:
I'll test that on my boards too.
Thanks,
Maxime
Quoted 3 lines · Maxime Chevallier
I agree that this the real solution, it just seemed a bit overwhelming to me. I'll be happy to help with this though, now that you took a big first step.
I think the first step is to resurrect my original patch to default to a 32-bit DMA mask for platform devices, as that will cut a lot of crap from the platform device declarations.
IIRC the problem back then was that USB uses the fact that a DMA mask exist to decide if it uses a DMA vs PIO path in the HCD core.
So I'll need some help from Greg or other USB folks to clean that up, after that we can try to apply my patch again (preferably early in the next merge window), and once that sticks clean up all the 32-bit dma mask initialization for platform devices, and then turn the dma_mask into a scalar.
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel