From patchwork Mon Jul 10 14:13:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 9833087 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D0BCD60318 for ; Mon, 10 Jul 2017 14:23:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCFF5252D5 for ; Mon, 10 Jul 2017 14:23:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1617274D2; Mon, 10 Jul 2017 14:23:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA4C5252D5 for ; Mon, 10 Jul 2017 14:23:32 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 75D82266D71; Mon, 10 Jul 2017 16:13:41 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 266CA266D82; Mon, 10 Jul 2017 16:13:40 +0200 (CEST) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 1BD54266D49 for ; Mon, 10 Jul 2017 16:13:37 +0200 (CEST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5A61BAABA for ; Mon, 10 Jul 2017 14:13:37 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Mon, 10 Jul 2017 16:13:36 +0200 Message-Id: <20170710141336.18649-1-tiwai@suse.de> X-Mailer: git-send-email 2.13.2 Subject: [alsa-devel] [PATCH] ALSA: pcm: Simplify check for dma_mmap_coherent() availability X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP We check the availability of dma_mmap_coherent() in hw_support_mmap() but with an ugly ifdef of lots of arch-checks. Now we have a nice CONFIG_ARCH_NO_COHERENT_DMA_MMAP kconfig, and this can be used together with CONFIG_HAS_DMA check for a cleaner and more comprehensive check. Signed-off-by: Takashi Iwai --- sound/core/pcm_native.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index b26c7e61d600..2a730f38e375 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -238,10 +238,8 @@ static bool hw_support_mmap(struct snd_pcm_substream *substream) { if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_MMAP)) return false; - /* check architectures that return -EINVAL from dma_mmap_coherent() */ - /* FIXME: this should be some global flag */ -#if defined(CONFIG_C6X) || defined(CONFIG_FRV) || defined(CONFIG_MN10300) ||\ - defined(CONFIG_PARISC) || defined(CONFIG_XTENSA) + /* architecture supports dma_mmap_coherent()? */ +#if defined(CONFIG_ARCH_NO_COHERENT_DMA_MMAP) || !defined(CONFIG_HAS_DMA) if (!substream->ops->mmap && substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV) return false;