From patchwork Wed Jul 13 06:29:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 970702 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6D6UDCp001665 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 13 Jul 2011 06:30:40 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QgsxP-0007LA-0J; Wed, 13 Jul 2011 06:30:03 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QgsxO-0000lE-KP; Wed, 13 Jul 2011 06:30:02 +0000 Received: from ch1ehsobe006.messaging.microsoft.com ([216.32.181.186] helo=ch1outboundpool.messaging.microsoft.com) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QgsxH-0000kt-BJ for linux-arm-kernel@lists.infradead.org; Wed, 13 Jul 2011 06:30:00 +0000 Received: from mail83-ch1-R.bigfish.com (216.32.181.170) by CH1EHSOBE005.bigfish.com (10.43.70.55) with Microsoft SMTP Server id 14.1.225.22; Wed, 13 Jul 2011 06:29:52 +0000 Received: from mail83-ch1 (localhost.localdomain [127.0.0.1]) by mail83-ch1-R.bigfish.com (Postfix) with ESMTP id 710821BD02B3; Wed, 13 Jul 2011 06:29:52 +0000 (UTC) X-SpamScore: -19 X-BigFish: VS-19(zz9371M542M1432N98dKzz1202hzzz2dh2a8h668h839h8e2h8e3h944h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail83-ch1 (localhost.localdomain [127.0.0.1]) by mail83-ch1 (MessageSwitch) id 1310538592281141_22364; Wed, 13 Jul 2011 06:29:52 +0000 (UTC) Received: from CH1EHSMHS003.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.242]) by mail83-ch1.bigfish.com (Postfix) with ESMTP id 34B108C004B; Wed, 13 Jul 2011 06:29:52 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS003.bigfish.com (10.43.70.3) with Microsoft SMTP Server (TLS) id 14.1.225.22; Wed, 13 Jul 2011 06:29:52 +0000 Received: from 039-SN1MPN1-002.039d.mgd.msft.net ([169.254.2.218]) by 039-SN1MMR1-001.039d.mgd.msft.net ([10.84.1.13]) with mapi id 14.01.0289.008; Wed, 13 Jul 2011 01:29:49 -0500 From: Dong Aisheng-B29396 To: Mark Brown Subject: RE: [PATCH V2 01/10] ASoc: mxs: add mxs-pcm driver Thread-Topic: [PATCH V2 01/10] ASoc: mxs: add mxs-pcm driver Thread-Index: AQHMQKI6LtXBh/Jop0Ou0fyXBjNijpTpqQuAgAAhdbA= Date: Wed, 13 Jul 2011 06:29:48 +0000 Message-ID: <65EE16ACC360FA4D99C96DC085B3F7721CD7EC@039-SN1MPN1-002.039d.mgd.msft.net> References: <1310483085-31442-1-git-send-email-b29396@freescale.com> <1310483085-31442-2-git-send-email-b29396@freescale.com> <20110712232719.GB17710@opensource.wolfsonmicro.com> In-Reply-To: <20110712232719.GB17710@opensource.wolfsonmicro.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.192.242.89] MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110713_022955_787725_066070A1 X-CRM114-Status: GOOD ( 17.69 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [216.32.181.186 listed in list.dnswl.org] Cc: "alsa-devel@alsa-project.org" , "s.hauer@pengutronix.de" , "lrg@ti.com" , "linux-arm-kernel@lists.infradead.org" , "u.kleine-koenig@pengutronix.de" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 13 Jul 2011 06:30:40 +0000 (UTC) > -----Original Message----- > From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com] > Sent: Wednesday, July 13, 2011 7:27 AM > To: Dong Aisheng-B29396 > Cc: alsa-devel@alsa-project.org; linux-arm-kernel@lists.infradead.org; > lrg@ti.com; s.hauer@pengutronix.de; u.kleine-koenig@pengutronix.de > Subject: Re: [PATCH V2 01/10] ASoc: mxs: add mxs-pcm driver > > On Tue, Jul 12, 2011 at 11:04:36PM +0800, Dong Aisheng wrote: > > > + if (dai->driver->capture.channels_min) { > > + ret = mxs_pcm_preallocate_dma_buffer(pcm, > > + SNDRV_PCM_STREAM_CAPTURE); > > + if (ret) > > + goto out; > > + } > > For robustness replace the channels_min check with a check for the > relevant substream being present (see pxa2xx-pcm.c for a recent example). Is this change ok? Regards Dong Aisheng diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c index 3e3a8c8..a385ba9 100644 --- a/sound/soc/mxs/mxs-pcm.c +++ b/sound/soc/mxs/mxs-pcm.c @@ -288,14 +288,14 @@ static int mxs_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, card->dev->dma_mask = &mxs_pcm_dmamask; if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = DMA_BIT_MASK(32); - if (dai->driver->playback.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ret = mxs_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); if (ret) goto out; } - if (dai->driver->capture.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { ret = mxs_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE); if (ret)