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 <pe...@perex.cz>
Cc: Takashi Iwai <ti...@suse.com>
Signed-off-by: Sebastian Andrzej Siewior <bige...@linutronix.de>
---
 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;
 }
-- 
2.17.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to