File hdjmod_kernel_4.15.patch of Package hdjmod.13737
From: Matthias Bach <marix@marix.org>
Date: 2018-02-10 15:00:00 +0100
Subject: Fix compile on kernel 4.15
Upstream: to be done
The module no longer compiled on 4.15
diff -Naru hdjmod-1.28o/device.c hdjmod-1.28/device.c
--- hdjmod-1.28o/device.c 2009-01-27 15:25:50.000000000 +0100
+++ hdjmod-1.28/device.c 2018-02-10 13:24:32.903039377 +0100
@@ -2373,7 +2373,11 @@
{
int rc=-ENODEV;
u16 devstatus;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
+ rc = usb_get_std_status(chip->dev, USB_RECIP_DEVICE, 0, &devstatus);
+#else
rc = usb_get_status(chip->dev, USB_RECIP_DEVICE, 0, &devstatus);
+#endif
if (rc >= 0) {
rc = (rc > 0 ? 0 : -ENODEV);
}
diff -Naru hdjmod-1.28o/midi.c hdjmod-1.28/midi.c
--- hdjmod-1.28o/midi.c 2009-01-27 15:25:50.000000000 +0100
+++ hdjmod-1.28/midi.c 2018-02-10 14:19:57.548542925 +0100
@@ -49,6 +49,9 @@
#ifdef CONFIG_COMPAT
#include <linux/compat.h>
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
+#include <linux/timer.h>
+#endif
#include "djdevioctls.h"
#include "device.h"
#include "bulk.h"
@@ -327,9 +330,16 @@
}
/* called after transfers had been interrupted due to some USB error */
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
+static void snd_hdjmidi_error_timer(struct timer_list *t)
+{
+ struct snd_hdjmidi *umidi = from_timer(umidi, t, error_timer);
+#else
static void snd_hdjmidi_error_timer(unsigned long data)
{
struct snd_hdjmidi *umidi = (struct snd_hdjmidi *)data;
+#endif
int i;
for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {
@@ -887,10 +897,14 @@
spin_lock_init(&ep->buffer_lock);
snd_hdjmidi_output_initialize_tasklet(ep);
#ifdef THROTTLE_MP3_RENDER
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
+ timer_setup(&ep->render_delay_timer, midi_render_throttle_timer, 0);
+#else
init_timer(&ep->render_delay_timer);
ep->render_delay_timer.data = (unsigned long)ep;
ep->render_delay_timer.function = midi_render_throttle_timer;
-#endif
+#endif /* LINUX_VERSION_CODE */
+#endif /* THROTTLE_MP3_RENDER */
for (i = 0; i < 0x10; ++i)
if (ep_info->out_ep) {
@@ -2479,10 +2493,14 @@
umidi->usb_protocol_ops = &snd_hdjmidi_standard_ops;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
+ timer_setup(&umidi->error_timer, snd_hdjmidi_error_timer, 0);
+#else
init_timer(&umidi->error_timer);
umidi->error_timer.function = snd_hdjmidi_error_timer;
umidi->error_timer.data = (unsigned long)umidi;
+#endif
/* detect the endpoint(s) to use */
memset(endpoints, 0, sizeof(endpoints));
diff -Naru hdjmod-1.28o/midirender.c hdjmod-1.28/midirender.c
--- hdjmod-1.28o/midirender.c 2009-01-27 15:25:50.000000000 +0100
+++ hdjmod-1.28/midirender.c 2018-02-10 14:18:03.578774143 +0100
@@ -33,6 +33,9 @@
#include <linux/usb.h>
#include <asm/atomic.h>
#include <linux/kthread.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
+#include <linux/timer.h>
+#endif
#if ( LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,24) )
#include <sound/driver.h>
#endif
@@ -597,12 +600,18 @@
}
#ifdef THROTTLE_MP3_RENDER
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
+void midi_render_throttle_timer(struct timer_list *t)
+{
+ struct snd_hdjmidi_out_endpoint* ep = from_timer(ep, t, render_delay_timer);
+#else
void midi_render_throttle_timer(unsigned long data)
{
struct snd_hdjmidi_out_endpoint* ep = (struct snd_hdjmidi_out_endpoint*)data;
+#endif /* LINUX_VERSION_CODE */
snd_hdjmidi_do_output(ep);
}
-#endif
+#endif /* THROTTLE_MP3_RENDER */
/*
* This is called when some data should be transferred to the device
diff -Naru hdjmod-1.28o/midirender.h hdjmod-1.28/midirender.h
--- hdjmod-1.28o/midirender.h 2009-01-27 15:25:50.000000000 +0100
+++ hdjmod-1.28/midirender.h 2018-02-10 13:53:02.900774283 +0100
@@ -88,8 +88,12 @@
u8 mp3w_check_led_state(struct snd_hdjmidi_out_endpoint* ep, u8 called_from_kthread);
#ifdef THROTTLE_MP3_RENDER
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
+void midi_render_throttle_timer(struct timer_list *t);
+#else
void midi_render_throttle_timer(unsigned long data);
-#endif
+#endif /* LINUX_VERSION_CODE */
+#endif /* THROTTLE_MP§_RENDER */
void snd_hdjmidi_do_output(struct snd_hdjmidi_out_endpoint* ep);
void snd_hdjmidi_out_tasklet(unsigned long data);
void snd_hdjmidi_output_kill_tasklet(struct snd_hdjmidi_out_endpoint* ep);