Commit 35960258 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Greg Kroah-Hartman

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: default avatarEric W. Biederman <ebiederm@xmission.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a07e4156
...@@ -36,6 +36,16 @@ struct attribute { ...@@ -36,6 +36,16 @@ struct attribute {
#endif #endif
}; };
/**
* sysfs_attr_init - initialize a dynamically allocated sysfs attribute
* @attr: struct attribute to initialize
*
* Initialize a dynamically allocated struct 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.
*/
#ifdef CONFIG_DEBUG_LOCK_ALLOC #ifdef CONFIG_DEBUG_LOCK_ALLOC
#define sysfs_attr_init(attr) \ #define sysfs_attr_init(attr) \
do { \ do { \
...@@ -90,6 +100,16 @@ struct bin_attribute { ...@@ -90,6 +100,16 @@ struct bin_attribute {
struct vm_area_struct *vma); struct vm_area_struct *vma);
}; };
/**
* 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) #define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&bin_attr->attr)
struct sysfs_ops { struct sysfs_ops {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment