From patchwork Wed Nov 12 14:55:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Henningsson X-Patchwork-Id: 5290421 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6004B9F440 for ; Wed, 12 Nov 2014 15:02:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9C1F4201BB for ; Wed, 12 Nov 2014 15:02:47 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id A86932017D for ; Wed, 12 Nov 2014 15:02:46 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 84DB2265764; Wed, 12 Nov 2014 16:02:45 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id BA9A2265675; Wed, 12 Nov 2014 16:02:25 +0100 (CET) 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 609DC265675; Wed, 12 Nov 2014 16:02:24 +0100 (CET) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by alsa0.perex.cz (Postfix) with ESMTP id C90D92656EE for ; Wed, 12 Nov 2014 15:55:42 +0100 (CET) Received: from hd9483857.selulk5.dyn.perspektivbredband.net ([217.72.56.87] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1XoZKf-0007ep-RE; Wed, 12 Nov 2014 14:55:41 +0000 From: David Henningsson To: alsa-devel@alsa-project.org Date: Wed, 12 Nov 2014 15:55:43 +0100 Message-Id: <1415804143-11519-1-git-send-email-david.henningsson@canonical.com> X-Mailer: git-send-email 1.9.1 Cc: tiwai@suse.de, hyperair@ubuntu.com, David Henningsson Subject: [alsa-devel] [PATCH] a52: Ignore start request if we're already running 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 When trying to start a PCM that's already running, the result is EBADFD. We might have implicitly started the buffer by filling it up, so just ignore this request if we're already running. Reported-by: Chow Loong Jin Signed-off-by: David Henningsson --- a52/pcm_a52.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/a52/pcm_a52.c b/a52/pcm_a52.c index b467ec8..59e25cb 100644 --- a/a52/pcm_a52.c +++ b/a52/pcm_a52.c @@ -482,6 +482,12 @@ static int a52_start(snd_pcm_ioplug_t *io) { struct a52_ctx *rec = io->private_data; + /* When trying to start a PCM that's already running, the result is + EBADFD. We might have implicitly started the buffer by filling it + up, so just ignore this request if we're already running. */ + if (snd_pcm_state(rec->slave) == SND_PCM_STATE_RUNNING) + return 0; + return snd_pcm_start(rec->slave); }