[PATCH 2/3] IXP4xx: Fix DMA masks.

Simon Kågström simon.kagstrom at netinsight.net
Mon Mar 24 09:50:00 EDT 2014


On Sun, 23 Mar 2014 01:36:48 +0100
Krzysztof Halasa <khc at pm.waw.pl> wrote:

> Now, devices will have 32-bit default DMA masks (0xFFFFFFFF) as per DMA API.
> 
> Fixes:
> $ ifconfig eth0 up
>
> Signed-off-by: Krzysztof Hałasa <khc at pm.waw.pl>

Tested-by: Simon Kagstrom <simon.kagstrom at netinsight.net>

> +#ifdef CONFIG_PCI
> +static int ixp4xx_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size)
> +{
> +	return (dma_addr + size) > SZ_64M;
> +}
> +
> +static int ixp4xx_platform_notify_remove(struct device *dev)
> +{
> +	if (dev_is_pci(dev))
> +		dmabounce_unregister_dev(dev);
> +
> +	return 0;
> +}
> +#endif
> +
> +/*
> + * Setup DMA mask to 64MB on PCI devices and 4 GB on all other things.
> + */
> +static int ixp4xx_platform_notify(struct device *dev)
> +{
> +	dev->dma_mask = &dev->coherent_dma_mask;
> +
> +#ifdef CONFIG_PCI
> +	if (dev_is_pci(dev)) {
> +		dev->coherent_dma_mask = DMA_BIT_MASK(28); /* 64 MB */
> +		dmabounce_register_dev(dev, 2048, 4096, ixp4xx_needs_bounce);
> +		return 0;
> +	}
> +#endif

I would simply remove the #ifdef CONFIG_PCI statements: dev_is_pci(dev)
should return false at compile time if CONFIG_PCI is not set, and then
I'd trust the compiler to simply remove all dead code.

// Simon



More information about the linux-arm-kernel mailing list