]> git.sur5r.net Git - groeck-nct6775/blobdiff - compat.h
compat.h: Define sysfs_attr_init if not defined
[groeck-nct6775] / compat.h
index 5d37fc7cf9b11c3093314670264f84f15f94f9b6..4ea3a997928f9fb3c34b3a341a07e242ffff07dd 100644 (file)
--- a/compat.h
+++ b/compat.h
@@ -20,6 +20,8 @@ u8 vid_which_vrm(void)
 #endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+#if !(defined RHEL_MAJOR && RHEL_MAJOR == 7)
+#if !(defined RHEL_MAJOR && RHEL_MAJOR == 6 && RHEL_MINOR >= 7)
 static int sysfs_create_groups(struct kobject *kobj,
                               const struct attribute_group **groups)
 {
@@ -39,6 +41,7 @@ static int sysfs_create_groups(struct kobject *kobj,
        }
        return error;
 }
+#endif
 
 static void sysfs_remove_groups(struct kobject *kobj,
                                const struct attribute_group **groups)
@@ -50,7 +53,10 @@ static void sysfs_remove_groups(struct kobject *kobj,
        for (i = 0; groups[i]; i++)
                sysfs_remove_group(kobj, groups[i]);
 }
+#endif
 
+#if !(defined RHEL_MAJOR && RHEL_MAJOR == 7)
+#if !(defined RHEL_MAJOR && RHEL_MAJOR == 6 && RHEL_MINOR >= 7)
 static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr)
 {
        if (IS_ERR(ptr))
@@ -58,7 +64,8 @@ static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr)
        else
                return 0;
 }
-
+#endif
+#endif
 #endif
 
 #ifdef __NEED_I2C__
@@ -223,4 +230,8 @@ module_exit(__driver##_exit);
 #define pr_warn_ratelimited pr_warning_ratelimited
 #endif
 
+#ifndef sysfs_attr_init
+#define sysfs_attr_init(attr) do {} while (0)
+#endif
+
 #endif /* __COMPAT_H */