Commit cdfee562 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Greg Kroah-Hartman
Browse files

driver core: initialize a default DMA mask for platform device



We still treat devices without a DMA mask as defaulting to 32-bits for
both mask, but a few releases ago we've started warning about such
cases, as they require special cases to work around this sloppyness.
Add a dma_mask field to struct platform_device so that we can initialize
the dma_mask pointer in struct device and initialize both masks to
32-bits by default, replacing similar functionality in m68k and
powerpc.  The arch_setup_pdev_archdata hooks is now unused and removed.

Note that the code looks a little odd with the various conditionals
because we have to support platform_device structures that are
statically allocated.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/20190816062435.881-7-hch@lst.de


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bd5defae
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -79,12 +79,3 @@ void arch_sync_dma_for_device(struct device *dev, phys_addr_t handle,
		break;
	}
}

void arch_setup_pdev_archdata(struct platform_device *pdev)
{
	if (pdev->dev.coherent_dma_mask == DMA_MASK_NONE &&
	    pdev->dev.dma_mask == NULL) {
		pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
		pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
	}
}
+0 −6
Original line number Diff line number Diff line
@@ -778,12 +778,6 @@ void ppc_printk_progress(char *s, unsigned short hex)
	pr_info("%s\n", s);
}

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;
}

static __init void print_system_info(void)
{
	pr_info("-----------------------------------------------------\n");
+0 −1
Original line number Diff line number Diff line
@@ -527,7 +527,6 @@ static int __init ap325rxa_devices_setup(void)

	/* Initialize CEU platform device separately to map memory first */
	device_initialize(&ap325rxa_ceu_device.dev);
	arch_setup_pdev_archdata(&ap325rxa_ceu_device);
	dma_declare_coherent_memory(&ap325rxa_ceu_device.dev,
			ceu_dma_membase, ceu_dma_membase,
			ceu_dma_membase + CEU_BUFFER_MEMORY_SIZE - 1);
+0 −2
Original line number Diff line number Diff line
@@ -1440,7 +1440,6 @@ static int __init arch_setup(void)

	/* Initialize CEU platform devices separately to map memory first */
	device_initialize(&ecovec_ceu_devices[0]->dev);
	arch_setup_pdev_archdata(ecovec_ceu_devices[0]);
	dma_declare_coherent_memory(&ecovec_ceu_devices[0]->dev,
				    ceu0_dma_membase, ceu0_dma_membase,
				    ceu0_dma_membase +
@@ -1448,7 +1447,6 @@ static int __init arch_setup(void)
	platform_device_add(ecovec_ceu_devices[0]);

	device_initialize(&ecovec_ceu_devices[1]->dev);
	arch_setup_pdev_archdata(ecovec_ceu_devices[1]);
	dma_declare_coherent_memory(&ecovec_ceu_devices[1]->dev,
				    ceu1_dma_membase, ceu1_dma_membase,
				    ceu1_dma_membase +
+0 −1
Original line number Diff line number Diff line
@@ -601,7 +601,6 @@ static int __init kfr2r09_devices_setup(void)

	/* Initialize CEU platform device separately to map memory first */
	device_initialize(&kfr2r09_ceu_device.dev);
	arch_setup_pdev_archdata(&kfr2r09_ceu_device);
	dma_declare_coherent_memory(&kfr2r09_ceu_device.dev,
			ceu_dma_membase, ceu_dma_membase,
			ceu_dma_membase + CEU_BUFFER_MEMORY_SIZE - 1);
Loading