From patchwork Tue Jun 19 21:55:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 10475569 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 321F060230 for ; Tue, 19 Jun 2018 21:56:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2309C28CCE for ; Tue, 19 Jun 2018 21:56:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15ED428CD4; Tue, 19 Jun 2018 21:56:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67C4928CCE for ; Tue, 19 Jun 2018 21:56:32 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E6BA5267705; Tue, 19 Jun 2018 23:55:46 +0200 (CEST) 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 DF2E7267647; Tue, 19 Jun 2018 23:55:36 +0200 (CEST) Received: from Galois.linutronix.de (galois.linutronix.de [146.0.238.70]) by alsa0.perex.cz (Postfix) with ESMTP id AFCBF2675FA for ; Tue, 19 Jun 2018 23:55:34 +0200 (CEST) Received: from localhost ([127.0.0.1] helo=bazinga.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1fVOb7-0004KO-Og; Tue, 19 Jun 2018 23:55:33 +0200 From: Sebastian Andrzej Siewior To: alsa-devel@alsa-project.org Date: Tue, 19 Jun 2018 23:55:21 +0200 Message-Id: <20180619215521.13688-10-bigeasy@linutronix.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180619215521.13688-1-bigeasy@linutronix.de> References: <20180619215521.13688-1-bigeasy@linutronix.de> MIME-Version: 1.0 Cc: tglx@linutronix.de, linux-usb@vger.kernel.org, Takashi Iwai , Sebastian Andrzej Siewior Subject: [alsa-devel] [PATCH 9/9] ALSA: usx2y: usx2yhwdeppcm: use usb_fill_int_urb() 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Using usb_fill_int_urb() helps to find code which initializes an URB. A grep for members of the struct (like ->complete) reveal lots of other things, too. I'm keeping the transfer-length initialisation in usX2Y_usbpcm_urbs_start() because I am not certain if this does not change over time. Cc: Jaroslav Kysela Cc: Takashi Iwai Signed-off-by: Sebastian Andrzej Siewior --- sound/usb/usx2y/usx2yhwdeppcm.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index 4fd9276b8e50..0a14612f2178 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c @@ -325,6 +325,8 @@ static int usX2Y_usbpcm_urbs_allocate(struct snd_usX2Y_substream *subs) /* allocate and initialize data urbs */ for (i = 0; i < NRURBS; i++) { struct urb **purb = subs->urb + i; + void *buf; + if (*purb) { usb_kill_urb(*purb); continue; @@ -334,18 +336,19 @@ static int usX2Y_usbpcm_urbs_allocate(struct snd_usX2Y_substream *subs) usX2Y_usbpcm_urbs_release(subs); return -ENOMEM; } - (*purb)->transfer_buffer = is_playback ? - subs->usX2Y->hwdep_pcm_shm->playback : ( - subs->endpoint == 0x8 ? - subs->usX2Y->hwdep_pcm_shm->capture0x8 : - subs->usX2Y->hwdep_pcm_shm->capture0xA); + if (is_playback) { + buf = subs->usX2Y->hwdep_pcm_shm->playback; + } else { + if (subs->endpoint == 0x8) + buf = subs->usX2Y->hwdep_pcm_shm->capture0x8; + else + buf = subs->usX2Y->hwdep_pcm_shm->capture0xA; + } + usb_fill_int_urb(*purb, dev, pipe, buf, + subs->maxpacksize * nr_of_packs(), + i_usX2Y_usbpcm_subs_startup, subs, 1); - (*purb)->dev = dev; - (*purb)->pipe = pipe; (*purb)->number_of_packets = nr_of_packs(); - (*purb)->context = subs; - (*purb)->interval = 1; - (*purb)->complete = i_usX2Y_usbpcm_subs_startup; } return 0; }