From 548f229efb37f9b2ca866f0cb236caa67651eb1f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 24 May 2014 07:03:12 +0000 Subject: [PATCH] ib_srpt: Build fix for kernel version 3.13 and later git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@5553 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 6e4c5057e..d5aa67ee7 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -3695,6 +3695,7 @@ static struct class_attribute srpt_class_attrs[] = { __ATTR_NULL, }; +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) static struct class_device_attribute srpt_dev_attrs[] = { #else @@ -3703,19 +3704,42 @@ static struct device_attribute srpt_dev_attrs[] = { __ATTR(login_info, S_IRUGO, show_login_info, NULL), __ATTR_NULL, }; +#else +DEVICE_ATTR(login_info, S_IRUGO, show_login_info, NULL); + +static struct attribute *srpt_dev_attrs[] = { + &dev_attr_login_info.attr, + NULL +}; + +static struct attribute_group srpt_dev_group = { + .attrs = srpt_dev_attrs, +}; + +static const struct attribute_group *srpt_dev_groups[] = { + &srpt_dev_group, + NULL +}; +#endif static struct class srpt_class = { - .name = "infiniband_srpt", + .name = "infiniband_srpt", #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) - .release = srpt_dev_release, + .release = srpt_dev_release, #else - .dev_release = srpt_dev_release, + .dev_release = srpt_dev_release, #endif - .class_attrs = srpt_class_attrs, + .class_attrs = srpt_class_attrs, #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) .class_dev_attrs = srpt_dev_attrs, +#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) + /* + * See also patch "driver core: remove dev_attrs from struct class" + * (commit ID bcc8edb52f05c1a9e75118d6b3bc04996a750593). + */ + .dev_attrs = srpt_dev_attrs, #else - .dev_attrs = srpt_dev_attrs, + .dev_groups = srpt_dev_groups, #endif };