updated on Thu Jan 12 04:00:44 UTC 2012
[aur-mirror.git] / vhba-module-all / vhba-kernel2.6.37.patch
blobe2b619c74ba8e68b540ab98b4c63d3bf84c45967
1 From 9ad7ec7fae387f05249b9f4e6accb3bc3b0b8b0f Mon Sep 17 00:00:00 2001
2 From: Alexandre Rostovtsev <tetromino@gmail.com>
3 Date: Thu, 6 Jan 2011 03:39:26 -0500
4 Subject: [PATCH] Make vhba compatible with kernel 2.6.37 SCSI host API
6 Due to the SCSI host lock push-down changes introduced in 2.6.37 (see
7 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=f281233d3eba15fb225d21ae2e228fd4553d824a
8 for more details), trying to use current vhba on 2.6.37 leads to oopses
9 and kernel panics - e.g. see http://bugs.gentoo.org/show_bug.cgi?id=350753
11 Add some #ifdefs to enable compatibility both with 2.6.37 and older API.
12 Note that if future kernel versions remove the DEF_SCSI_QCMD macro, this
13 issue will need to be revisited.
15 Signed-off-by: Alexandre Rostovtsev <tetromino@gmail.com>
16 ---
17 vhba-module/vhba.c | 9 ++++++++-
18 1 files changed, 8 insertions(+), 1 deletions(-)
20 diff --git a/vhba-module/vhba.c b/vhba-module/vhba.c
21 index 059f6ce..9d13016 100644
22 --- a/vhba-module/vhba.c
23 +++ b/vhba-module/vhba.c
24 @@ -27,6 +27,7 @@
25 #include <linux/miscdevice.h>
26 #include <linux/poll.h>
27 #include <linux/slab.h>
28 +#include <linux/version.h>
29 #ifdef CONFIG_COMPAT
30 #include <linux/compat.h>
31 #endif
32 @@ -363,7 +364,7 @@ static void vhba_free_command(struct vhba_command *vcmd)
33 spin_unlock_irqrestore(&vhost->cmd_lock, flags);
36 -static int vhba_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
37 +static int vhba_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
39 struct vhba_device *vdev;
40 int retval;
41 @@ -388,6 +389,12 @@ static int vhba_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmn
42 return retval;
45 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
46 +DEF_SCSI_QCMD(vhba_queuecommand)
47 +#else
48 +#define vhba_queuecommand vhba_queuecommand_lck
49 +#endif
51 static int vhba_abort(struct scsi_cmnd *cmd)
53 struct vhba_device *vdev;
54 --
55 1.7.3.4