[ltp] [PATCH] tp_smapi-0.36/hdaps.c build fix for kernels >= 2.6.25

Evgeni Golov linux-thinkpad@linux-thinkpad.org
Mon, 11 Feb 2008 13:29:00 +0100


This is a multi-part message in MIME format.

--Multipart=_Mon__11_Feb_2008_13_29_00_+0100_Yf=MG7ArrNOUT+th
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hi,

just testing 2.6.25-rc1 and found that cdev was dropped from the
input_dev struct (git 0c1efd365306c9b04df5abdd41e9b4dc721e84fb).
Attached a patch which fixes this by defining cdev only for kernels
<2.6.25. Beware, it's only compile-tested, as I don't have my HDAPS
enabled machine here atm.

Regards
Evgeni

--Multipart=_Mon__11_Feb_2008_13_29_00_+0100_Yf=MG7ArrNOUT+th
Content-Type: text/x-diff;
 name="tp_smapi-hdaps-2.6.25.patch"
Content-Disposition: attachment;
 filename="tp_smapi-hdaps-2.6.25.patch"
Content-Transfer-Encoding: 7bit

--- hdaps.c.orig	2008-02-11 13:19:40.000000000 +0100
+++ hdaps.c	2008-02-11 13:23:20.000000000 +0100
@@ -36,6 +36,7 @@
 #include <linux/jiffies.h>
 #include "thinkpad_ec.h"
 #include <linux/pci_ids.h>
+#include <linux/version.h>
 
 /* Embedded controller accelerometer read command and its result: */
 static const struct thinkpad_ec_row ec_accel_args =
@@ -848,7 +849,9 @@
 	hdaps_idev->id.vendor  = HDAPS_INPUT_VENDOR;
 	hdaps_idev->id.product = HDAPS_INPUT_PRODUCT;
 	hdaps_idev->id.version = HDAPS_INPUT_JS_VERSION;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
 	hdaps_idev->cdev.dev = &pdev->dev;
+#endif
 	hdaps_idev->evbit[0] = BIT(EV_ABS);
 	hdaps_idev->open = hdaps_mousedev_open;
 	hdaps_idev->close = hdaps_mousedev_close;
@@ -868,7 +871,9 @@
 	hdaps_idev_raw->id.vendor  = HDAPS_INPUT_VENDOR;
 	hdaps_idev_raw->id.product = HDAPS_INPUT_PRODUCT;
 	hdaps_idev_raw->id.version = HDAPS_INPUT_RAW_VERSION;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
 	hdaps_idev_raw->cdev.dev = &pdev->dev;
+#endif
 	hdaps_idev_raw->evbit[0] = BIT(EV_ABS);
 	hdaps_idev_raw->open = hdaps_mousedev_open;
 	hdaps_idev_raw->close = hdaps_mousedev_close;

--Multipart=_Mon__11_Feb_2008_13_29_00_+0100_Yf=MG7ArrNOUT+th--