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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
--- bulk.c.orig
+++ bulk.c
@@ -34,6 +34,9 @@
#include <linux/usb.h>
#include <linux/delay.h>
#include <linux/version.h> /* For LINUX_VERSION_CODE */
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) )
+#include <linux/semaphore.h>
+#endif
#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35) )
#include <linux/slab.h>
#endif
@@ -3086,7 +3089,11 @@ int hdj_create_bulk_interface(struct snd_hdj_chip* chip,
goto hdj_create_bulk_interface_error;
}
/* allocate the buffer for bulk_out_urb */
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) )
+ sema_init(&ubulk->bulk_out_buffer_mutex,1);
+#else
init_MUTEX(&ubulk->bulk_out_buffer_mutex);
+#endif
ubulk->bulk_out_buffer =
#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35) )
@@ -3633,7 +3640,11 @@ static int init_output_control_state(struct usb_hdjbulk *ubulk)
return -EINVAL;
}
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) )
+ sema_init(&ubulk->output_control_mutex,1);
+#else
init_MUTEX(&ubulk->output_control_mutex);
+#endif
init_completion(&ubulk->output_control_completion);
/* Every product here except the Steel targets HID. Since the steel does not target HID, we don't
@@ -3907,7 +3918,11 @@ int hdjbulk_init_dj_console(struct usb_hdjbulk *ubulk)
u16 value = 0;
struct hdj_console_context *dc = ((struct hdj_console_context *)ubulk->device_context);
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) )
+ sema_init(&dc->device_config_mutex,1);
+#else
init_MUTEX(&dc->device_config_mutex);
+#endif
ret = hdjbulk_init_common_context(ubulk,&ubulk->hdj_common);
if (ret!=0) {
@@ -4185,7 +4200,11 @@ int hdjbulk_init_dj_steel(struct usb_hdjbulk *ubulk)
spin_lock_init(&dc->bulk_buffer_lock);
init_completion(&dc->bulk_request_completion);
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) )
+ sema_init(&dc->bulk_request_mutex,1);
+#else
init_MUTEX(&dc->bulk_request_mutex);
+#endif
if ((ret = init_continuous_reader(ubulk))!=0) {
printk(KERN_WARNING"%s() init_continuous_reader() failed, rc:%d\n",
--- device.c.orig
+++ device.c
@@ -66,7 +66,11 @@ MODULE_PARM_DESC(index, "Index value for the Hercules DJ Series adapter.");
module_param_array(id, charp, NULL, 0444);
MODULE_PARM_DESC(id, "ID string for the Hercules DJ Series adapter.");
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) )
+static DEFINE_SEMAPHORE(register_mutex);
+#else
static DECLARE_MUTEX(register_mutex);
+#endif
static struct snd_hdj_chip *usb_chip[SNDRV_CARDS];
/* reference count for the socket */
@@ -1698,7 +1702,11 @@ static int snd_hdj_chip_create(struct usb_device *dev,
chip->card = card;
chip->product_code = product_code;
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) )
+ sema_init(&chip->vendor_request_mutex,1);
+#else
init_MUTEX(&chip->vendor_request_mutex);
+#endif
/* initialise the atomic variables */
atomic_set(&chip->locked_io, 0);
@@ -1713,7 +1721,11 @@ static int snd_hdj_chip_create(struct usb_device *dev,
INIT_LIST_HEAD(&chip->bulk_list);
chip->usb_id = USB_ID(le16_to_cpu(dev->descriptor.idVendor),
le16_to_cpu(dev->descriptor.idProduct));
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) )
+ sema_init(&chip->netlink_list_mutex,1);
+#else
init_MUTEX(&chip->netlink_list_mutex);
+#endif
INIT_LIST_HEAD(&chip->netlink_registered_processes);
/* fill in DJ capabilities for this device */
--- midi.c.orig
+++ midi.c
@@ -34,6 +34,9 @@
#include <linux/module.h>
#include <linux/usb.h>
#include <linux/kthread.h>
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) )
+#include <linux/semaphore.h>
+#endif
#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35) )
#include <linux/slab.h>
#endif
@@ -63,7 +66,7 @@
unsigned long channel_list_initialized = 0;
struct midi_channel_elem channel_list[NUM_MIDI_CHANNELS];
-spinlock_t channel_list_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(channel_list_lock);
static struct usb_protocol_ops snd_hdjmidi_standard_ops = {
.input = snd_hdjmidi_standard_input,
@@ -732,7 +735,11 @@ static int controller_output_init(struct controller_output_hid *controller_state
/* this buffer and URB below are for general control requests, like changing the
* mouse setting or setting LEDs */
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) )
+ sema_init(&controller_state->output_control_ctl_mutex, 1);
+#else
init_MUTEX(&controller_state->output_control_ctl_mutex);
+#endif
init_completion(&controller_state->output_control_ctl_completion);
#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35) )
controller_state->output_control_ctl_req = usb_alloc_coherent(ep->umidi->chip->dev,
|