diff options
author | root <root@artemis.panaceas.org> | 2015-12-25 15:00:15 +0000 |
---|---|---|
committer | root <root@artemis.panaceas.org> | 2015-12-25 15:00:15 +0000 |
commit | ddd86436f4e3643c04b797f858dab95d5f2e4de9 (patch) | |
tree | bfe7a780cf9a2f4fc33aec32c82e625e79dece1f /backport-include/linux/sysfs.h | |
download | backports-3.10.19-1-master.tar.gz backports-3.10.19-1-master.tar.bz2 backports-3.10.19-1-master.zip |
Diffstat (limited to 'backport-include/linux/sysfs.h')
-rw-r--r-- | backport-include/linux/sysfs.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/backport-include/linux/sysfs.h b/backport-include/linux/sysfs.h new file mode 100644 index 0000000..a2ef73f --- /dev/null +++ b/backport-include/linux/sysfs.h @@ -0,0 +1,34 @@ +#ifndef __BACKPORT_LINUX_SYSFS_H +#define __BACKPORT_LINUX_SYSFS_H +#include_next <linux/sysfs.h> +#include <linux/version.h> + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) +#ifdef CONFIG_DEBUG_LOCK_ALLOC +#define sysfs_attr_init(attr) \ +do { \ + static struct lock_class_key __key; \ + \ + (attr)->key = &__key; \ +} while(0) +#else +#define sysfs_attr_init(attr) do {} while(0) +#endif + +/* mask sysfs_bin_attr_init as RHEL6 backports this */ +#if !defined(sysfs_bin_attr_init) +/** + * sysfs_bin_attr_init - initialize a dynamically allocated bin_attribute + * @attr: struct bin_attribute to initialize + * + * Initialize a dynamically allocated struct bin_attribute so we + * can make lockdep happy. This is a new requirement for + * attributes and initially this is only needed when lockdep is + * enabled. Lockdep gives a nice error when your attribute is + * added to sysfs if you don't have this. + */ +#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr) +#endif +#endif + +#endif /* __BACKPORT_LINUX_SYSFS_H */ |