Commit 83c60443 authored by Jaroslav Kysela's avatar Jaroslav Kysela

[ALSA] Use macro usb_maxpacket() for portability

USB USX2Y
In future kernels struct usb_device won't have the epmaxpacketin/out members.
Use macro usb_maxpacket() instead of directly accessing those members.
Signed-off-by: default avatarKarsten Wiese <annabellesgarden@yahoo.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent b03864a9
/*
* usbusy2y.c - ALSA USB US-428 Driver
*
2004-12-02 Karsten Wiese
Version 0.8.7:
Use macro usb_maxpacket() for portability.
2004-10-26 Karsten Wiese
Version 0.8.6:
wake_up() process waiting in usX2Y_urbs_start() on error.
......@@ -135,7 +139,7 @@
MODULE_AUTHOR("Karsten Wiese <annabellesgarden@yahoo.de>");
MODULE_DESCRIPTION("TASCAM "NAME_ALLCAPS" Version 0.8.6");
MODULE_DESCRIPTION("TASCAM "NAME_ALLCAPS" Version 0.8.7");
MODULE_LICENSE("GPL");
MODULE_SUPPORTED_DEVICE("{{TASCAM(0x1604), "NAME_ALLCAPS"(0x8001)(0x8005)(0x8007) }}");
......
......@@ -413,25 +413,23 @@ static void usX2Y_urbs_release(snd_usX2Y_substream_t *subs)
static int usX2Y_urbs_allocate(snd_usX2Y_substream_t *subs)
{
int i;
unsigned int datapipe; /* the data i/o pipe */
unsigned int pipe;
int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK];
struct usb_device *dev = subs->usX2Y->chip.dev;
if (is_playback) { /* allocate a temporary buffer for playback */
datapipe = usb_sndisocpipe(dev, subs->endpoint);
subs->maxpacksize = dev->epmaxpacketout[subs->endpoint];
pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) :
usb_rcvisocpipe(dev, subs->endpoint);
subs->maxpacksize = usb_maxpacket(dev, pipe, is_playback);
if (!subs->maxpacksize)
return -EINVAL;
if (is_playback && NULL == subs->tmpbuf) { /* allocate a temporary buffer for playback */
subs->tmpbuf = kcalloc(nr_of_packs(), subs->maxpacksize, GFP_KERNEL);
if (NULL == subs->tmpbuf) {
subs->tmpbuf = kcalloc(nr_of_packs(), subs->maxpacksize, GFP_KERNEL);
if (NULL == subs->tmpbuf) {
snd_printk(KERN_ERR "cannot malloc tmpbuf\n");
return -ENOMEM;
}
snd_printk(KERN_ERR "cannot malloc tmpbuf\n");
return -ENOMEM;
}
} else {
datapipe = usb_rcvisocpipe(dev, subs->endpoint);
subs->maxpacksize = dev->epmaxpacketin[subs->endpoint];
}
/* allocate and initialize data urbs */
for (i = 0; i < NRURBS; i++) {
struct urb** purb = subs->urb + i;
......@@ -453,7 +451,7 @@ static int usX2Y_urbs_allocate(snd_usX2Y_substream_t *subs)
}
}
(*purb)->dev = dev;
(*purb)->pipe = datapipe;
(*purb)->pipe = pipe;
(*purb)->number_of_packets = nr_of_packs();
(*purb)->context = subs;
(*purb)->interval = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment