Skip to contentSkip to conversation

snd-usb-caiaq: Fix compatibility with kernels < 2.6.19

PATCH Applied Sergey Vlasov 2 participants 2 messages Jun 11, 2007 – Jun 12, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 snd-usb-caiaq: Fix compatibility with kernels < 2.6.19

Kernels before 2.6.19 used a different signature for the urb->complete callback (an additional "struct pt_regs *regs" parameter was present), therefore snd-usb-caiaq needs some compatibility patches in alsa-driver, like snd-usb-audio.

---
The snd_usb_caiaq_midi_output_done() part is somewhat hackish - the problem is that snd_usb_caiaq_midi_output_done() is declared in caiaq-midi.h, and the alsa-driver build system does not support patching of *.h files. The rest is basically copied from usbaudio.patch.

Without the patch compiling for 2.6.18 produces warnings:

.../usb/caiaq/caiaq-device.c: In function 'init_card':
.../usb/caiaq/caiaq-device.c:316: warning: passing argument 6 of 'usb_fill_bulk_urb' from incompatible pointer type .../usb/caiaq/caiaq-device.c:321: warning: passing argument 6 of 'usb_fill_bulk_urb' from incompatible pointer type .../usb/caiaq/caiaq-audio.c: In function 'alloc_urbs':
.../usb/caiaq/caiaq-audio.c:583: warning: assignment from incompatible pointer type

usb/caiaq/Makefile renamed from usb/caiaq/Makefile.alt-caiaq-api +7 -0
@@ -5,6 +5,13 @@ endif
 include $(SND_TOPDIR)/toplevel.config
 include $(SND_TOPDIR)/Makefile.conf
 
+clean-files := caiaq-audio.c caiaq-device.c
+
 include $(SND_TOPDIR)/alsa-kernel/usb/caiaq/Makefile
 
+EXTRA_CFLAGS += -I$(SND_TOPDIR)/alsa-kernel/usb/caiaq
+
 include $(SND_TOPDIR)/Rules.make
+
+caiaq-audio.c: caiaq-audio.patch $(SND_TOPDIR)/alsa-kernel/usb/caiaq/caiaq-audio.c
+caiaq-device.c: caiaq-device.patch $(SND_TOPDIR)/alsa-kernel/usb/caiaq/caiaq-device.c
usb/caiaq/caiaq-audio.patch renamed from usb/caiaq/caiaq-audio.patch.alt-caiaq-api +26 -0
@@ -0,0 +1,26 @@
+--- ../../alsa-kernel/usb/caiaq/caiaq-audio.c	2007-06-11 16:29:28 +0400
++++ caiaq-audio.c	2007-06-11 19:17:38 +0400
+@@ -464,7 +464,11 @@ static void fill_out_urb(struct snd_usb_
+ 	check_for_elapsed_periods(dev, dev->sub_playback);
+ }
+ 
++#if !defined(OLD_USB) && !defined(CONFIG_SND_NEW_IRQ_HANDLER)
++static void read_completed(struct urb *urb, struct pt_regs *regs)
++#else
+ static void read_completed(struct urb *urb)
++#endif
+ {
+ 	struct snd_usb_caiaq_cb_info *info = urb->context; 
+ 	struct snd_usb_caiaqdev *dev;
+@@ -518,7 +522,11 @@ static void read_completed(struct urb *u
+ 	usb_submit_urb(urb, GFP_ATOMIC);
+ }
+ 
++#if !defined(OLD_USB) && !defined(CONFIG_SND_NEW_IRQ_HANDLER)
++static void write_completed(struct urb *urb, struct pt_regs *regs)
++#else
+ static void write_completed(struct urb *urb)
++#endif
+ {
+ 	struct snd_usb_caiaq_cb_info *info = urb->context;
+ 	struct snd_usb_caiaqdev *dev = info->dev;
usb/caiaq/caiaq-device.patch renamed from usb/caiaq/caiaq-device.patch.alt-caiaq-api +31 -0
@@ -0,0 +1,31 @@
+--- ../../alsa-kernel/usb/caiaq/caiaq-device.c	2007-06-11 16:29:28 +0400
++++ caiaq-device.c	2007-06-11 19:54:46 +0400
+@@ -100,7 +100,11 @@ static struct usb_device_id snd_usb_id_t
+ 	{ /* terminator */ }
+ };
+ 
++#if !defined(OLD_USB) && !defined(CONFIG_SND_NEW_IRQ_HANDLER)
++static void usb_ep1_command_reply_dispatch (struct urb* urb, struct pt_regs *regs)
++#else
+ static void usb_ep1_command_reply_dispatch (struct urb* urb)
++#endif
+ {
+ 	int ret;
+ 	struct snd_usb_caiaqdev *dev = urb->context;
+@@ -295,6 +299,16 @@ static struct snd_card* create_card(stru
+ 	return card;
+ }
+ 
++#if !defined(OLD_USB) && !defined(CONFIG_SND_NEW_IRQ_HANDLER)
++static void snd_usb_caiaq_midi_output_done_wrapper(struct urb* urb,
++						   struct pt_regs *regs)
++{
++	snd_usb_caiaq_midi_output_done(urb);
++}
++#undef snd_usb_caiaq_midi_output_done
++#define snd_usb_caiaq_midi_output_done snd_usb_caiaq_midi_output_done_wrapper
++#endif
++
+ static int init_card(struct snd_usb_caiaqdev *dev)
+ {
+ 	char *c;
Applied
#1 lore raw

At Mon, 11 Jun 2007 20:39:44 +0400,

Quoted 7 lines · Sergey Vlasov

Kernels before 2.6.19 used a different signature for the urb->complete callback (an additional "struct pt_regs *regs" parameter was present), therefore snd-usb-caiaq needs some compatibility patches in alsa-driver, like snd-usb-audio.

Applied to HG tree. Thanks.

I was too lazy to fix this since the function with less arguments should basically work as it is -- but not confirmed actually :)

Takashi