All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]snd-usb-usx2y 0.8.7: Use macro usb_maxpacket() for portability
@ 2004-12-02 12:19 Karsten Wiese
  2004-12-02 14:42 ` Takashi Iwai
  0 siblings, 1 reply; 16+ messages in thread
From: Karsten Wiese @ 2004-12-02 12:19 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

Hi

on the usb-devel list there is a similar patch by David Brownell:
http://marc.theaimsgroup.com/?i=<200411281314.50175.david-b%20()%20pacbell%20!%20net>
David's patch doesn't compile on current kernel, so I wrote this one.

regards,
Karsten

patch header:
>>>>
Summary: Use macro usb_maxpacket() for portability.

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: Karsten Wiese <annabellesgarden@yahoo.de>
<<<<

[-- Attachment #2: snd-usb-usx2y.patch.0.8.7 --]
[-- Type: text/x-diff, Size: 2892 bytes --]

Index: alsa-kernel/usb/usx2y/usbusx2y.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/usb/usx2y/usbusx2y.c,v
retrieving revision 1.6
diff -U3 -r1.6 usbusx2y.c
--- alsa-kernel/usb/usx2y/usbusx2y.c	29 Nov 2004 14:09:49 -0000	1.6
+++ alsa-kernel/usb/usx2y/usbusx2y.c	2 Dec 2004 11:57:57 -0000
@@ -1,6 +1,10 @@
 /*
  * 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) }}");
 
Index: alsa-kernel/usb/usx2y/usbusx2yaudio.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/usb/usx2y/usbusx2yaudio.c,v
retrieving revision 1.6
diff -U3 -r1.6 usbusx2yaudio.c
--- alsa-kernel/usb/usx2y/usbusx2yaudio.c	27 Oct 2004 07:38:35 -0000	1.6
+++ alsa-kernel/usb/usx2y/usbusx2yaudio.c	2 Dec 2004 11:57:59 -0000
@@ -413,25 +413,23 @@
 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 @@
 			}
 		}
 		(*purb)->dev = dev;
-		(*purb)->pipe = datapipe;
+		(*purb)->pipe = pipe;
 		(*purb)->number_of_packets = nr_of_packs();
 		(*purb)->context = subs;
 		(*purb)->interval = 1;

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2004-12-10 21:08 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-02 12:19 [PATCH]snd-usb-usx2y 0.8.7: Use macro usb_maxpacket() for portability Karsten Wiese
2004-12-02 14:42 ` Takashi Iwai
2004-12-06 22:15   ` Karsten Wiese
2004-12-07 11:48     ` Takashi Iwai
2004-12-07 22:01       ` Karsten Wiese
2004-12-08 19:32         ` Takashi Iwai
2004-12-09  8:18           ` Jaroslav Kysela
2004-12-09 10:14             ` Takashi Iwai
2004-12-09 12:06           ` Karsten Wiese
2004-12-10 15:57             ` Rui Nuno Capela
2004-12-10 16:13               ` Takashi Iwai
2004-12-10 17:42                 ` Rui Nuno Capela
2004-12-10 17:53                   ` Takashi Iwai
2004-12-10 18:18                     ` Rui Nuno Capela
2004-12-10 18:24                       ` Takashi Iwai
2004-12-10 21:08                         ` Rui Nuno Capela

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.