LKML Archive on
help / color / mirror / Atom feed
From: Cornelia Huck <>
To: "Dan Williams" <>
Cc: "Heiko Carstens" <>,
	"Andrew Morton" <>,
	"John W. Linville" <>,
	"Kyle McMartin" <>,,,
	"Tejun Heo" <>, "Jeff Garzik" <>,
	"Martin Schwidefsky" <>,,,,,
Subject: Re: [patch] Introduce CONFIG_HAS_DMA.
Date: Wed, 30 May 2007 11:10:03 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Fri, 25 May 2007 09:36:31 -0700,
"Dan Williams" <> wrote:

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

IMO, well-placed #ifdefs are preferrable to dragging non-working code
around. Like:

- put the DMA path in a file only build for MY_STUFF_USE_DMA
- have a header file that points to the implementation for
  MY_STUFF_USE_DMA and uses well defined stubs for !MY_STUFF_USE_DMA,
  like returning ICannotDoThat for check_if_can_do() (kind of like what
  include/linux/sysfs.h does, for example)

This contains the #ifdefs in a header, doesn't compile stuff that won't
work anyway on !HAS_DMA, and adds the ability to disable
MY_STUFF_USE_DMA even if HAS_DMA at a later time if someone wants it.

> 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 it calls broken code, it may not be so "clever" after all :)

What I don't like about this is

- compiles stuff that is not needed on !HAS_DMA
- worse, compiles stuff that will not work on !HAS_DMA
- does not encourage to split code properly into a DMA and a non-DMA

  reply	other threads:[~2007-05-30  9:10 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
2007-05-30  9:10             ` Cornelia Huck [this message]
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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [patch] Introduce CONFIG_HAS_DMA.' \

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