From patchwork Mon Jan 19 15:54:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 5659211 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0FC5AC058D for ; Mon, 19 Jan 2015 15:58:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 416AA200CF for ; Mon, 19 Jan 2015 15:58:04 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 1071D2037D for ; Mon, 19 Jan 2015 15:58:03 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 30A23264F8D; Mon, 19 Jan 2015 16:58:02 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 412EB261507; Mon, 19 Jan 2015 16:55:21 +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 4BDC3261501; Mon, 19 Jan 2015 16:55:20 +0100 (CET) Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 4BBFB26145B for ; Mon, 19 Jan 2015 16:55:03 +0100 (CET) Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D0C09AD34; Mon, 19 Jan 2015 15:55:02 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Mon, 19 Jan 2015 16:54:49 +0100 Message-Id: <1421682891-11594-16-git-send-email-tiwai@suse.de> X-Mailer: git-send-email 2.2.1 In-Reply-To: <1421682891-11594-1-git-send-email-tiwai@suse.de> References: <1421682891-11594-1-git-send-email-tiwai@suse.de> Cc: Stefan Hajnoczi , Chris Rorvick Subject: [alsa-devel] [PATCH 15/17] ALSA: line6: Sync PCM stop at disconnect 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 Call line6_pcm_disconnect() at disconnect to make sure that all URBs are cleared. Also reduce the superfluous snd_pcm_stop() calls from the function (and remove the unused function) since the streams are guaranteed to be stopped at this point via snd_card_disconnect(). Signed-off-by: Takashi Iwai --- sound/usb/line6/driver.c | 2 ++ sound/usb/line6/pcm.c | 19 +------------------ 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c index f222d9ffeca5..1193d16396a0 100644 --- a/sound/usb/line6/driver.c +++ b/sound/usb/line6/driver.c @@ -670,6 +670,8 @@ void line6_disconnect(struct usb_interface *interface) dev_err(line6->ifcdev, "driver bug: inconsistent usb device\n"); snd_card_disconnect(line6->card); + if (line6->line6pcm) + line6_pcm_disconnect(line6->line6pcm); if (line6->disconnect) line6->disconnect(interface); diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c index 39034c7681da..08fa9753a680 100644 --- a/sound/usb/line6/pcm.c +++ b/sound/usb/line6/pcm.c @@ -379,30 +379,13 @@ static int snd_line6_new_pcm(struct usb_line6 *line6, struct snd_pcm **pcm_ret) } /* - Stop substream if still running. -*/ -static void pcm_disconnect_substream(struct snd_pcm_substream *substream) -{ - if (substream->runtime && snd_pcm_running(substream)) { - snd_pcm_stream_lock_irq(substream); - snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED); - snd_pcm_stream_unlock_irq(substream); - } -} - -/* - Stop PCM stream. + Sync with PCM stream stops. */ void line6_pcm_disconnect(struct snd_line6_pcm *line6pcm) { - pcm_disconnect_substream(get_substream - (line6pcm, SNDRV_PCM_STREAM_CAPTURE)); - pcm_disconnect_substream(get_substream - (line6pcm, SNDRV_PCM_STREAM_PLAYBACK)); line6_unlink_wait_clear_audio_out_urbs(line6pcm); line6_unlink_wait_clear_audio_in_urbs(line6pcm); } -EXPORT_SYMBOL_GPL(line6_pcm_disconnect); /* Create and register the PCM device and mixer entries.