From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org, linux-m68k@vger.kernel.org
Subject: Re: [PATCH/RFC 4/4] common: dma-mapping: Move dma_common_*() to <linux/dma-mapping.h>
Date: Sun, 13 Jan 2013 11:40:12 +0100 [thread overview]
Message-ID: <CAMuHMdVequkKT96i+7mhZnvogZrMPQDkd3d4EQxwZcvj5gSbWw@mail.gmail.com> (raw)
In-Reply-To: <50E442A7.3010002@samsung.com>
Hi Marek,
On Wed, Jan 2, 2013 at 3:22 PM, Marek Szyprowski
<m.szyprowski@samsung.com> wrote:
> On 12/28/2012 8:23 PM, Geert Uytterhoeven wrote:
>> dma_common_mmap() and dma_common_get_sgtable() are defined in
>> drivers/base/dma-mapping.c, and always compiled if CONFIG_HAS_DMA=y.
>>
>> However, their forward declarations and the inline functions defined on
>> top
>> of them (dma_mmap_attrs(), dma_mmap_coherent(), dma_mmap_writecombine(),
>> dma_get_sgtable_attrs()), dma_get_sgtable()) are in
>> <asm-generic/dma-mapping-common.h>, which is not included by all
>> architectures supporting CONFIG_HAS_DMA=y. There exist no alternative
>> implementations.
>>
>> Hence for e.g. m68k allmodconfig, I get:
>>
>> drivers/media/v4l2-core/videobuf2-dma-contig.c: In function ‘vb2_dc_mmap’:
>> drivers/media/v4l2-core/videobuf2-dma-contig.c:204: error: implicit
>> declaration of function ‘dma_mmap_coherent’
>> drivers/media/v4l2-core/videobuf2-dma-contig.c: In function
>> ‘vb2_dc_get_base_sgt’:
>> drivers/media/v4l2-core/videobuf2-dma-contig.c:387: error: implicit
>> declaration of function ‘dma_get_sgtable’
>>
>> To fix this
>> - Move the forward declarations and inline definitions to
>> <linux/dma-mapping.h>, so all CONFIG_HAS_DMA=y architectures can use
>> them,
>> - Replace the hard "BUG_ON(!ops)" checks for dma_map_ops by soft
>> checks,
>> so architectures can fall back to the common code by returning NULL
>> from their get_dma_ops(). Note that there are no "BUG_ON(!ops)"
>> checks
>> in other functions in <asm-generic/dma-mapping-common.h>,
>> - Make "struct dma_map_ops *ops" const while we're at it.
>
>
> I think that more appropriate way of handling it is to avoid dma_map_ops
> based
> calls (those archs probably have some reasons why they don't use it at all)
> and
> provide static inline stubs which call dma_common_mmap and
> dma_common_get_sgtable.
OK, I'll do that.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
prev parent reply other threads:[~2013-01-13 10:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-16 16:03 dma_mmap_coherent / ARCH_HAS_DMA_MMAP_COHERENT Geert Uytterhoeven
2012-12-28 19:23 ` [PATCH/RFC 0/4] " Geert Uytterhoeven
2013-01-02 14:39 ` Marek Szyprowski
2012-12-28 19:23 ` [PATCH 1/4] m68k: Sort out !CONFIG_MMU_SUN3 vs. CONFIG_HAS_DMA Geert Uytterhoeven
2012-12-28 19:23 ` [PATCH 2/4] score: Remove unneeded <asm/dma-mapping.h> Geert Uytterhoeven
2012-12-28 19:23 ` [PATCH/RFC 3/4] avr32/bfin/c6x/cris/frv/m68k/mn10300/parisc/xtensa: Add dummy get_dma_ops() Geert Uytterhoeven
2012-12-28 19:23 ` [PATCH/RFC 4/4] common: dma-mapping: Move dma_common_*() to <linux/dma-mapping.h> Geert Uytterhoeven
2012-12-29 0:09 ` Mauro Carvalho Chehab
2013-01-02 14:22 ` Marek Szyprowski
2013-01-13 10:40 ` Geert Uytterhoeven [this message]
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=CAMuHMdVequkKT96i+7mhZnvogZrMPQDkd3d4EQxwZcvj5gSbWw@mail.gmail.com \
--to=geert@linux-m68k.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
/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).