sysfs: Document sysfs_attr_init and sysfs_bin_attr_init

I have added a new requirement to the external sysfs interface
that dynamically allocated sysfs attributes must call sysfs_attr_init
if lockdep is enabled. For the time being callying sysfs_attr_init
is only mandatory if lockdep is enabled, so we can live with a few
unconverted instances until we find them all. As this is part of
the public interface of sysfs it is a good idea to document these
pseudo functions so someone inspeciting the code can find out
what has happened.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by Eric W. Biederman and committed by Greg Kroah-Hartman 35960258 a07e4156

+20
+20
include/linux/sysfs.h
··· 36 36 #endif 37 37 }; 38 38 39 + /** 40 + * sysfs_attr_init - initialize a dynamically allocated sysfs attribute 41 + * @attr: struct attribute to initialize 42 + * 43 + * Initialize a dynamically allocated struct attribute so we can 44 + * make lockdep happy. This is a new requirement for attributes 45 + * and initially this is only needed when lockdep is enabled. 46 + * Lockdep gives a nice error when your attribute is added to 47 + * sysfs if you don't have this. 48 + */ 39 49 #ifdef CONFIG_DEBUG_LOCK_ALLOC 40 50 #define sysfs_attr_init(attr) \ 41 51 do { \ ··· 100 90 struct vm_area_struct *vma); 101 91 }; 102 92 93 + /** 94 + * sysfs_bin_attr_init - initialize a dynamically allocated bin_attribute 95 + * @attr: struct bin_attribute to initialize 96 + * 97 + * Initialize a dynamically allocated struct bin_attribute so we 98 + * can make lockdep happy. This is a new requirement for 99 + * attributes and initially this is only needed when lockdep is 100 + * enabled. Lockdep gives a nice error when your attribute is 101 + * added to sysfs if you don't have this. 102 + */ 103 103 #define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&bin_attr->attr) 104 104 105 105 struct sysfs_ops {