sysfs: Document sysfs_attr_init and sysfs_bin_attr_init

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, March 8, 2010 - 1:59 pm

Gitweb:     http://git.kernel.org/linus/35960258ed388cdcebdb71df35fd5126978ca325
Commit:     35960258ed388cdcebdb71df35fd5126978ca325
Parent:     a07e4156a2ee6359d31a44946d7ee7f85dbf6bca
Author:     Eric W. Biederman <ebiederm@xmission.com>
AuthorDate: Fri Feb 12 04:35:32 2010 -0800
Committer:  Greg Kroah-Hartman <gregkh@suse.de>
CommitDate: Sun Mar 7 17:04:51 2010 -0800

    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>
---
 include/linux/sysfs.h |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 006c359..5b8f80f 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -36,6 +36,16 @@ struct attribute {
 #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
 #define sysfs_attr_init(attr)				\
 do {							\
@@ -90,6 +100,16 @@ struct bin_attribute {
 		    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)
 
 struct sysfs_ops {
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
sysfs: Document sysfs_attr_init and sysfs_bin_attr_init, Linux Kernel Mailing ..., (Mon Mar 8, 1:59 pm)