Hi David

> It can't use that API any more.  Please merge.

Just sent this to alsa-devel.
Hope its ok with future API also.

regards,
Karsten

----------  Weitergeleitete Nachricht  ----------
Subject: [PATCH]snd-usb-usx2y 0.8.7: Use macro usb_maxpacket() for portability
Date: Donnerstag 02 Dezember 2004 13:19
From: Karsten Wiese <[EMAIL PROTECTED]>
To: Takashi Iwai <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]

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 <[EMAIL PROTECTED]>
<<<<
-------------------------------------------------------

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 <[EMAIL PROTECTED]>");
-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;

Reply via email to