LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Dan Williams" <dan.j.williams@intel.com>
To: "Heiko Carstens" <heiko.carstens@de.ibm.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	"John W. Linville" <linville@tuxdriver.com>,
	"Kyle McMartin" <kyle@parisc-linux.org>,
	linux-kernel@vger.kernel.org, James.Bottomley@steeleye.com,
	"Tejun Heo" <htejun@gmail.com>, "Jeff Garzik" <jeff@garzik.org>,
	"Martin Schwidefsky" <schwidefsky@de.ibm.com>,
	geert@linux-m68k.org, zippel@linux-m68k.org, spyro@f2s.com,
	uclinux-v850@lsi.nec.co.jp, ysato@users.sourceforge.jp,
	"Cornelia Huck" <cornelia.huck@de.ibm.com>
Subject: Re: [patch] Introduce CONFIG_HAS_DMA.
Date: Fri, 25 May 2007 09:36:31 -0700	[thread overview]
Message-ID: <e9c3a7c20705250936n2689c1f3wce8ccb0ee4a22b9e@mail.gmail.com> (raw)
In-Reply-To: <20070226135743.GB7925@osiris.boeblingen.de.ibm.com>

[ apologies for reviving an old conversation ]

On 2/26/07, Heiko Carstens <heiko.carstens@de.ibm.com> wrote:
> From: Heiko Carstens <heiko.carstens@de.ibm.com>
>
> Architectures that don't support DMA can say so by adding a
> config NO_DMA to their Kconfig file. This will prevent compilation
> of some dma specific driver code. Also dma-mapping-broken.h isn't
> needed anymore on at least s390.
> This avoids compilation and linking of otherwise dead/broken code.
>

I went back and read the thread leading up to this patch and I am of
the opinion that John's approach (adding more stubs to
dma-mapping-broken.h:
http://marc.info/?l=linux-kernel&m=117219377712232&w=2)  is needed in
_addition_ to this Kconfig option.  In my particular case I have an
API with a DMA and a non-DMA path written in such a way that the DMA
path can be compiled away.  Without dma-mapping-broken.h support the
API is unnecessarily forced to violate point 2 of
Documentation/SubmittingPatches (#ifdefs are ugly).

In other words let CONFIG_HAS_DMA prevent pure DMA code from being
built, but do not preclude "clever" implementations from calling
broken code.

If there are no objections I plan to resubmit John's changes with the
addition below, which allows CONFIG_HAS_DMA=n architectures to delete
their respective dma-mapping.h file.

diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 9a663c6..2dc21cb 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -31,7 +31,11 @@ static inline int valid_dma_direction(int dma_direction)
                (dma_direction == DMA_FROM_DEVICE));
 }

+#ifdef CONFIG_HAS_DMA
 #include <asm/dma-mapping.h>
+#else
+#include <asm-generic/dma-mapping-broken.h>
+#endif

 /* Backwards compat, remove in 2.7.x */
 #define dma_sync_single                dma_sync_single_for_cpu

  reply	other threads:[~2007-05-25 16:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-23  0:59 [PATCH] dma-mapping-broken.h: flesh-out DMA API stubs John W. Linville
2007-02-23  3:42 ` Heiko Carstens
2007-02-23  6:13   ` Heiko Carstens
2007-02-23  9:50     ` Heiko Carstens
2007-02-23 13:57     ` Kyle McMartin
2007-02-23 14:39       ` John W. Linville
2007-02-26 13:57         ` [patch] Introduce CONFIG_HAS_DMA Heiko Carstens
2007-05-25 16:36           ` Dan Williams [this message]
2007-05-30  9:10             ` Cornelia Huck
2007-05-30 21:40               ` Williams, Dan J
2007-05-30 22:29                 ` [PATCH] dma-mapping: prevent dma dependent code from linking on !HAS_DMA archs Dan Williams
2007-05-31  6:53                 ` [patch] Introduce CONFIG_HAS_DMA Cornelia Huck

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=e9c3a7c20705250936n2689c1f3wce8ccb0ee4a22b9e@mail.gmail.com \
    --to=dan.j.williams@intel.com \
    --cc=James.Bottomley@steeleye.com \
    --cc=akpm@linux-foundation.org \
    --cc=cornelia.huck@de.ibm.com \
    --cc=geert@linux-m68k.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=htejun@gmail.com \
    --cc=jeff@garzik.org \
    --cc=kyle@parisc-linux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=spyro@f2s.com \
    --cc=uclinux-v850@lsi.nec.co.jp \
    --cc=ysato@users.sourceforge.jp \
    --cc=zippel@linux-m68k.org \
    --subject='Re: [patch] Introduce CONFIG_HAS_DMA.' \
    /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

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).