mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-05 05:42:36 +00:00
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>
This commit is contained in:
parent
265d2e2e31
commit
1c205ae18d
2 changed files with 34 additions and 0 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue