summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndi Kleen <andi@firstfloor.org>2010-01-05 12:48:01 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-07 17:04:47 -0800
commit1c205ae18db53ff72985dd79f3baaf2dbaba6db7 (patch)
treeba2947326f34337b33c90391496b6e40089bc2ad /include
parent265d2e2e31c5f6dc1b20ae1653a17fdba706f79e (diff)
downloadlinux-1c205ae18db53ff72985dd79f3baaf2dbaba6db7.tar.gz
linux-1c205ae18db53ff72985dd79f3baaf2dbaba6db7.tar.bz2
linux-1c205ae18db53ff72985dd79f3baaf2dbaba6db7.zip
sysfs: Add sysfs_add/remove_files utility functions
Adding/Removing a whole array of attributes is very common. Add a standard utility function to do this with a simple function call, instead of requiring drivers to open code this. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/sysfs.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index cfa83083a2d4..3e8526582146 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -94,9 +94,12 @@ int __must_check sysfs_move_dir(struct kobject *kobj,
int __must_check sysfs_create_file(struct kobject *kobj,
const struct attribute *attr);
+int __must_check sysfs_create_files(struct kobject *kobj,
+ const struct attribute **attr);
int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr,
mode_t mode);
void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr);
+void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
int __must_check sysfs_create_bin_file(struct kobject *kobj,
const struct bin_attribute *attr);
@@ -164,6 +167,12 @@ static inline int sysfs_create_file(struct kobject *kobj,
return 0;
}
+static inline int sysfs_create_files(struct kobject *kobj,
+ const struct attribute **attr)
+{
+ return 0;
+}
+
static inline int sysfs_chmod_file(struct kobject *kobj,
struct attribute *attr, mode_t mode)
{
@@ -175,6 +184,11 @@ static inline void sysfs_remove_file(struct kobject *kobj,
{
}
+static inline void sysfs_remove_files(struct kobject *kobj,
+ const struct attribute **attr)
+{
+}
+
static inline int sysfs_create_bin_file(struct kobject *kobj,
const struct bin_attribute *attr)
{