File: card.patch

package info (click to toggle)
alsa-driver 1.0.23%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,448 kB
  • ctags: 77,491
  • sloc: ansic: 473,525; sh: 3,307; makefile: 2,661; python: 1,527; perl: 1,316; awk: 66
file content (117 lines) | stat: -rw-r--r-- 3,301 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
--- ../alsa-kernel/usb/card.c	2010-04-16 10:37:42.000000000 +0200
+++ card.c	2010-04-16 10:29:29.000000000 +0200
@@ -1,3 +1,4 @@
+#include "card.inc"
 /*
  *   (Tentative) USB Audio Driver for ALSA
  *
@@ -79,7 +80,12 @@
 static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 };
 static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 };
 static int nrpacks = 8;		/* max. number of packets per urb */
-static int async_unlink = 1;
+static int async_unlink =
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
+1;
+#else
+0; /* disabled as default for buggy async-unlink handling */
+#endif
 static int device_setup[SNDRV_CARDS]; /* device parameter for this card */
 static int ignore_ctl_error;
 
@@ -238,13 +244,18 @@
 	case UAC_VERSION_2: {
 		struct uac_clock_source_descriptor *cs;
 		struct usb_interface_assoc_descriptor *assoc =
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
 			usb_ifnum_to_if(dev, ctrlif)->intf_assoc;
+#else
+			NULL;
+#endif
 
 		if (!assoc) {
 			snd_printk(KERN_ERR "Audio class v2 interfaces need an interface association\n");
 			return -EINVAL;
 		}
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
 		/* FIXME: for now, we expect there is at least one clock source
 		 * descriptor and we always take the first one.
 		 * We should properly support devices with multiple clock sources,
@@ -266,6 +277,7 @@
 			if (intf != ctrlif)
 				snd_usb_create_stream(chip, ctrlif, intf);
 		}
+#endif
 
 		break;
 	}
@@ -341,8 +353,13 @@
 	chip->nrpacks = nrpacks;
 	chip->async_unlink = async_unlink;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
 	chip->usb_id = USB_ID(le16_to_cpu(dev->descriptor.idVendor),
 			      le16_to_cpu(dev->descriptor.idProduct));
+#else
+	chip->usb_id = USB_ID(dev->descriptor.idVendor,
+			      dev->descriptor.idProduct);
+#endif
 	INIT_LIST_HEAD(&chip->pcm_list);
 	INIT_LIST_HEAD(&chip->midi_list);
 	INIT_LIST_HEAD(&chip->mixer_list);
@@ -428,8 +445,12 @@
 
 	alts = &intf->altsetting[0];
 	ifnum = get_iface_desc(alts)->bInterfaceNumber;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
 	id = USB_ID(le16_to_cpu(dev->descriptor.idVendor),
 		    le16_to_cpu(dev->descriptor.idProduct));
+#else
+	id = USB_ID(dev->descriptor.idVendor, dev->descriptor.idProduct);
+#endif
 	if (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum)
 		goto __err_val;
 
@@ -547,6 +568,7 @@
 	}
 }
 
+#ifndef OLD_USB
 /*
  * new 2.5 USB kernel API
  */
@@ -610,6 +632,7 @@
 #define usb_audio_suspend	NULL
 #define usb_audio_resume	NULL
 #endif		/* CONFIG_PM */
+#endif	/* OLD_USB */
 
 static struct usb_device_id usb_audio_ids [] = {
 #include "quirks-table.h"
@@ -626,11 +649,19 @@
  */
 
 static struct usb_driver usb_audio_driver = {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 70) && LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)	/* FIXME: find right number */
+	.owner =	THIS_MODULE,
+#endif
 	.name =		"snd-usb-audio",
 	.probe =	usb_audio_probe,
 	.disconnect =	usb_audio_disconnect,
+#ifndef OLD_USB
 	.suspend =	usb_audio_suspend,
 	.resume =	usb_audio_resume,
+#endif
+#ifdef OLD_USB
+	.driver_list =	LIST_HEAD_INIT(usb_audio_driver.driver_list), 
+#endif
 	.id_table =	usb_audio_ids,
 };
 
@@ -650,3 +681,5 @@
 
 module_init(snd_usb_audio_init);
 module_exit(snd_usb_audio_cleanup);
+
+#include "card.inc1"