Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756348Ab0FCRab (ORCPT ); Thu, 3 Jun 2010 13:30:31 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:50409 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753403Ab0FCRa0 (ORCPT ); Thu, 3 Jun 2010 13:30:26 -0400 Subject: Re: [RFC][PATCH 21/26] alsa: ASoC: Add JZ4740 ASoC support From: Liam Girdwood To: Lars-Peter Clausen Cc: Ralf Baechle , linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, Mark Brown , alsa-devel@alsa-project.org In-Reply-To: <4C07E37A.40502@metafoo.de> References: <1275505397-16758-1-git-send-email-lars@metafoo.de> <1275505950-17334-5-git-send-email-lars@metafoo.de> <1275569309.3593.106.camel@odin> <4C07DD48.2050503@metafoo.de> <1275584609.3118.26.camel@odin> <4C07E37A.40502@metafoo.de> Content-Type: text/plain; charset="UTF-8" Date: Thu, 03 Jun 2010 18:25:00 +0100 Message-ID: <1275585900.3118.29.camel@odin> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1826 Lines: 64 On Thu, 2010-06-03 at 19:16 +0200, Lars-Peter Clausen wrote: > Liam Girdwood wrote: > > On Thu, 2010-06-03 at 18:50 +0200, Lars-Peter Clausen wrote: > > > >>>> + config = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, > >>>> > >> substream); > >> > >>>> + if (!prtd->dma) { > >>>> + const char *dma_channel_name; > >>>> + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) > >>>> + dma_channel_name = "PCM Playback"; > >>>> + else > >>>> + dma_channel_name = "PCM Capture"; > >>>> + > >>>> + prtd->dma = jz4740_dma_request(substream, > >>>> > >> dma_channel_name); > >> > >>>> > >>>> > >>> dma_channel_name variable is not required here. Just use the const > >>> > >> char > >> > >>> * directly. > >>> > >>> > >>> > >> I actually had it like that before, but I think it is much more readable > >> in its current form. > >> > > > > I disagree, having the char pointer here just adds an extra level of > > indirection and costs an extra two lines of code. > > > > Liam > > > Hi > > Could you give an concrete example of how you would code it? > Sure, if (!prtd->dma) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) prtd->dma = jz4740_dma_request(substream, "PCM Playback"); else prtd->dma = jz4740_dma_request(substream, "PCM Capture"); } Liam -- Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/