From: simon.kagstrom@netinsight.net (Simon Kågström)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] IXP4xx: Fix DMA masks.
Date: Mon, 24 Mar 2014 14:50:00 +0100 [thread overview]
Message-ID: <20140324145000.4098c8c7@marrow.netinsight.se> (raw)
In-Reply-To: <m37g7liwdb.fsf@intrepid.localdomain>
On Sun, 23 Mar 2014 01:36:48 +0100
Krzysztof Halasa <khc@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@pm.waw.pl>
Tested-by: Simon Kagstrom <simon.kagstrom@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
next prev parent reply other threads:[~2014-03-24 13:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-22 23:44 IXP4xx fixes Krzysztof Halasa
2014-03-23 0:34 ` [PATCH 1/3] IXP4xx: Fix Goramo Multilink GPIO conversion Krzysztof Halasa
2014-03-24 15:27 ` Linus Walleij
2014-03-24 20:36 ` Krzysztof Halasa
2014-03-26 22:06 ` Arnd Bergmann
2014-03-23 0:36 ` [PATCH 2/3] IXP4xx: Fix DMA masks Krzysztof Halasa
2014-03-24 13:50 ` Simon Kågström [this message]
2014-03-24 20:30 ` Krzysztof Halasa
2014-03-26 22:08 ` Arnd Bergmann
2014-03-23 0:38 ` [PATCH 3/3] ARM: Fix DMA-bounce code to allow sync from_device and to_device with bidirectional mappings Krzysztof Halasa
2014-03-24 13:51 ` Simon Kågström
2014-03-26 22:10 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140324145000.4098c8c7@marrow.netinsight.se \
--to=simon.kagstrom@netinsight.net \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).