[Pkg-virtualbox-devel] Bug#883427: virtualbox-dkms: patch for 5.2.2-dfsg-2

Carlo Valenti carlovalenti at ac.c4q.nyc
Sun Dec 3 22:44:49 UTC 2017


Package: virtualbox-dkms
Version: 5.2.2-dfsg-2

'r0drv/linux/timer-r0drv-linux.c' fails to build for kernel versions
>=~4.14.0 (git commit 185981d5), due to 'include/linux/timer.h'
recently dropping init_timer_pinned() in favor of newer timer_setup()

Patch:

--- tstdir/usr/src/virtualbox-5.2.2/r0drv/linux/timer-r0drv-linux.c
2017-11-23 04:22:25.000000000 -0500
+++ /home/deb/timer-r0drv-linux.c 2017-12-03 16:47:35.627778217 -0500
@@ -720,9 +720,15 @@
  *
  * @param   ulUser      Address of the sub-timer structure.
  */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
+static void rtTimerLinuxStdCallback(struct timer_list *t)
+{
+    PRTTIMERLNXSUBTIMER pSubTimer = from_timer(pSubTimer, t, u.Std.LnxTimer);
+#else
 static void rtTimerLinuxStdCallback(unsigned long ulUser)
 {
     PRTTIMERLNXSUBTIMER pSubTimer = (PRTTIMERLNXSUBTIMER)ulUser;
+#endif /* => KERNEL_VERSION(4, 14, 0) */
     PRTTIMER            pTimer    = pSubTimer->pParent;

     RTTIMERLNX_LOG(("stdcallback %p\n", pTimer));
@@ -1584,15 +1590,19 @@
         else
 #endif
         {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
-            init_timer_pinned(&pTimer->aSubTimers[iCpu].u.Std.LnxTimer);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
+            timer_setup(&pTimer->aSubTimers[iCpu].u.Std.LnxTimer,
rtTimerLinuxStdCallback, TIMER_PINNED);
 #else
+  #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+            init_timer_pinned(&pTimer->aSubTimers[iCpu].u.Std.LnxTimer);
+  #else
             init_timer(&pTimer->aSubTimers[iCpu].u.Std.LnxTimer);
-#endif
+  #endif /* >= KERNEL_VERSION(4, 8, 0) */
             pTimer->aSubTimers[iCpu].u.Std.LnxTimer.data        =
(unsigned long)&pTimer->aSubTimers[iCpu];
             pTimer->aSubTimers[iCpu].u.Std.LnxTimer.function    =
rtTimerLinuxStdCallback;
             pTimer->aSubTimers[iCpu].u.Std.LnxTimer.expires     = jiffies;
             pTimer->aSubTimers[iCpu].u.Std.u64NextTS            = 0;
+#endif /* => KERNEL_VERSION(4, 14, 0) */
         }
         pTimer->aSubTimers[iCpu].iTick      = 0;
         pTimer->aSubTimers[iCpu].pParent    = pTimer;



More information about the Pkg-virtualbox-devel mailing list