From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Szyprowski Subject: Re: [PATCH/RFC 4/4] common: dma-mapping: Move dma_common_*() to Date: Wed, 02 Jan 2013 15:22:31 +0100 Message-ID: <50E442A7.3010002@samsung.com> References: <1356722614-18224-5-git-send-email-geert@linux-m68k.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mailout4.w1.samsung.com ([210.118.77.14]:42855 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752627Ab3ABOWm (ORCPT ); Wed, 2 Jan 2013 09:22:42 -0500 In-reply-to: <1356722614-18224-5-git-send-email-geert@linux-m68k.org> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Geert Uytterhoeven Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-m68k@vger.kernel.org Hello, 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=3Dy= =2E > > 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 > , which is not included by all > architectures supporting CONFIG_HAS_DMA=3Dy. There exist no alternat= ive > implementations. > > Hence for e.g. m68k allmodconfig, I get: > > drivers/media/v4l2-core/videobuf2-dma-contig.c: In function =E2=80=98= vb2_dc_mmap=E2=80=99: > drivers/media/v4l2-core/videobuf2-dma-contig.c:204: error: implicit d= eclaration of function =E2=80=98dma_mmap_coherent=E2=80=99 > drivers/media/v4l2-core/videobuf2-dma-contig.c: In function =E2=80=98= vb2_dc_get_base_sgt=E2=80=99: > drivers/media/v4l2-core/videobuf2-dma-contig.c:387: error: implicit d= eclaration of function =E2=80=98dma_get_sgtable=E2=80=99 > > To fix this > - Move the forward declarations and inline definitions to > , so all CONFIG_HAS_DMA=3Dy architectures c= an use > them, > - Replace the hard "BUG_ON(!ops)" checks for dma_map_ops by soft c= hecks, > so architectures can fall back to the common code by returning N= ULL > from their get_dma_ops(). Note that there are no "BUG_ON(!ops)" = checks > in other functions in , > - 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_op= s=20 based calls (those archs probably have some reasons why they don't use it at=20 all) and provide static inline stubs which call dma_common_mmap and=20 dma_common_get_sgtable. It is definitely my fault that I missed the case of non-dma-map-ops=20 based archs while I was adding support for dma_mmap_coherent and dma_get_sgt calls.= =2E. > (snipped) Best regards --=20 Marek Szyprowski Samsung Poland R&D Center