Hello community, here is the log from the commit of package hdjmod.13737 for openSUSE:Leap:15.2:Update checked in at 2020-08-21 00:19:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2:Update/hdjmod.13737 (Old) and /work/SRC/openSUSE:Leap:15.2:Update/.hdjmod.13737.new.3399 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "hdjmod.13737" Fri Aug 21 00:19:41 2020 rev:1 rq:828231 version:1.28 Changes: -------- New Changes file: --- /dev/null 2020-08-06 00:20:10.149648038 +0200 +++ /work/SRC/openSUSE:Leap:15.2:Update/.hdjmod.13737.new.3399/hdjmod.changes 2020-08-21 00:19:42.262263498 +0200 @@ -0,0 +1,106 @@ +------------------------------------------------------------------- +Mon Mar 18 10:41:55 UTC 2019 - Michal Suchanek <[email protected]> + +- Fix build with kernel 5.0: + * hdjmod_kernel_5.0.patch + +------------------------------------------------------------------- +Tue Jun 19 12:10:30 UTC 2018 - [email protected] + +- Use %{?linux_make_arch} when building kernel modules (boo#1098050). + +------------------------------------------------------------------- +Fri Feb 10 15:00:06 UTC 2018 - [email protected] + +- Added hdjmod_kernel_4.15.patch: Fixes build on Kernel 4.15 and + up. +- Removed accidentally added backup file from + hdjmod_fix_hotplug.patch + +------------------------------------------------------------------- +Sun Nov 26 19:44:30 UTC 2017 - [email protected] + +- Added hdjmod_kernel_4.14.patch: Fixes build on Kernel 4.14 and + up. + +------------------------------------------------------------------- +Sat Jul 1 18:41:37 UTC 2017 - [email protected] + +- Added hdjmod_fix_buffer_overrun_in_device_name_handling.patch: + Fixes a potential buffer overrun in device name handling. + +------------------------------------------------------------------- +Fri May 26 17:45:41 UTC 2017 - [email protected] + +- Added hdjmod_kernel_4.11.patch: Fixes build on Kernel 4.11 and + up. + +------------------------------------------------------------------- +Fri Jul 25 20:47:24 UTC 2014 - [email protected] + +- Fixed build on kernel 3.16 + The required patch is hdjmod_kernel_3.16.patch + +------------------------------------------------------------------- +Sun Dec 23 16:47:42 UTC 2012 - [email protected] + +- Fixed build on kernel 3.7 + +------------------------------------------------------------------- +Tue Oct 16 19:57:00 UTC 2012 - [email protected] + +- Fixed build on kernel 3.6 + +------------------------------------------------------------------- +Sat Apr 7 11:23:39 UTC 2012 - [email protected] + +- Fixed build on SLE 11 SP 2 + +------------------------------------------------------------------- +Tue Mar 13 21:33:50 UTC 2012 - [email protected] + +- Fixed USB hotplugging + Previously the module also loaded for devices of other vendors. + +------------------------------------------------------------------- +Wed Aug 3 09:01:04 UTC 2011 - [email protected] + +- license update: GPL-2.0+ + Specify the license more accurately using the appropriate syntax + +------------------------------------------------------------------- +Mon May 30 20:06:14 UTC 2011 - [email protected] + +- Fixed build on kernels newer than openSUSE 11.4 + +------------------------------------------------------------------- +Sat Apr 30 19:14:52 UTC 2011 - [email protected] + +- Fixed build on SLE 11 SP 1 + +------------------------------------------------------------------- +Sat Apr 30 17:51:05 UTC 2011 - [email protected] + +- Cleaned up spec file +- Fixed missing dependency to the kernel + +------------------------------------------------------------------- +Thu Dec 2 12:50:09 UTC 2010 - [email protected] + +- Patched to fix build with kernel 2.6.37 + +------------------------------------------------------------------- +Sun Sep 26 17:46:22 UTC 2010 - [email protected] + +- Patched to fix build with kernels newer than openSUSE 11.3 + +------------------------------------------------------------------- +Sun Jul 25 20:14:03 UTC 2010 - [email protected] + +- Build for older openSUSE versions + +------------------------------------------------------------------- +Sun Jul 25 17:17:32 UTC 2010 - [email protected] + +- Initial version + New: ---- hdjmod-1.28.tar.bz2 hdjmod-kfree.patch hdjmod.changes hdjmod.spec hdjmod_fix_buffer_overrun_in_device_name_handling.patch hdjmod_fix_hotplug.patch hdjmod_kernel_2.6.30.patch hdjmod_kernel_2.6.36.patch.bz2 hdjmod_kernel_2.6.37.patch hdjmod_kernel_2.6.39.patch hdjmod_kernel_3.16.patch hdjmod_kernel_3.6.patch hdjmod_kernel_3.7.patch hdjmod_kernel_4.11.patch hdjmod_kernel_4.14.patch hdjmod_kernel_4.15.patch hdjmod_kernel_5.0.patch preamble ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hdjmod.spec ++++++ # # spec file for package hdjmod # # Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2008-2017 Matthias Bach <[email protected]> # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: hdjmod Version: 1.28 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} < 1120 BuildRequires: %kernel_module_package_buildreq BuildRequires: module-init-tools %else BuildRequires: %kernel_module_package_buildreqs %endif BuildRequires: libelf-devel Summary: Support for Hercules DJ Devices License: GPL-2.0-or-later Group: System/Kernel Url: http://ts.hercules.com/ger/index.php?pg=view_files&gid=17&fid=62&pid=177&cid=1 Source0: hdjmod-%{version}.tar.bz2 Source1: preamble # PATCH-FIX-UPSTREAM hdjmod_kernel_2.6.30.patch [email protected] -- Fix build on kernel 2.6.30 and newer Patch0: hdjmod_kernel_2.6.30.patch # PATCH-FIX-UPSTREAM hdjmod_kernel_2.6.36.patch [email protected] -- Fix includes for kfree Patch1: hdjmod-kfree.patch # PATCH-FIX-UPSTREAM hdjmod_kernel_2.6.36.patch [email protected] -- Fix build on kernel 2.6.36 and newer Patch2: hdjmod_kernel_2.6.36.patch.bz2 # PATCH-FIX-UPSTREAM hdjmod_kernel_2.6.37.patch [email protected] -- Fix build on kernel 2.6.37 and newer Patch3: hdjmod_kernel_2.6.37.patch # PATCH-FIX-UPSTREAM hdjmod_kernel_2.6.39.patch [email protected] -- Fix build on kernel 2.6.39 and newer Patch4: hdjmod_kernel_2.6.39.patch # PATCH-FIX-UPSTREAM hdjmod_fix_hotplug.patch [bnc#746358] [email protected] -- Don't load on hotplug of devices from other vendors Patch5: hdjmod_fix_hotplug.patch # PATCH-FIX-UPSTREAM hdjmod_kernel_3.6.patch [bnc#783848] [email protected] -- Fix build on kernel 3.6 and newer Patch6: hdjmod_kernel_3.6.patch # PATCH-FIX-UPSTREAM hdjmod_kernel_3.7.patch [email protected] -- Fix build on kernel 3.7 and newer Patch7: hdjmod_kernel_3.7.patch # PATCH-FIX-UPSTREAM hdjmod_kernel_3.16.patch [email protected] -- Fix build on kernel 3.16 and newer Patch8: hdjmod_kernel_3.16.patch # PATCH-FIX-UPSTREAM hdjmod_kernel_4.11.patch [email protected] -- Fix build on kernel 4.11 and newer Patch9: hdjmod_kernel_4.11.patch # PATCH-FIX-UPSTREAM hdjmod_fix_buffer_overrun_in_device_name_handling.patch [email protected] -- Fix build on kernel 4.11 and newer Patch10: hdjmod_fix_buffer_overrun_in_device_name_handling.patch # PATCH-FIX-UPSTREAM hdjmod_kernel_4.14.patch [email protected] -- Fix build on kernel 4.14 and newer Patch11: hdjmod_kernel_4.14.patch # PATCH-FIX-UPSTREAM hdjmod_kernel_4.15.patch [email protected] -- Fix build on kernel 4.15 and newer Patch12: hdjmod_kernel_4.15.patch # Fix build with kernel 5.0 Patch13: hdjmod_kernel_5.0.patch %suse_kernel_module_package -p%_sourcedir/preamble %description This is the Hercules DJ Series Kernel Module, which supports Hercules DJ Devices. %prep echo %flavors_to_build %setup -q %if 0%{?suse_version} >= 1120 || 0%{?sles_version} > 10 %patch0 -p1 %endif %if 0%{?suse_version} >= 1140 || 0%{?sles_version} > 10 %patch2 -p1 %patch3 -F3 -p1 %patch4 -p1 %endif %patch1 -p1 %patch5 -p1 %patch6 -p1 %patch7 -p1 %patch8 -p1 %patch9 -p1 %patch10 -p1 %patch11 -p1 %patch12 -p1 %patch13 -p2 set -- * mkdir source mv "$@" source/ mkdir obj %build for flavor in %flavors_to_build; do rm -rf obj/$flavor cp -r source obj/$flavor make -C %{kernel_source $flavor} %{?linux_make_arch} modules M=$PWD/obj/$flavor done %install export INSTALL_MOD_PATH=%{buildroot} export INSTALL_MOD_DIR=updates for flavor in %flavors_to_build; do make -C %{kernel_source $flavor} %{?linux_make_arch} modules_install M=$PWD/obj/$flavor done %changelog ++++++ hdjmod-kfree.patch ++++++ diff -Naru hdjmod-1.28o//configuration_manager.c hdjmod-1.28/configuration_manager.c --- hdjmod-1.28o//configuration_manager.c 2010-07-25 18:57:11.000000000 +0200 +++ hdjmod-1.28/configuration_manager.c 2010-07-25 19:00:15.000000000 +0200 @@ -23,6 +23,7 @@ #include <linux/kernel.h> #include <linux/errno.h> +#include <linux/slab.h> #include <linux/usb.h> #include <linux/version.h> /* For LINUX_VERSION_CODE */ #include <asm/atomic.h> diff -Naru hdjmod-1.28o//midi.c hdjmod-1.28/midi.c --- hdjmod-1.28o//midi.c 2010-07-25 18:57:11.000000000 +0200 +++ hdjmod-1.28/midi.c 2010-07-25 19:02:13.000000000 +0200 @@ -25,6 +25,7 @@ #include <linux/kernel.h> #include <linux/version.h> /* For LINUX_VERSION_CODE */ #include <linux/errno.h> +#include <linux/slab.h> #include <linux/types.h> #include <linux/bitops.h> #include <linux/interrupt.h> ++++++ hdjmod_fix_buffer_overrun_in_device_name_handling.patch ++++++ From: Matthias Bach <[email protected]> Date: 20117-07-01 20:40:00 +0200 Subject: Fix a buffer overrun Upstream: to be done The code messed up handling of the offset when calculating the maximum number of bytes it can copy into a buffer at a certain offset. 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 2017-07-01 20:39:07.129497940 +0200 @@ -1769,7 +1769,7 @@ memset(shortname,0,sizeof(shortname)); snprintf(shortname,sizeof(shortname)-1,"Hercules "); strncpy(shortname+strlen(shortname), - card->shortname,sizeof(shortname)+strlen(shortname)-1); + card->shortname,sizeof(shortname)-strlen(shortname)-1); memset(card->shortname,0,sizeof(card->shortname)); strncpy(card->shortname,shortname,sizeof(card->shortname)-1); } ++++++ hdjmod_fix_hotplug.patch ++++++ 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 2012-03-13 22:21:56.000000000 +0100 @@ -79,10 +79,9 @@ /* table of devices that work with this driver- look for vendor specific interfaces with * our VID */ static struct usb_device_id hdj_table [] = { - { .match_flags = (USB_DEVICE_ID_MATCH_DEVICE), - .idVendor = (USB_HDJ_VENDOR_ID) }, - { .match_flags = (USB_DEVICE_ID_MATCH_INT_CLASS), - .bInterfaceClass = USB_CLASS_VENDOR_SPEC}, + { .match_flags = (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_CLASS), + .idVendor = (USB_HDJ_VENDOR_ID), + .bInterfaceClass = USB_CLASS_VENDOR_SPEC }, { } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, hdj_table); ++++++ hdjmod_kernel_2.6.30.patch ++++++ 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 2010-02-06 16:20:36.901740173 +0100 @@ -1660,11 +1660,19 @@ /* let the kernel option override custom id */ strncpy(card_id,id[idx],sizeof(card_id)-1); } +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) ) + err = snd_card_create(index[idx], card_id/*id[idx]*/, THIS_MODULE, 0, &card ); + if (err) { + snd_printk(KERN_WARNING "snd_hdj_chip_create(): cannot create card instance %d\n", idx); + return err; + } +#else 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; } +#endif /* save the index, so people who have the card can reference the chip */ card->private_data = (void*)(unsigned long)idx; ++++++ hdjmod_kernel_2.6.36.patch.bz2 ++++++ diff -Naru hdjmod-1.28.old/bulk.c hdjmod-1.28/bulk.c --- hdjmod-1.28.old/bulk.c 2009-01-27 15:25:50.000000000 +0100 +++ hdjmod-1.28/bulk.c 2010-09-26 19:27:53.000000000 +0200 @@ -462,7 +462,7 @@ chip->ctrl_urb->setup_dma = chip->ctl_req_dma; /* NOTE: transfer_dma setup above in call to usb_buffer_alloc() */ - chip->ctrl_urb->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP; + chip->ctrl_urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; ret = hdjbulk_submit_urb(chip, chip->ctrl_urb, GFP_KERNEL); if (ret!=0) { @@ -553,7 +553,7 @@ output_control_callback, &ubulk->output_control_completion); ubulk->output_control_urb->setup_dma = ubulk->output_control_dma; - ubulk->output_control_urb->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP; + ubulk->output_control_urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; if ((rc = hdjbulk_submit_urb(ubulk->chip,ubulk->output_control_urb, GFP_KERNEL))!=0) { printk(KERN_WARNING"%s hdjbulk_submit_urb() failed, rc:%d\n",__FUNCTION__,rc); } else { @@ -2675,7 +2675,12 @@ { if (ubulk->chip->product_code!=DJCONTROLSTEEL_PRODUCT_CODE) { if (ubulk->output_control_ctl_req!=NULL && ubulk->control_interface!=NULL) { - usb_buffer_free(interface_to_usbdev(ubulk->control_interface), +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_free_coherent( +#else + usb_buffer_free( +#endif + interface_to_usbdev(ubulk->control_interface), sizeof(*(ubulk->output_control_ctl_req)), ubulk->output_control_ctl_req, ubulk->output_control_dma); @@ -2684,7 +2689,12 @@ if (ubulk->output_control_buffer!=NULL && ubulk->control_interface!=NULL && ubulk->output_control_urb!=NULL) { - usb_buffer_free(interface_to_usbdev(ubulk->control_interface), +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_free_coherent( +#else + usb_buffer_free( +#endif + interface_to_usbdev(ubulk->control_interface), ubulk->output_control_urb->transfer_buffer_length, ubulk->output_control_buffer, ubulk->output_control_urb->transfer_dma); @@ -2712,7 +2722,12 @@ usb_kill_urb(ubulk->bulk_out_urb); if (free_urbs!=0) { if (ubulk->bulk_out_buffer!=NULL) { - usb_buffer_free(ubulk->chip->dev, ubulk->bulk_out_size, +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_free_coherent( +#else + usb_buffer_free( +#endif + ubulk->chip->dev, ubulk->bulk_out_size, ubulk->bulk_out_urb->transfer_buffer, ubulk->bulk_out_urb->transfer_dma); ubulk->bulk_out_buffer = NULL; @@ -3065,7 +3080,12 @@ init_MUTEX(&ubulk->bulk_out_buffer_mutex); ubulk->bulk_out_buffer = - usb_buffer_alloc(ubulk->chip->dev, ubulk->bulk_out_size, +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_alloc_coherent( +#else + usb_buffer_alloc( +#endif + ubulk->chip->dev, ubulk->bulk_out_size, GFP_KERNEL, &ubulk->bulk_out_urb->transfer_dma); if (ubulk->bulk_out_buffer==NULL) { @@ -3609,7 +3629,13 @@ * control state */ if (ubulk->chip->product_code != DJCONTROLSTEEL_PRODUCT_CODE) { /* allocate memory for setup packet for our control requests */ - ubulk->output_control_ctl_req = usb_buffer_alloc(interface_to_usbdev(ubulk->control_interface), + ubulk->output_control_ctl_req = +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_alloc_coherent( +#else + usb_buffer_alloc( +#endif + interface_to_usbdev(ubulk->control_interface), sizeof(*(ubulk->output_control_ctl_req)), GFP_KERNEL, &ubulk->output_control_dma); @@ -3628,7 +3654,13 @@ goto hdjbulk_init_output_control_state_error; } - ubulk->output_control_buffer = usb_buffer_alloc(interface_to_usbdev(ubulk->control_interface), + ubulk->output_control_buffer = +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_alloc_coherent( +#else + usb_buffer_alloc( +#endif + interface_to_usbdev(ubulk->control_interface), ubulk->output_control_buffer_size, GFP_KERNEL, &ubulk->output_control_urb->transfer_dma); @@ -3773,7 +3805,13 @@ } ep[i]->max_transfer = ubulk->continuous_reader_packet_size; - buffer = usb_buffer_alloc(ubulk->chip->dev, ep[i]->max_transfer, + buffer = +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_alloc_coherent( +#else + usb_buffer_alloc( +#endif + ubulk->chip->dev, ep[i]->max_transfer, GFP_KERNEL, &ep[i]->urb->transfer_dma); if (!buffer) { printk(KERN_WARNING"%s() usb_buffer_alloc() failed\n",__FUNCTION__); @@ -4250,7 +4288,12 @@ { if (ep->urb) { if (ep->urb->transfer_buffer) { - usb_buffer_free(ep->ubulk->chip->dev, ep->max_transfer, +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_free_coherent( +#else + usb_buffer_free( +#endif + ep->ubulk->chip->dev, ep->max_transfer, ep->urb->transfer_buffer, ep->urb->transfer_dma); } diff -Naru hdjmod-1.28.old/device.c hdjmod-1.28/device.c --- hdjmod-1.28.old/device.c 2009-01-27 15:25:50.000000000 +0100 +++ hdjmod-1.28/device.c 2010-09-26 19:14:55.000000000 +0200 @@ -1559,7 +1559,12 @@ if(chip->ctrl_req_buffer != NULL) { - usb_buffer_free(chip->dev, +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_free_coherent( +#else + usb_buffer_free( +#endif + chip->dev, chip->ctrl_urb->transfer_buffer_length, chip->ctrl_req_buffer, chip->ctrl_urb->transfer_dma); @@ -1575,7 +1580,12 @@ if(chip->ctl_req != NULL) { - usb_buffer_free(chip->dev, +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_free_coherent( +#else + usb_buffer_free( +#endif + chip->dev, sizeof(*(chip->ctl_req)), chip->ctl_req, chip->ctl_req_dma); @@ -1728,7 +1738,13 @@ } /* allocate memory for setup packet for our control requests */ - chip->ctl_req = usb_buffer_alloc(chip->dev, + chip->ctl_req = +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_alloc_coherent( +#else + usb_buffer_alloc( +#endif + chip->dev, sizeof(*(chip->ctl_req)), GFP_KERNEL, &chip->ctl_req_dma); @@ -1743,7 +1759,13 @@ chip->ctrl_req_buffer_len = sizeof(u16); chip->ctrl_urb->transfer_buffer_length = chip->ctrl_req_buffer_len; - chip->ctrl_req_buffer = usb_buffer_alloc(chip->dev, + chip->ctrl_req_buffer = +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_alloc_coherent( +#else + usb_buffer_alloc( +#endif + chip->dev, chip->ctrl_urb->transfer_buffer_length, GFP_KERNEL, &chip->ctrl_urb->transfer_dma); diff -Naru hdjmod-1.28.old/midi.c hdjmod-1.28/midi.c --- hdjmod-1.28.old/midi.c 2009-01-27 15:25:50.000000000 +0100 +++ hdjmod-1.28/midi.c 2010-09-26 19:38:35.000000000 +0200 @@ -367,7 +367,12 @@ { if (ep->urb) { if (ep->urb->transfer_buffer) { - usb_buffer_free(ep->umidi->chip->dev, +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_free_coherent( +#else + usb_buffer_free( +#endif + ep->umidi->chip->dev, ep->urb->transfer_buffer_length, ep->urb->transfer_buffer, ep->urb->transfer_dma); @@ -503,7 +508,13 @@ pipe = usb_rcvbulkpipe(umidi->chip->dev, ep_info->in_ep); } length = usb_maxpacket(umidi->chip->dev, pipe, 0); - buffer = usb_buffer_alloc(umidi->chip->dev, length, GFP_KERNEL, + buffer = +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_alloc_coherent( +#else + usb_buffer_alloc( +#endif + umidi->chip->dev, length, GFP_KERNEL, &ep->urb->transfer_dma); if (!buffer) { snd_printk(KERN_WARNING"%s() usb_buffer_alloc failed\n",__FUNCTION__); @@ -536,7 +547,12 @@ #endif if (ep->urb) { if (ep->urb->transfer_buffer) { - usb_buffer_free(ep->umidi->chip->dev, ep->max_transfer, +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_free_coherent( +#else + usb_buffer_free( +#endif + ep->umidi->chip->dev, ep->max_transfer, ep->urb->transfer_buffer, ep->urb->transfer_dma); } @@ -544,27 +560,47 @@ } if (ep->urb_led) { if (ep->urb_led->transfer_buffer) { - usb_buffer_free(ep->umidi->chip->dev, ep->max_transfer, +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_free_coherent( +#else + usb_buffer_free( +#endif + ep->umidi->chip->dev, ep->max_transfer, ep->urb_led->transfer_buffer, ep->urb_led->transfer_dma); } usb_free_urb(ep->urb_led); } if (ep->ctrl_req_led) { - usb_buffer_free(ep->umidi->chip->dev, sizeof(*(ep->ctrl_req_led)), +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_free_coherent( +#else + usb_buffer_free( +#endif + ep->umidi->chip->dev, sizeof(*(ep->ctrl_req_led)), ep->ctrl_req_led, ep->ctrl_req_led_dma); } if (ep->controller_state) { if (ep->controller_state->output_control_ctl_urb && ep->controller_state->output_control_ctl_urb->transfer_buffer && ep->controller_state->output_control_ctl_urb->transfer_dma) { - usb_buffer_free(ep->umidi->chip->dev, ep->max_transfer, +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_free_coherent( +#else + usb_buffer_free( +#endif + ep->umidi->chip->dev, ep->max_transfer, ep->controller_state->output_control_ctl_urb->transfer_buffer, ep->controller_state->output_control_ctl_urb->transfer_dma); } if (ep->controller_state->output_control_ctl_req && ep->controller_state->output_control_ctl_dma) { - usb_buffer_free(ep->umidi->chip->dev, +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_free_coherent( +#else + usb_buffer_free( +#endif + ep->umidi->chip->dev, sizeof(*(ep->controller_state->output_control_ctl_req)), ep->controller_state->output_control_ctl_req, ep->controller_state->output_control_ctl_dma); @@ -573,7 +609,12 @@ usb_free_urb(ep->controller_state->output_control_ctl_urb); } if (ep->controller_state->ctl_req) { - usb_buffer_free(ep->umidi->chip->dev, +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_free_coherent( +#else + usb_buffer_free( +#endif + ep->umidi->chip->dev, sizeof(*(ep->controller_state->ctl_req)), ep->controller_state->ctl_req, ep->controller_state->ctl_req_dma); @@ -584,14 +625,24 @@ } if (ep->controller_state->urb_kt) { if (ep->controller_state->urb_kt->transfer_buffer) { - usb_buffer_free(ep->umidi->chip->dev, ep->max_transfer, +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_free_coherent( +#else + usb_buffer_free( +#endif + ep->umidi->chip->dev, ep->max_transfer, ep->controller_state->urb_kt->transfer_buffer, ep->controller_state->urb_kt->transfer_dma); } usb_free_urb(ep->controller_state->urb_kt); } if (ep->controller_state->ctl_req_kt) { - usb_buffer_free(ep->umidi->chip->dev, +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_free_coherent( +#else + usb_buffer_free( +#endif + ep->umidi->chip->dev, sizeof(*(ep->controller_state->ctl_req_kt)), ep->controller_state->ctl_req_kt, ep->controller_state->ctl_req_dma_kt); @@ -666,7 +717,13 @@ controller_state->is_weltrend = is_mp3_weltrend(ep->umidi->chip->usb_id); } - controller_state->ctl_req = usb_buffer_alloc(ep->umidi->chip->dev, + controller_state->ctl_req = +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_alloc_coherent( +#else + usb_buffer_alloc( +#endif + ep->umidi->chip->dev, sizeof(*(controller_state->ctl_req)), GFP_KERNEL, &controller_state->ctl_req_dma); @@ -679,7 +736,13 @@ * mouse setting or setting LEDs */ init_MUTEX(&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, + controller_state->output_control_ctl_req = +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_alloc_coherent( +#else + usb_buffer_alloc( +#endif + ep->umidi->chip->dev, sizeof(*(controller_state->output_control_ctl_req)), GFP_KERNEL, &controller_state->output_control_ctl_dma); @@ -700,7 +763,13 @@ max_transfer = usb_maxpacket(ep->umidi->chip->dev, controller_state->output_control_ctl_pipe, 1); - buffer = usb_buffer_alloc(ep->umidi->chip->dev, max_transfer, + buffer = +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_alloc_coherent( +#else + usb_buffer_alloc( +#endif + ep->umidi->chip->dev, max_transfer, GFP_KERNEL, &controller_state->output_control_ctl_urb->transfer_dma); if (buffer==NULL) { snd_printk(KERN_WARNING"%s() usb_buffer_alloc failed (general URB buffer)\n", @@ -727,7 +796,7 @@ controller_state->output_control_ctl_req->wLength = cpu_to_le16(DJ_MP3_HID_OUTPUT_REPORT_LEN); controller_state->output_control_ctl_urb->setup_dma = controller_state->output_control_ctl_dma; /* NOTE: transfer_dma setup above in call to usb_buffer_alloc() */ - controller_state->output_control_ctl_urb->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP; + controller_state->output_control_ctl_urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; return 0; } @@ -772,7 +841,13 @@ } if (ep->umidi->chip->caps.leds_hid_controlled) { - ep->ctrl_req_led = usb_buffer_alloc(ep->umidi->chip->dev, + ep->ctrl_req_led = +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_alloc_coherent( +#else + usb_buffer_alloc( +#endif + ep->umidi->chip->dev, sizeof(*(ep->ctrl_req_led)), GFP_KERNEL, &ep->ctrl_req_led_dma); @@ -806,7 +881,13 @@ pipe = usb_sndctrlpipe(umidi->chip->dev, 0); } ep->max_transfer = usb_maxpacket(umidi->chip->dev, pipe, 1); - buffer = usb_buffer_alloc(umidi->chip->dev, ep->max_transfer, + buffer = +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_alloc_coherent( +#else + usb_buffer_alloc( +#endif + umidi->chip->dev, ep->max_transfer, GFP_KERNEL, &ep->urb->transfer_dma); if (!buffer) { snd_printk(KERN_WARNING"%s() usb_buffer_alloc() failed\n",__FUNCTION__); @@ -814,7 +895,13 @@ return -ENOMEM; } - buffer_led = usb_buffer_alloc(umidi->chip->dev, ep->max_transfer, + buffer_led = +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_alloc_coherent( +#else + usb_buffer_alloc( +#endif + umidi->chip->dev, ep->max_transfer, GFP_KERNEL, &ep->urb_led->transfer_dma); if (!buffer_led) { snd_printk(KERN_WARNING"%s() usb_buffer_alloc() failed for LED buffer\n", @@ -854,7 +941,7 @@ ep->controller_state->ctl_req->wLength = cpu_to_le16(DJ_MP3_HID_OUTPUT_REPORT_LEN); ep->urb->setup_dma = ep->controller_state->ctl_req_dma; /* NOTE: transfer_dma setup above in call to usb_buffer_alloc() */ - ep->urb->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP; + ep->urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; } if (ep->umidi->chip->caps.leds_hid_controlled) { @@ -875,7 +962,7 @@ ep->ctrl_req_led->wLength = cpu_to_le16(DJ_MP3_HID_OUTPUT_REPORT_LEN); ep->urb_led->setup_dma = ep->ctrl_req_led_dma; /* NOTE: transfer_dma setup above in call to usb_buffer_alloc() */ - ep->urb_led->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP; + ep->urb_led->transfer_flags = URB_NO_TRANSFER_DMA_MAP; } if (ep->umidi->chip->caps.leds_bulk_controlled) { @@ -913,7 +1000,13 @@ return -ENOMEM; } - buffer = usb_buffer_alloc(umidi->chip->dev, ep->max_transfer, + buffer = +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_alloc_coherent( +#else + usb_buffer_alloc( +#endif + umidi->chip->dev, ep->max_transfer, GFP_KERNEL, &ep->controller_state->urb_kt->transfer_dma); if (!buffer) { snd_printk(KERN_WARNING"%s() usb_buffer_alloc() for wq failed\n",__FUNCTION__); @@ -921,7 +1014,13 @@ return -ENOMEM; } - ep->controller_state->ctl_req_kt = usb_buffer_alloc(umidi->chip->dev, + ep->controller_state->ctl_req_kt = +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) ) + usb_alloc_coherent( +#else + usb_buffer_alloc( +#endif + umidi->chip->dev, sizeof(*(ep->controller_state->ctl_req_kt)), GFP_KERNEL, &ep->controller_state->ctl_req_dma_kt); @@ -947,7 +1046,7 @@ ep->controller_state->ctl_req_kt->wLength = cpu_to_le16(DJ_MP3_HID_OUTPUT_REPORT_LEN); ep->controller_state->urb_kt->setup_dma = ep->controller_state->ctl_req_dma_kt; /* NOTE: transfer_dma setup above in call to usb_buffer_alloc() */ - ep->controller_state->urb_kt->transfer_flags = URB_NO_SETUP_DMA_MAP | URB_NO_TRANSFER_DMA_MAP; + ep->controller_state->urb_kt->transfer_flags = URB_NO_TRANSFER_DMA_MAP; init_completion(&ep->controller_state->ctl_req_completion_kt); init_completion(&ep->controller_state->mp3w_kthread_started); ++++++ hdjmod_kernel_2.6.37.patch ++++++ diff -Naru hdjmod-1.28o/bulk.c hdjmod-1.28/bulk.c --- hdjmod-1.28o/bulk.c 2009-01-27 15:25:50.000000000 +0100 +++ hdjmod-1.28/bulk.c 2012-04-06 22:53:14.000000000 +0200 @@ -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,24) ) #include <sound/driver.h> #endif @@ -3062,7 +3065,11 @@ 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 = usb_buffer_alloc(ubulk->chip->dev, ubulk->bulk_out_size, @@ -3601,7 +3608,11 @@ 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 @@ -3855,7 +3866,11 @@ 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) { @@ -4133,7 +4148,11 @@ 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", 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 2012-04-06 22:54:53.000000000 +0200 @@ -36,6 +36,9 @@ #include <linux/netlink.h> #include <net/sock.h> #include <linux/usb.h> +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) ) +#include <linux/semaphore.h> +#endif #if ( LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,24) ) #include <sound/driver.h> #endif @@ -66,7 +69,11 @@ 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 */ @@ -1682,7 +1689,11 @@ 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); @@ -1697,7 +1708,11 @@ 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 */ 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 2012-04-06 22:55:48.000000000 +0200 @@ -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 #include <asm/byteorder.h> #include <asm/atomic.h> #if ( LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,24) ) @@ -677,7 +680,11 @@ /* 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); controller_state->output_control_ctl_req = usb_buffer_alloc(ep->umidi->chip->dev, sizeof(*(controller_state->output_control_ctl_req)), ++++++ hdjmod_kernel_2.6.39.patch ++++++ 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 2011-05-30 21:47:18.000000000 +0200 @@ -60,7 +60,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, ++++++ hdjmod_kernel_3.16.patch ++++++ From: Matthias Bach <[email protected]> Date: 2014-07-26 23:30:00 +0200 Subject: Fix compile on kernel 3.16 Upstream: to be done The module no longer compiled on 3.16 due to API changes in ALSA. diff -Naru hdjmod-1.28o/device.c hdjmod-1.28/device.c --- hdjmod-1.28o/device.c 2014-07-25 22:38:52.985186212 +0200 +++ hdjmod-1.28/device.c 2014-07-25 22:44:05.297761993 +0200 @@ -1660,7 +1660,13 @@ /* let the kernel option override custom id */ strncpy(card_id,id[idx],sizeof(card_id)-1); } -#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) ) +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0) ) + err = snd_card_new(&dev->dev, index[idx], card_id/*id[idx]*/, THIS_MODULE, 0, &card ); + if (err) { + snd_printk(KERN_WARNING "snd_hdj_chip_create(): cannot create card instance %d\n", idx); + return err; + } +#elif ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) ) err = snd_card_create(index[idx], card_id/*id[idx]*/, THIS_MODULE, 0, &card ); if (err) { snd_printk(KERN_WARNING "snd_hdj_chip_create(): cannot create card instance %d\n", idx); ++++++ hdjmod_kernel_3.6.patch ++++++ 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 2012-10-16 21:52:40.000000000 +0200 @@ -2393,6 +2393,13 @@ /* Try to allocate a netlink socket minimizing the risk of collision, * by starting at the max unit number and counting down */ for (unit=MAX_LINKS-1;unit>MIN_NETLINK_UNIT;unit--) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) + nl_sk = netlink_kernel_create( + &init_net, + unit, + THIS_MODULE, + NULL); +#else nl_sk = netlink_kernel_create( #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) &init_net, @@ -2404,6 +2411,7 @@ NULL, #endif THIS_MODULE); +#endif if (nl_sk!=NULL) { netlink_unit = unit; return 0; @@ -2469,6 +2477,20 @@ return NULL; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) + nlh = nlmsg_put(skb, target_pid, seq, t, size, flags); + if(!nlh) { + if (skb) { + kfree_skb(skb); + } + return NULL; + } + data = nlmsg_data(nlh); + if (size > 0) { + memcpy(data, payload, size); + } + return skb; +#else nlh = NLMSG_PUT(skb, target_pid, seq, t, size); nlh->nlmsg_flags = flags; data = NLMSG_DATA(nlh); @@ -2482,6 +2504,7 @@ kfree_skb(skb); } return NULL; +#endif } int register_for_netlink(struct snd_hdj_chip* chip, ++++++ hdjmod_kernel_3.7.patch ++++++ diff -aru hdjmod-1.28o/device.c hdjmod-1.28/device.c --- hdjmod-1.28o/device.c 2012-12-23 17:41:13.111607777 +0100 +++ hdjmod-1.28/device.c 2012-12-23 17:42:33.115898437 +0100 @@ -2397,7 +2397,9 @@ nl_sk = netlink_kernel_create( &init_net, unit, +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) THIS_MODULE, +#endif NULL); #else nl_sk = netlink_kernel_create( Nur in hdjmod-1.28: .device.c.swp. ++++++ hdjmod_kernel_4.11.patch ++++++ From: Matthias Bach <[email protected]> Date: 20117-05-26 20:20:00 +0200 Subject: Fix compile on kernel 4.11 Upstream: to be done The module no longer compiled on 4.11 diff -Naru hdjmod-1.28o/bulk.c hdjmod-1.28/bulk.c --- hdjmod-1.28o/bulk.c 2009-01-27 15:25:50.000000000 +0100 +++ hdjmod-1.28/bulk.c 2017-05-26 20:00:46.941268724 +0200 @@ -37,6 +37,9 @@ #if ( LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,24) ) #include <sound/driver.h> #endif +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0) ) +#include <linux/sched/signal.h> +#endif #include <sound/core.h> #include <sound/info.h> #include <sound/initval.h> diff -Naru hdjmod-1.28o/configuration_manager.c hdjmod-1.28/configuration_manager.c --- hdjmod-1.28o/configuration_manager.c 2009-01-27 15:25:50.000000000 +0100 +++ hdjmod-1.28/configuration_manager.c 2017-05-26 20:02:11.079953245 +0200 @@ -29,6 +29,9 @@ #if ( LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,24) ) #include <sound/driver.h> #endif +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0) ) +#include <linux/sched/signal.h> +#endif #include <sound/core.h> #include <sound/info.h> #include <sound/initval.h> ++++++ hdjmod_kernel_4.14.patch ++++++ From: Matthias Bach <[email protected]> Date: 2017-11-26 20:45:00 +0100 Subject: Fix compile on kernel 4.14 Upstream: to be done The module no longer compiled on 4.14 diff -Naru hdjmod-1.28o/bulk.c hdjmod-1.28/bulk.c --- hdjmod-1.28o/bulk.c 2009-01-27 15:25:50.000000000 +0100 +++ hdjmod-1.28/bulk.c 2017-11-26 20:41:31.941557776 +0100 @@ -23,6 +23,7 @@ #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> +#include <linux/sched.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/kref.h> 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 2017-11-26 20:38:50.262807031 +0100 @@ -29,6 +29,7 @@ #include <linux/version.h> /* For LINUX_VERSION_CODE */ #include <linux/errno.h> #include <linux/init.h> +#include <linux/sched.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/kref.h> diff -Naru hdjmod-1.28o/midicapture.c hdjmod-1.28/midicapture.c --- hdjmod-1.28o/midicapture.c 2009-01-27 15:25:50.000000000 +0100 +++ hdjmod-1.28/midicapture.c 2017-11-26 20:42:47.007150108 +0100 @@ -27,6 +27,7 @@ #include <linux/version.h> /* For LINUX_VERSION_CODE */ #include <linux/errno.h> #include <linux/init.h> +#include <linux/sched.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/kref.h> 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 2017-11-26 20:43:18.906131711 +0100 @@ -26,6 +26,7 @@ #include <linux/version.h> /* For LINUX_VERSION_CODE */ #include <linux/errno.h> #include <linux/init.h> +#include <linux/sched.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/kref.h> ++++++ hdjmod_kernel_4.15.patch ++++++ From: Matthias Bach <[email protected]> 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); ++++++ hdjmod_kernel_5.0.patch ++++++ diff -ur hdjmod-1.28.orig/source/bulk.c hdjmod-1.28/source/bulk.c --- hdjmod-1.28.orig/source/bulk.c 2019-03-18 11:22:52.220314382 +0100 +++ hdjmod-1.28/source/bulk.c 2019-03-18 11:40:25.665723290 +0100 @@ -622,7 +622,7 @@ case DJ_IOCTL_GET_VERSION: ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_GET_VERSION\n", __FUNCTION__); - access = access_ok(VERIFY_WRITE,ioctl_param, sizeof(u32)); + access = write_ok(ioctl_param, sizeof(u32)); if (access!=0) { value32p_user = (u32 __user *)ioctl_param; result = __put_user(driver_version,value32p_user); @@ -645,7 +645,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { result = get_jogwheel_lock_status(ubulk, &value, 1, 0); if (result==0) { @@ -671,7 +671,7 @@ ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_SET_JOG_WHEEL_LOCK_SETTING\n",__FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_READ,ioctl_param,sizeof(u16)); + access = read_ok(ioctl_param,sizeof(u16)); if (access) { /*copy the usermode buffer to kernel mode*/ value16p_user = (u16 __user *)ioctl_param; @@ -696,7 +696,7 @@ ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_GET_JOG_WHEEL_SENSITIVITY\n",__FUNCTION__); /*verify that the address isn't in kernel mode */ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { result = get_jogwheel_sensitivity(ubulk, &value, 1, 0); if (result == 0) { @@ -722,7 +722,7 @@ ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_SET_JOG_WHEEL_SENSITIVITY\n",__FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_READ,ioctl_param,sizeof(u16)); + access = read_ok(ioctl_param,sizeof(u16)); if (access) { /*copy the usermode buffer to kernel mode*/ value16p_user = (u16 __user *)ioctl_param; @@ -749,7 +749,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { /*copy the usermode buffer to kernel mode*/ value16p_user = (u16 __user *)ioctl_param; @@ -786,7 +786,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { result = get_midi_channel(chip, &value); if (result==0) { @@ -813,7 +813,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u32)); + access = write_ok(ioctl_param,sizeof(u32)); if (access) { value32 = ubulk->chip->product_code; result = 0; @@ -846,7 +846,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { result = get_talkover_att(ubulk, &value, 1); @@ -873,7 +873,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_READ,ioctl_param,sizeof(u16)); + access = read_ok(ioctl_param,sizeof(u16)); if (access) { /*copy the usermode buffer to kernel mode*/ value16p_user = (u16 __user *)ioctl_param; @@ -899,7 +899,7 @@ ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_SET_TALKOVER_ENABLE\n", __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_READ,ioctl_param,sizeof(u8)); + access = read_ok(ioctl_param,sizeof(u8)); if (access) { /*copy the usermode buffer to kernel mode*/ value8p_user = (u8 __user *)ioctl_param; @@ -925,7 +925,7 @@ ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_GET_TALKOVER_ENABLE\n", __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u8)); + access = write_ok(ioctl_param,sizeof(u8)); if (access) { result = get_talkover_enable(ubulk, &value8); @@ -951,7 +951,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { result = get_firmware_version(chip, &value, 1); if (result==0) { @@ -978,7 +978,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { result = get_djconsole_device_config(ubulk->chip->index, &value, 0); @@ -1006,7 +1006,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_READ,ioctl_param,sizeof(u32)); + access = read_ok(ioctl_param,sizeof(u32)); if (access) { /*copy the usermode buffer to kernel mode*/ value32p_user = (u32 __user *)ioctl_param; @@ -1033,7 +1033,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { result = get_audio_config(ubulk, &value, 1); if (result==0) { @@ -1060,7 +1060,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_READ,ioctl_param,sizeof(u16)); + access = read_ok(ioctl_param,sizeof(u16)); if (access) { /*copy the usermode buffer to kernel mode*/ value16p_user = (u16 __user *)ioctl_param; @@ -1110,7 +1110,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { result = get_mouse_state(chip, &value); if (result==0) { @@ -1137,7 +1137,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { result = get_sample_rate(ubulk, &value, 0); if (result == 0) { @@ -1164,7 +1164,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_READ,ioctl_param,sizeof(u16)); + access = read_ok(ioctl_param,sizeof(u16)); if (access) { /*copy the usermode buffer to kernel mode*/ value16p_user = (u16 __user *)ioctl_param; @@ -1191,7 +1191,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_READ,ioctl_param,sizeof(u16)); + access = read_ok(ioctl_param,sizeof(u16)); if (access) { /*copy the usermode buffer to kernel mode*/ value16p_user = (u16 __user *)ioctl_param; @@ -1217,7 +1217,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { result = get_crossfader_lock(ubulk, &value, 0); if (result==0) { @@ -1244,7 +1244,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { /*copy the usermode buffer to kernel mode*/ value16p_user = (u16 __user *)ioctl_param; @@ -1270,7 +1270,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { result = get_crossfader_style(ubulk, &value); if (result==0) { @@ -1306,7 +1306,7 @@ } /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_READ,ioctl_param,sizeof(struct FIRMWARE_FILE)); + access = read_ok(ioctl_param,sizeof(struct FIRMWARE_FILE)); if (access) { /*allocate the kernel mode buffer*/ firmware_data = zero_alloc(sizeof(struct FIRMWARE_FILE),GFP_KERNEL); @@ -1342,7 +1342,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_READ,ioctl_param,sizeof(u8)); + access = read_ok(ioctl_param,sizeof(u8)); if (access) { /*copy the usermode buffer to kernel mode*/ value8p_user = (u8 __user *)ioctl_param; @@ -1368,7 +1368,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode */ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u8)); + access = write_ok(ioctl_param,sizeof(u8)); if (access) { result = get_mode_shift_state(ubulk, (u8*)&value8); if (result==0) { @@ -1395,7 +1395,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_READ,ioctl_param,sizeof(u16)); + access = read_ok(ioctl_param,sizeof(u16)); if (access) { /*copy the usermode buffer to kernel mode*/ value16p_user = (u16 __user *)ioctl_param; @@ -1421,7 +1421,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { result = get_fx_state(ubulk, &value); if (result==0) { @@ -1456,7 +1456,7 @@ } dc = ((struct hdj_steel_context*)ubulk->device_context); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { if (atomic_read(&dc->device_mode) == DJ_STEEL_IN_NORMAL_MODE) { result = reboot_djcontrolsteel_to_boot_mode(ubulk); @@ -1505,7 +1505,7 @@ } dc = ((struct hdj_steel_context*)ubulk->device_context); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { if (atomic_read(&dc->device_mode) == DJ_STEEL_IN_BOOT_MODE) { @@ -1553,7 +1553,7 @@ } /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,LOCATION_ID_LEN); + access = write_ok(ioctl_param,LOCATION_ID_LEN); if (access) { /*copy the kernel mode buffer to usermode*/ ctouser = copy_to_user((void*)ioctl_param,(void*)&chip->usb_device_path[0],LOCATION_ID_LEN); @@ -1591,7 +1591,7 @@ } /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_READ,ioctl_param,DJ_CONTROL_STEEL_BULK_TRANSFER_SIZE); + access = read_ok(ioctl_param,DJ_CONTROL_STEEL_BULK_TRANSFER_SIZE); if (access) { /*allocate the kernel mode buffer*/ bulk_write = zero_alloc(DJ_CONTROL_STEEL_BULK_TRANSFER_SIZE,GFP_KERNEL); @@ -1656,7 +1656,7 @@ if (compat_mode==0) { ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_REGISTER_FOR_NETLINK_DEVICE_NOTIFICATIONS\n", __FUNCTION__); - access = access_ok(VERIFY_READ,ioctl_param,sizeof(unsigned long)); + access = read_ok(ioctl_param,sizeof(unsigned long)); } else { ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_REGISTER_FOR_NETLINK_DEVICE_NOTIFICATIONS32\n", __FUNCTION__); @@ -1667,7 +1667,7 @@ result = -EINVAL; break; #else - access = access_ok(VERIFY_READ,ioctl_param,sizeof(compat_long_t)); + access = read_ok(ioctl_param,sizeof(compat_long_t)); #endif } if (access) { @@ -1717,7 +1717,7 @@ case DJ_IOCTL_GET_CONTROL_DATA_INPUT_PACKET_SIZE: ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_GET_CONTROL_DATA_INPUT_PACKET_SIZE\n", __FUNCTION__); - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u32)); + access = write_ok(ioctl_param,sizeof(u32)); if (access) { result = get_input_control_data_len(chip,&value32); if (result==0) { @@ -1740,7 +1740,7 @@ case DJ_IOCTL_GET_CONTROL_DATA_OUTPUT_PACKET_SIZE: ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_GET_CONTROL_DATA_OUTPUT_PACKET_SIZE\n", __FUNCTION__); - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u32)); + access = write_ok(ioctl_param,sizeof(u32)); if (access) { result = get_output_control_data_len(chip,&value32); if (result==0) { @@ -1785,7 +1785,7 @@ result = -EINVAL; break; } - access = access_ok(VERIFY_READ,ioctl_param,size); + access = read_ok(ioctl_param,size); if (access) { control_data_and_mask = kmalloc(size,GFP_KERNEL); if (control_data_and_mask!=NULL) { @@ -1832,7 +1832,7 @@ __FUNCTION__,result); break; } - access = access_ok(VERIFY_WRITE,ioctl_param,value32); + access = write_ok(ioctl_param,value32); if (access) { result = get_control_output_report(chip,(u8 __user *)ioctl_param,value32); if (result != 0) { @@ -1847,7 +1847,7 @@ case DJ_IOCTL_ACQUIRE_NETLINK_UNIT: ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_ACQUIRE_NETLINK_UNIT\n", __FUNCTION__); - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(int)); + access = write_ok(ioctl_param,sizeof(int)); if (access) { valueip_user = (int __user *)ioctl_param; result = __put_user(netlink_unit, valueip_user); @@ -1864,7 +1864,7 @@ case DJ_IOCTL_GET_DEVICE_CAPS: ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_GET_DEVICE_CAPS\n", __FUNCTION__); - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(struct snd_hdj_caps)); + access = write_ok(ioctl_param,sizeof(struct snd_hdj_caps)); if (access) { /*copy the kernel mode buffer to usermode*/ ctouser = copy_to_user((void*)ioctl_param,(void*)&chip->caps,sizeof(struct snd_hdj_caps)); diff -ur hdjmod-1.28.orig/source/device.h hdjmod-1.28/source/device.h --- hdjmod-1.28.orig/source/device.h 2009-01-27 15:25:50.000000000 +0100 +++ hdjmod-1.28/source/device.h 2019-03-18 11:38:57.128596342 +0100 @@ -27,6 +27,14 @@ #if !defined(_HDJDEVICE2_H_) #define _HDJDEVICE_H_ +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && defined(VERIFY_WRITE) + #define write_ok(addr, size) access_ok(VERIFY_WRITE, addr, size) + #define read_ok(addr, size) access_ok(VERIFY_READ, addr, size) +#else + #define write_ok(addr, size) access_ok(addr, size) + #define read_ok(addr, size) access_ok(addr, size) +#endif + extern int netlink_unit; #define MIN_NETLINK_UNIT 22 diff -ur hdjmod-1.28.orig/source/midi.c hdjmod-1.28/source/midi.c --- hdjmod-1.28.orig/source/midi.c 2019-03-18 11:22:52.224314434 +0100 +++ hdjmod-1.28/source/midi.c 2019-03-18 11:40:25.669723340 +0100 @@ -1480,7 +1480,7 @@ case DJ_IOCTL_GET_VERSION: ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_GET_VERSION\n", __FUNCTION__); - access = access_ok(VERIFY_WRITE,ioctl_param, sizeof(u32)); + access = write_ok(ioctl_param, sizeof(u32)); if (access!=0) { value32p_user = (u32 __user *)ioctl_param; err = __put_user(driver_version,value32p_user); @@ -1500,7 +1500,7 @@ case DJ_IOCTL_GET_FIRMWARE_VERSION: ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_GET_FIRMWARE_VERSION\n", __FUNCTION__); - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { err = get_firmware_version(chip,&value16,1); if (err==0) { @@ -1532,7 +1532,7 @@ } /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,LOCATION_ID_LEN); + access = write_ok(ioctl_param,LOCATION_ID_LEN); if (access) { /*copy the kernel mode buffer to usermode*/ ctouser = copy_to_user((void*)ioctl_param,(void*)&chip->usb_device_path[0], @@ -1555,7 +1555,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u32)); + access = write_ok(ioctl_param,sizeof(u32)); if (access) { value32 = chip->product_code; @@ -1577,7 +1577,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { /*copy the usermode buffer to kernel mode*/ value16p_user = (u16 __user *)ioctl_param; @@ -1614,7 +1614,7 @@ __FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { err = get_midi_channel(chip, &value16); if (err==0) { @@ -1656,7 +1656,7 @@ printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_GET_MOUSE_STATE\n",__FUNCTION__); /*verify that the address isn't in kernel mode*/ - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u16)); + access = write_ok(ioctl_param,sizeof(u16)); if (access) { err = get_mouse_state(chip, &value16); if (err==0) { @@ -1685,7 +1685,7 @@ if (compat_mode==0) { ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_REGISTER_FOR_NETLINK_DEVICE_NOTIFICATIONS\n", __FUNCTION__); - access = access_ok(VERIFY_READ,ioctl_param,sizeof(unsigned long)); + access = read_ok(ioctl_param,sizeof(unsigned long)); } else { ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_REGISTER_FOR_NETLINK_DEVICE_NOTIFICATIONS32\n", __FUNCTION__); @@ -1696,7 +1696,7 @@ err = -EINVAL; break; #else - access = access_ok(VERIFY_READ,ioctl_param,sizeof(compat_long_t)); + access = read_ok(ioctl_param,sizeof(compat_long_t)); #endif } if (access) { @@ -1745,7 +1745,7 @@ case DJ_IOCTL_ACQUIRE_NETLINK_UNIT: ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_ACQUIRE_NETLINK_UNIT\n", __FUNCTION__); - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(int)); + access = write_ok(ioctl_param,sizeof(int)); if (access) { valueip_user = (int __user *)ioctl_param; err = __put_user(netlink_unit, valueip_user); @@ -1771,7 +1771,7 @@ case DJ_IOCTL_GET_CONTROL_DATA_INPUT_PACKET_SIZE: ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_GET_CONTROL_DATA_INPUT_PACKET_SIZE\n", __FUNCTION__); - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u32)); + access = write_ok(ioctl_param,sizeof(u32)); if (access) { err = get_input_control_data_len(chip,&value32); if (err==0) { @@ -1794,7 +1794,7 @@ case DJ_IOCTL_GET_CONTROL_DATA_OUTPUT_PACKET_SIZE: ioctl_trace_printk(KERN_INFO"%s() received IOCTL: DJ_IOCTL_GET_CONTROL_DATA_OUTPUT_PACKET_SIZE\n", __FUNCTION__); - access = access_ok(VERIFY_WRITE,ioctl_param,sizeof(u32)); + access = write_ok(ioctl_param,sizeof(u32)); if (access) { err = get_output_control_data_len(chip,&value32); if (err==0) { @@ -1835,7 +1835,7 @@ err = -EINVAL; break; } - access = access_ok(VERIFY_READ,ioctl_param,size); + access = read_ok(ioctl_param,size); if (access) { control_data_and_mask = kmalloc(size,GFP_KERNEL); if (control_data_and_mask!=NULL) { @@ -1882,7 +1882,7 @@ } err = get_output_control_data_len(chip,&value32); if (err==0) { - access = access_ok(VERIFY_WRITE,ioctl_param,value32); + access = write_ok(ioctl_param,value32); if (access) { err = get_control_output_report(chip,(u8 __user *)ioctl_param,value32); if (err != 0) { ++++++ preamble ++++++ Requires: kernel-%1
