From 5737910fb4046e2c6dd80b02bee02b006caadc65 Mon Sep 17 00:00:00 2001 From: Richard Sharpe Date: Thu, 22 Jul 2010 09:40:14 +0000 Subject: [PATCH] Put in a clearer work-around for the problem with the size of the max_cmd_size field. The size changed at 2.6.26 from unsigned char to unsigned short. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1859 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst_local/scst_local.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index 81772cf87..66013c5c7 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -989,15 +989,16 @@ static int scst_fake_lld_driver_probe(struct device *dev) hpnt->max_lun = scst_local_max_luns - 1; /* - * Because of a change in the size of this field around 2.6.26 + * Because of a change in the size of this field at 2.6.26 * we use this check ... it allows us to work on earlier - * kernels. If we don't, the max_cmd_size gets set to 4 (and we get + * kernels. If we don't, max_cmd_size gets set to 4 (and we get * a compiler warning) so a scan never occurs. */ - if (sizeof(hpnt->max_cmd_len) == sizeof(unsigned char)) - hpnt->max_cmd_len = 16; - else - hpnt->max_cmd_len = 260; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) + hpnt->max_cmd_len = 16; +#else + hpnt->max_cmd_len = 260; +#endif ret = scsi_add_host(hpnt, &scst_lcl_host->dev); if (ret) {