Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
From 070b07f0d41c8a1481a7e40ad5869868aad8c680 Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Mon, 27 Nov 2017 20:38:14 +0000
Subject: [PATCH 1/2] kernel 4.15 fix
---
kernel/nvidia-modeset/nvidia-modeset-linux.c | 8 +++-----
kernel/nvidia-uvm/uvm8_va_block.c | 2 ++
kernel/nvidia/nv.c | 10 ++++------
3 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/kernel/nvidia-modeset/nvidia-modeset-linux.c b/kernel/nvidia-modeset/nvidia-modeset-linux.c
index edeb152..df1d0bb 100644
--- a/kernel/nvidia-modeset/nvidia-modeset-linux.c
+++ b/kernel/nvidia-modeset/nvidia-modeset-linux.c
@@ -566,9 +566,9 @@ static void nvkms_queue_work(nv_kthread_q_t *q, nv_kthread_q_item_t *q_item)
WARN_ON(!ret);
}
-static void nvkms_timer_callback(unsigned long arg)
+static void nvkms_timer_callback(struct timer_list *t)
{
- struct nvkms_timer_t *timer = (struct nvkms_timer_t *) arg;
+ struct nvkms_timer_t *timer = from_timer(timer, t, kernel_timer);
/* In softirq context, so schedule nvkms_kthread_q_callback(). */
nvkms_queue_work(&nvkms_kthread_q, &timer->nv_kthread_q_item);
@@ -606,10 +606,8 @@ nvkms_init_timer(struct nvkms_timer_t *timer, nvkms_timer_proc_t *proc,
timer->kernel_timer_created = NV_FALSE;
nvkms_queue_work(&nvkms_kthread_q, &timer->nv_kthread_q_item);
} else {
- init_timer(&timer->kernel_timer);
+ timer_setup(&timer->kernel_timer, nvkms_timer_callback, 0);
timer->kernel_timer_created = NV_TRUE;
- timer->kernel_timer.function = nvkms_timer_callback;
- timer->kernel_timer.data = (unsigned long) timer;
mod_timer(&timer->kernel_timer, jiffies + NVKMS_USECS_TO_JIFFIES(usec));
}
spin_unlock_irqrestore(&nvkms_timers.lock, flags);
diff --git a/kernel/nvidia-uvm/uvm8_va_block.c b/kernel/nvidia-uvm/uvm8_va_block.c
index 99f6f9b..8fd88d6 100644
--- a/kernel/nvidia-uvm/uvm8_va_block.c
+++ b/kernel/nvidia-uvm/uvm8_va_block.c
@@ -36,6 +36,8 @@
#include "uvm8_perf_prefetch.h"
#include "uvm8_mem.h"
+#include <linux/sched/task_stack.h>
+
typedef enum
{
BLOCK_PTE_OP_MAP,
diff --git a/kernel/nvidia/nv.c b/kernel/nvidia/nv.c
index 2e2523e..7801ad2 100644
--- a/kernel/nvidia/nv.c
+++ b/kernel/nvidia/nv.c
@@ -321,7 +321,7 @@ static irqreturn_t nvidia_isr (int, void *, struct pt_regs *);
#else
static irqreturn_t nvidia_isr (int, void *);
#endif
-static void nvidia_rc_timer (unsigned long);
+static void nvidia_rc_timer (struct timer_list *t);
static int nvidia_ctl_open (struct inode *, struct file *);
static int nvidia_ctl_close (struct inode *, struct file *);
@@ -2342,10 +2342,10 @@ nvidia_isr_bh_unlocked(
static void
nvidia_rc_timer(
- unsigned long data
+ struct timer_list *t
)
{
- nv_linux_state_t *nvl = (nv_linux_state_t *) data;
+ nv_linux_state_t *nvl = from_timer(nvl, t, rc_timer);
nv_state_t *nv = NV_STATE_PTR(nvl);
nvidia_stack_t *sp = nvl->sp[NV_DEV_STACK_TIMER];
@@ -3256,9 +3256,7 @@ int NV_API_CALL nv_start_rc_timer(
return -1;
nv_printf(NV_DBG_INFO, "NVRM: initializing rc timer\n");
- init_timer(&nvl->rc_timer);
- nvl->rc_timer.function = nvidia_rc_timer;
- nvl->rc_timer.data = (unsigned long) nvl;
+ timer_setup(&nvl->rc_timer, nvidia_rc_timer, 0);
nv->rc_timer_enabled = 1;
mod_timer(&nvl->rc_timer, jiffies + HZ); /* set our timeout for 1 second */
nv_printf(NV_DBG_INFO, "NVRM: rc timer initialized\n");
--
2.14.1
From a7cc04a56a88f45d702166e998e93b7a06a7f58a Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Mon, 27 Nov 2017 23:03:09 +0000
Subject: [PATCH 2/2] temp: fix licence
---
kernel/nvidia-drm/nvidia-drm-linux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/nvidia-drm/nvidia-drm-linux.c b/kernel/nvidia-drm/nvidia-drm-linux.c
index c5465a9..ecce218 100644
--- a/kernel/nvidia-drm/nvidia-drm-linux.c
+++ b/kernel/nvidia-drm/nvidia-drm-linux.c
@@ -185,7 +185,7 @@ module_init(nv_linux_drm_init);
module_exit(nv_linux_drm_exit);
#if defined(MODULE_LICENSE)
- MODULE_LICENSE("MIT");
+ MODULE_LICENSE("GPL");
#endif
#if defined(MODULE_INFO)
MODULE_INFO(supported, "external");
--
2.14.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment