From patchwork Tue Jan 27 16:13:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 5718661 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 8017AC058D for ; Tue, 27 Jan 2015 16:14:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9B1512024C for ; Tue, 27 Jan 2015 16:14:10 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 755BB2022A for ; Tue, 27 Jan 2015 16:14:07 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id A372C2614C1; Tue, 27 Jan 2015 17:14:06 +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 7A3542608EA; Tue, 27 Jan 2015 17:13:30 +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 782F32612AE; Tue, 27 Jan 2015 17:13:29 +0100 (CET) Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 39B282608EA for ; Tue, 27 Jan 2015 17:13:19 +0100 (CET) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F1135ADB9; Tue, 27 Jan 2015 16:13:18 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Tue, 27 Jan 2015 17:13:16 +0100 Message-Id: <1422375197-17293-5-git-send-email-tiwai@suse.de> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1422375197-17293-1-git-send-email-tiwai@suse.de> References: <1422375197-17293-1-git-send-email-tiwai@suse.de> Cc: Stefan Hajnoczi , Chris Rorvick Subject: [alsa-devel] [PATCH 4/5] ALSA: line6: Make common PCM pointer callback 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 Both playback and capture callbacks are identical, so let's merge them. Signed-off-by: Takashi Iwai --- sound/usb/line6/capture.c | 11 +---------- sound/usb/line6/pcm.c | 9 +++++++++ sound/usb/line6/pcm.h | 1 + sound/usb/line6/playback.c | 11 +---------- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/sound/usb/line6/capture.c b/sound/usb/line6/capture.c index 1184876f4e00..5b0963b5f318 100644 --- a/sound/usb/line6/capture.c +++ b/sound/usb/line6/capture.c @@ -231,15 +231,6 @@ static int snd_line6_capture_close(struct snd_pcm_substream *substream) return 0; } -/* capture pointer callback */ -static snd_pcm_uframes_t -snd_line6_capture_pointer(struct snd_pcm_substream *substream) -{ - struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); - - return line6pcm->in.pos_done; -} - /* capture operators */ struct snd_pcm_ops snd_line6_capture_ops = { .open = snd_line6_capture_open, @@ -249,7 +240,7 @@ struct snd_pcm_ops snd_line6_capture_ops = { .hw_free = snd_line6_hw_free, .prepare = snd_line6_prepare, .trigger = snd_line6_trigger, - .pointer = snd_line6_capture_pointer, + .pointer = snd_line6_pointer, }; int line6_create_audio_in_urbs(struct snd_line6_pcm *line6pcm) diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c index 470fc1049d54..73c87467d2e0 100644 --- a/sound/usb/line6/pcm.c +++ b/sound/usb/line6/pcm.c @@ -266,6 +266,15 @@ int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd) return 0; } +/* common PCM pointer callback */ +snd_pcm_uframes_t snd_line6_pointer(struct snd_pcm_substream *substream) +{ + struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); + struct line6_pcm_stream *pstr = get_stream(line6pcm, substream->stream); + + return pstr->pos_done; +} + /* Acquire and start duplex streams: * type is either LINE6_STREAM_IMPULSE or LINE6_STREAM_MONITOR */ diff --git a/sound/usb/line6/pcm.h b/sound/usb/line6/pcm.h index 66f603dfa34e..42d3e6fc2c61 100644 --- a/sound/usb/line6/pcm.h +++ b/sound/usb/line6/pcm.h @@ -214,6 +214,7 @@ extern int snd_line6_prepare(struct snd_pcm_substream *substream); extern int snd_line6_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params); extern int snd_line6_hw_free(struct snd_pcm_substream *substream); +extern snd_pcm_uframes_t snd_line6_pointer(struct snd_pcm_substream *substream); extern void line6_pcm_disconnect(struct snd_line6_pcm *line6pcm); extern int line6_pcm_acquire(struct snd_line6_pcm *line6pcm, int type); extern void line6_pcm_release(struct snd_line6_pcm *line6pcm, int type); diff --git a/sound/usb/line6/playback.c b/sound/usb/line6/playback.c index f8b04e2d36b3..1708c05f14db 100644 --- a/sound/usb/line6/playback.c +++ b/sound/usb/line6/playback.c @@ -380,15 +380,6 @@ static int snd_line6_playback_close(struct snd_pcm_substream *substream) return 0; } -/* playback pointer callback */ -static snd_pcm_uframes_t -snd_line6_playback_pointer(struct snd_pcm_substream *substream) -{ - struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); - - return line6pcm->out.pos_done; -} - /* playback operators */ struct snd_pcm_ops snd_line6_playback_ops = { .open = snd_line6_playback_open, @@ -398,7 +389,7 @@ struct snd_pcm_ops snd_line6_playback_ops = { .hw_free = snd_line6_hw_free, .prepare = snd_line6_prepare, .trigger = snd_line6_trigger, - .pointer = snd_line6_playback_pointer, + .pointer = snd_line6_pointer, }; int line6_create_audio_out_urbs(struct snd_line6_pcm *line6pcm)