From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> To: alsa-devel@alsa-project.org Cc: linux-usb@vger.kernel.org, tglx@linutronix.de, Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>, Sebastian Andrzej Siewior <bigeasy@linutronix.de>, Daniel Mack <zonque@gmail.com> Subject: [6/9] ALSA: usb: caiaq: use usb_fill_int_urb() Date: Tue, 19 Jun 2018 23:55:18 +0200 [thread overview] Message-ID: <20180619215521.13688-7-bigeasy@linutronix.de> (raw) 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 <zonque@gmail.com> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- 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;
WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> To: alsa-devel@alsa-project.org Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>, linux-usb@vger.kernel.org, Takashi Iwai <tiwai@suse.com>, Daniel Mack <zonque@gmail.com>, tglx@linutronix.de Subject: [PATCH 6/9] ALSA: usb: caiaq: use usb_fill_int_urb() Date: Tue, 19 Jun 2018 23:55:18 +0200 [thread overview] Message-ID: <20180619215521.13688-7-bigeasy@linutronix.de> (raw) In-Reply-To: <20180619215521.13688-1-bigeasy@linutronix.de> 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 <zonque@gmail.com> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- 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; -- 2.17.1
next reply other threads:[~2018-06-19 21:55 UTC|newest] Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-06-19 21:55 Sebastian Andrzej Siewior [this message] 2018-06-19 21:55 ` [PATCH 6/9] ALSA: usb: caiaq: use usb_fill_int_urb() Sebastian Andrzej Siewior -- strict thread matches above, loose matches on Subject: below -- 2018-06-22 10:14 [6/9] " Sebastian Andrzej Siewior 2018-06-22 10:14 ` [PATCH 6/9] " Sebastian Andrzej Siewior 2018-06-22 10:01 [6/9] " Daniel Mack 2018-06-22 10:01 ` [PATCH 6/9] " Daniel Mack 2018-06-22 8:49 [6/9] " Takashi Iwai 2018-06-22 8:49 ` [PATCH 6/9] " Takashi Iwai 2018-06-21 21:16 [6/9] " Sebastian Andrzej Siewior 2018-06-21 21:16 ` [PATCH 6/9] " Sebastian Andrzej Siewior 2018-06-21 20:19 [6/9] " Daniel Mack 2018-06-21 20:19 ` [PATCH 6/9] " Daniel Mack 2018-06-21 20:18 [5/9] ALSA: usb: caiaq: audio: use irqsave() in USB's complete callback Daniel Mack 2018-06-21 20:18 ` [PATCH 5/9] " Daniel Mack 2018-06-20 16:20 [8/9] ALSA: usx2y: usbusx2yaudio: use usb_fill_int_urb() Takashi Iwai 2018-06-20 16:20 ` [PATCH 8/9] " Takashi Iwai 2018-06-20 15:47 [8/9] " Sebastian Andrzej Siewior 2018-06-20 15:47 ` [PATCH 8/9] " Sebastian Andrzej Siewior 2018-06-20 15:38 [8/9] " Sebastian Andrzej Siewior 2018-06-20 15:38 ` [PATCH 8/9] " Sebastian Andrzej Siewior 2018-06-20 14:52 [8/9] " Takashi Iwai 2018-06-20 14:52 ` [PATCH 8/9] " Takashi Iwai 2018-06-20 14:39 [8/9] " Sebastian Andrzej Siewior 2018-06-20 14:39 ` [PATCH 8/9] " Sebastian Andrzej Siewior 2018-06-20 14:00 [4/9,v2] ALSA: usb-audio: " Takashi Iwai 2018-06-20 14:00 ` [PATCH 4/9 v2] " Takashi Iwai 2018-06-20 13:56 [4/9,v2] " Takashi Iwai 2018-06-20 13:56 ` [PATCH 4/9 v2] " Takashi Iwai 2018-06-20 13:52 [4/9,v2] " Sebastian Andrzej Siewior 2018-06-20 13:52 ` [PATCH 4/9 v2] " Sebastian Andrzej Siewior 2018-06-20 13:21 [4/9,v2] " Takashi Iwai 2018-06-20 13:21 ` [PATCH 4/9 v2] " Takashi Iwai 2018-06-20 12:51 [8/9] ALSA: usx2y: usbusx2yaudio: " Takashi Iwai 2018-06-20 12:51 ` [PATCH 8/9] " Takashi Iwai 2018-06-20 9:38 [4/9,v2] ALSA: usb-audio: " Sebastian Andrzej Siewior 2018-06-20 9:38 ` [PATCH 4/9 v2] " Sebastian Andrzej Siewior 2018-06-20 8:23 [4/9] " Sergei Shtylyov 2018-06-20 8:23 ` [PATCH 4/9] " Sergei Shtylyov 2018-06-19 21:55 [9/9] ALSA: usx2y: usx2yhwdeppcm: " Sebastian Andrzej Siewior 2018-06-19 21:55 ` [PATCH 9/9] " Sebastian Andrzej Siewior 2018-06-19 21:55 [8/9] ALSA: usx2y: usbusx2yaudio: " Sebastian Andrzej Siewior 2018-06-19 21:55 ` [PATCH 8/9] " Sebastian Andrzej Siewior 2018-06-19 21:55 [7/9] ALSA: usb-midi: use irqsave() in USB's complete callback Sebastian Andrzej Siewior 2018-06-19 21:55 ` [PATCH 7/9] " Sebastian Andrzej Siewior 2018-06-19 21:55 [5/9] ALSA: usb: caiaq: audio: " Sebastian Andrzej Siewior 2018-06-19 21:55 ` [PATCH 5/9] " Sebastian Andrzej Siewior 2018-06-19 21:55 [4/9] ALSA: usb-audio: use usb_fill_int_urb() Sebastian Andrzej Siewior 2018-06-19 21:55 ` [PATCH 4/9] " Sebastian Andrzej Siewior 2018-06-19 21:55 [3/9] ALSA: ua101: " Sebastian Andrzej Siewior 2018-06-19 21:55 ` [PATCH 3/9] " Sebastian Andrzej Siewior 2018-06-19 21:55 [2/9] ALSA: line6: " Sebastian Andrzej Siewior 2018-06-19 21:55 ` [PATCH 2/9] " Sebastian Andrzej Siewior 2018-06-19 21:55 [1/9] ALSA: 6fire: " Sebastian Andrzej Siewior 2018-06-19 21:55 ` [PATCH 1/9] " Sebastian Andrzej Siewior 2018-06-19 21:55 ALSA: use irqsave() in URB completion + usb_fill_int_urb Sebastian Andrzej Siewior 2018-06-20 12:55 ` Takashi Iwai
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180619215521.13688-7-bigeasy@linutronix.de \ --to=bigeasy@linutronix.de \ --cc=alsa-devel@alsa-project.org \ --cc=linux-usb@vger.kernel.org \ --cc=perex@perex.cz \ --cc=tglx@linutronix.de \ --cc=tiwai@suse.com \ --cc=zonque@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.