From patchwork Tue Jun 19 21:55:18 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: 10475561 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 DA99A60353 for ; Tue, 19 Jun 2018 21:56:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA76828CCE for ; Tue, 19 Jun 2018 21:56:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BEE7828CD4; Tue, 19 Jun 2018 21:56:03 +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 1131828CCE for ; Tue, 19 Jun 2018 21:56:03 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 620B92676E1; Tue, 19 Jun 2018 23:55:41 +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 6EEFE267642; Tue, 19 Jun 2018 23:55:35 +0200 (CEST) Received: from Galois.linutronix.de (galois.linutronix.de [146.0.238.70]) by alsa0.perex.cz (Postfix) with ESMTP id 08878267614 for ; Tue, 19 Jun 2018 23:55:33 +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 1fVOb5-0004KO-W6; Tue, 19 Jun 2018 23:55:32 +0200 From: Sebastian Andrzej Siewior To: alsa-devel@alsa-project.org Date: Tue, 19 Jun 2018 23:55:18 +0200 Message-Id: <20180619215521.13688-7-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: Sebastian Andrzej Siewior , linux-usb@vger.kernel.org, Takashi Iwai , Daniel Mack , tglx@linutronix.de Subject: [alsa-devel] [PATCH 6/9] ALSA: usb: caiaq: 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. Cc: Daniel Mack Cc: Jaroslav Kysela Cc: Takashi Iwai Signed-off-by: Sebastian Andrzej Siewior Acked-by: Daniel Mack --- sound/usb/caiaq/audio.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c index 15344d39a6cd..e10d5790099f 100644 --- a/sound/usb/caiaq/audio.c +++ b/sound/usb/caiaq/audio.c @@ -736,16 +736,17 @@ static struct urb **alloc_urbs(struct snd_usb_caiaqdev *cdev, int dir, int *ret) } for (i = 0; i < N_URBS; i++) { + void *buf; + urbs[i] = usb_alloc_urb(FRAMES_PER_URB, GFP_KERNEL); if (!urbs[i]) { *ret = -ENOMEM; return urbs; } - urbs[i]->transfer_buffer = - kmalloc_array(BYTES_PER_FRAME, FRAMES_PER_URB, - GFP_KERNEL); - if (!urbs[i]->transfer_buffer) { + buf = kmalloc_array(BYTES_PER_FRAME, FRAMES_PER_URB, + GFP_KERNEL); + if (!buf) { *ret = -ENOMEM; return urbs; } @@ -758,15 +759,13 @@ static struct urb **alloc_urbs(struct snd_usb_caiaqdev *cdev, int dir, int *ret) iso->length = BYTES_PER_FRAME; } - urbs[i]->dev = usb_dev; - urbs[i]->pipe = pipe; - urbs[i]->transfer_buffer_length = FRAMES_PER_URB - * BYTES_PER_FRAME; - urbs[i]->context = &cdev->data_cb_info[i]; - urbs[i]->interval = 1; + usb_fill_int_urb(urbs[i], usb_dev, pipe, buf, + FRAMES_PER_URB * BYTES_PER_FRAME, + (dir == SNDRV_PCM_STREAM_CAPTURE) ? + read_completed : write_completed, + &cdev->data_cb_info[i], 1); + urbs[i]->number_of_packets = FRAMES_PER_URB; - urbs[i]->complete = (dir == SNDRV_PCM_STREAM_CAPTURE) ? - read_completed : write_completed; } *ret = 0;