Hello,

while attempting to use mixxx with the latest Realtime Linux kernel,
compilation of the hercules driver for the Mk2 DJ console, hdj_mod,
failed.
This is due to some changes in the ALSA tree in the kernel code that
changed mutex to semaphore.

The attach rather simple patch enable the compilation of hdj_mod
again, by changing mutex calls to the equivalent semaphore ones from
the new ALSA API.

In hope that this maybe useful for some.

Regards.
-- 
Arnaud LE BRETON

 "Computers are useless they can only give answers."
                                                        Pablo  Picasso
diff -rupNB hdjmod-1.28/bulk.c hdjmod-1.28_MODIF/bulk.c
--- hdjmod-1.28/bulk.c	2009-08-24 01:14:03.000000000 +0200
+++ hdjmod-1.28_MODIF/bulk.c	2009-08-24 22:56:07.000000000 +0200
@@ -3062,7 +3062,7 @@ int hdj_create_bulk_interface(struct snd
 		goto hdj_create_bulk_interface_error;
 	}
 	/* allocate the buffer for bulk_out_urb */
-	init_MUTEX(&ubulk->bulk_out_buffer_mutex);
+	semaphore_init(&ubulk->bulk_out_buffer_mutex);
 	
 	ubulk->bulk_out_buffer =
 		usb_buffer_alloc(ubulk->chip->dev, ubulk->bulk_out_size,
@@ -3601,7 +3601,7 @@ static int init_output_control_state(str
 		return -EINVAL;
 	}
 
-	init_MUTEX(&ubulk->output_control_mutex);
+	semaphore_init(&ubulk->output_control_mutex);
 	init_completion(&ubulk->output_control_completion);
 
 	/* Every product here except the Steel targets HID.  Since the steel does not target HID, we don't
@@ -3855,7 +3855,7 @@ int hdjbulk_init_dj_console(struct usb_h
 	u16 value = 0;
 	struct hdj_console_context *dc = ((struct hdj_console_context *)ubulk->device_context);
 
-	init_MUTEX(&dc->device_config_mutex);
+	semaphore_init(&dc->device_config_mutex);
 	
 	ret = hdjbulk_init_common_context(ubulk,&ubulk->hdj_common);
 	if (ret!=0) {
@@ -4133,7 +4133,7 @@ int hdjbulk_init_dj_steel(struct usb_hdj
 
 	spin_lock_init(&dc->bulk_buffer_lock);
 	init_completion(&dc->bulk_request_completion);
-	init_MUTEX(&dc->bulk_request_mutex);
+	semaphore_init(&dc->bulk_request_mutex);
 
 	if ((ret = init_continuous_reader(ubulk))!=0) {
 		printk(KERN_WARNING"%s() init_continuous_reader() failed, rc:%d\n",
diff -rupNB hdjmod-1.28/device.c hdjmod-1.28_MODIF/device.c
--- hdjmod-1.28/device.c	2009-08-24 01:14:03.000000000 +0200
+++ hdjmod-1.28_MODIF/device.c	2009-08-24 22:52:13.000000000 +0200
@@ -66,7 +66,7 @@ MODULE_PARM_DESC(index, "Index value for
 module_param_array(id, charp, NULL, 0444);
 MODULE_PARM_DESC(id, "ID string for the Hercules DJ Series adapter.");
 
-static DECLARE_MUTEX(register_mutex);
+static DEFINE_SEMAPHORE(register_mutex);
 static struct snd_hdj_chip *usb_chip[SNDRV_CARDS];
 
 /* reference count for the socket */
@@ -1660,11 +1660,12 @@ static int snd_hdj_chip_create(struct us
 		/* let the kernel option override custom id */
 		strncpy(card_id,id[idx],sizeof(card_id)-1);
 	}
-	card = snd_card_new(index[idx], card_id/*id[idx]*/, THIS_MODULE, 0);
-	if (card == NULL) {
-		snd_printk(KERN_WARNING "snd_hdj_chip_create(): cannot create card instance %d\n", idx);
-		return -ENOMEM;
-	}
+
+	err = snd_card_create(index[idx], card_id/*id[idx]*/, THIS_MODULE, 0, &card);
+        if (err < 0) {
+          snd_printk(KERN_WARNING "snd_hdj_chip_create(): cannot create card instance %d\n", idx);
+          return err;
+        }
 	
 	/* save the index, so people who have the card can reference the chip */
 	card->private_data = (void*)(unsigned long)idx;
@@ -1682,7 +1683,7 @@ static int snd_hdj_chip_create(struct us
 	chip->card = card;
 	chip->product_code = product_code;
 
-	init_MUTEX(&chip->vendor_request_mutex);
+	semaphore_init(&chip->vendor_request_mutex);
 
 	/* initialise the atomic variables */
 	atomic_set(&chip->locked_io, 0);
@@ -1697,7 +1698,7 @@ static int snd_hdj_chip_create(struct us
 	INIT_LIST_HEAD(&chip->bulk_list);
 	chip->usb_id = USB_ID(le16_to_cpu(dev->descriptor.idVendor),
 			      le16_to_cpu(dev->descriptor.idProduct));
-	init_MUTEX(&chip->netlink_list_mutex);
+	semaphore_init(&chip->netlink_list_mutex);
 	INIT_LIST_HEAD(&chip->netlink_registered_processes);
 	
 	/* fill in DJ capabilities for this device */
diff -rupNB hdjmod-1.28/midi.c hdjmod-1.28_MODIF/midi.c
--- hdjmod-1.28/midi.c	2009-08-24 01:14:03.000000000 +0200
+++ hdjmod-1.28_MODIF/midi.c	2009-08-24 22:57:10.000000000 +0200
@@ -677,7 +677,7 @@ static int controller_output_init(struct
 	
 	/* this buffer and URB below are for general control requests, like changing the
 	 *  mouse setting or setting LEDs */
-	init_MUTEX(&controller_state->output_control_ctl_mutex);
+	semaphore_init(&controller_state->output_control_ctl_mutex);
 	init_completion(&controller_state->output_control_ctl_completion);
 	controller_state->output_control_ctl_req = usb_buffer_alloc(ep->umidi->chip->dev, 
 							sizeof(*(controller_state->output_control_ctl_req)),
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mixxx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mixxx-devel

Reply via email to