Created
May 16, 2011 21:48
-
-
Save kofron/975442 to your computer and use it in GitHub Desktop.
update the signatek px1500 kernel mode drivers to be compatible with linux kernels greater than 2.36 which use unlocked_ioctl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 5646187eee867ca31402a5f851baa0e602d0daab Mon Sep 17 00:00:00 2001 | |
From: Jared Kofron <jared.kofron@gmail.com> | |
Date: Mon, 16 May 2011 22:28:53 +0000 | |
Subject: [PATCH 1/2] added compatibility with kernels greater than 2.36 by using HAVE_UNLOCKED_IOCTL macro | |
--- | |
driver/px4_drv.c | 6 +++++- | |
driver/px4_drv.h | 5 ++++- | |
driver/px4_ioctl.c | 10 ++++++++-- | |
3 files changed, 17 insertions(+), 4 deletions(-) | |
diff --git a/driver/px4_drv.c b/driver/px4_drv.c | |
index 94f42f9..79d983d 100644 | |
--- a/driver/px4_drv.c | |
+++ b/driver/px4_drv.c | |
@@ -108,7 +108,11 @@ int __init px4_module_init() | |
s_fopsPX4.read = px4_read; | |
s_fopsPX4.write = px4_write; | |
s_fopsPX4.mmap = px4_mmap; | |
- s_fopsPX4.ioctl = px4_ioctl; | |
+#if HAVE_UNLOCKED_IOCTL | |
+ s_fopsPX4.unlocked_ioctl = px4_ioctl; | |
+#else | |
+ s_fopsPX4.ioctl = px4_ioctl; | |
+#endif | |
s_fopsPX4.open = px4_open; | |
s_fopsPX4.release = px4_release; | |
cdev_init(&g_pModPX4->cdev, &s_fopsPX4); | |
diff --git a/driver/px4_drv.h b/driver/px4_drv.h | |
index bdbb0a2..98b1e09 100644 | |
--- a/driver/px4_drv.h | |
+++ b/driver/px4_drv.h | |
@@ -425,8 +425,11 @@ irqreturn_t px4_isr (int irq, void *dev_id, struct pt_regs *regsp); | |
irqreturn_t px4_isr (int irq, void *dev_id); | |
#endif | |
+#if HAVE_UNLOCKED_IOCTL | |
+long px4_ioctl (struct file *filp, u_int cmd, u_long arg); | |
+#else | |
int px4_ioctl (struct inode *pNode, struct file *filp, u_int cmd, u_long arg); | |
-int px4_mmap (struct file *filp, struct vm_area_struct *vmap); | |
+#endif | |
/// Top-level device hardware init | |
int __devinit hw_init_px4_device (px4_device* devp); | |
diff --git a/driver/px4_ioctl.c b/driver/px4_ioctl.c | |
index c21efc5..922cf8d 100644 | |
--- a/driver/px4_ioctl.c | |
+++ b/driver/px4_ioctl.c | |
@@ -54,10 +54,16 @@ int pre_ioctl_check (px4_device* devp, u_int cmd, u_long arg) | |
return 0; | |
} | |
+#if HAVE_UNLOCKED_IOCTL | |
+long px4_ioctl (struct file *filp, | |
+ u_int cmd, | |
+ u_long arg) | |
+#else | |
int px4_ioctl (struct inode *pNode, | |
- struct file *filp, | |
- u_int cmd, | |
+ struct file *filp, | |
+ u_int cmd, | |
u_long arg) | |
+#endif | |
{ | |
px4_device* devp; | |
int res; | |
-- | |
1.7.3.4 | |
From 4b94b16a1ca4da68554ccf08e6a6017c9a8e22e9 Mon Sep 17 00:00:00 2001 | |
From: Jared Kofron <jared.kofron@gmail.com> | |
Date: Mon, 16 May 2011 22:42:15 +0000 | |
Subject: [PATCH 2/2] forgot to include declaration of px4_mmap | |
--- | |
driver/px4_drv.h | 1 + | |
1 files changed, 1 insertions(+), 0 deletions(-) | |
diff --git a/driver/px4_drv.h b/driver/px4_drv.h | |
index 98b1e09..6909dbc 100644 | |
--- a/driver/px4_drv.h | |
+++ b/driver/px4_drv.h | |
@@ -430,6 +430,7 @@ long px4_ioctl (struct file *filp, u_int cmd, u_long arg); | |
#else | |
int px4_ioctl (struct inode *pNode, struct file *filp, u_int cmd, u_long arg); | |
#endif | |
+int px4_mmap (struct file *filp, struct vm_area_struct *vmap); | |
/// Top-level device hardware init | |
int __devinit hw_init_px4_device (px4_device* devp); | |
-- | |
1.7.3.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment