diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-26 20:41:08 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-26 20:41:08 +0100 |
commit | 92320cec611d4ed44a9bd635727d61f6caa669a7 (patch) | |
tree | e5cfe51e7134ea62cc82e59aaf28f191ef4a2543 /fs | |
parent | Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus (diff) | |
parent | USB: export autosuspend delay in sysfs (diff) | |
download | linux-92320cec611d4ed44a9bd635727d61f6caa669a7.tar.xz linux-92320cec611d4ed44a9bd635727d61f6caa669a7.zip |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6:
USB: export autosuspend delay in sysfs
sysfs: allow attributes to be added to groups
USB: make autosuspend delay a module parameter
USB: minor cleanups for sysfs.c
USB: add a blacklist for devices that can't handle some things we throw at them.
USB: refactor usb device matching and create usb_device_match
USB: Wacom driver updates
gadgetfs: Fixed bug in ep_aio_read_retry.
USB: Use USB defines in usbmouse.c and usbkbd.c
USB: add rationale on why usb descriptor structures have to be packed
USB: ftdi_sio: Adding VID and PID for Tellstick
UHCI: Eliminate asynchronous skeleton Queue Headers
UHCI: Add macros for computing DMA values
USB: Davicom DM9601 usbnet driver
USB: asix.c - Add JVC-PRX1 ids
usbmon: Remove erroneous __exit
USB: add driver for iowarrior devices.
USB: option: add a bunch of new device ids
USB: option: remove duplicate device id table
Diffstat (limited to 'fs')
-rw-r--r-- | fs/sysfs/file.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 98b0910ad80c..8d4d839a9d88 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -502,6 +502,30 @@ int sysfs_create_file(struct kobject * kobj, const struct attribute * attr) /** + * sysfs_add_file_to_group - add an attribute file to a pre-existing group. + * @kobj: object we're acting for. + * @attr: attribute descriptor. + * @group: group name. + */ +int sysfs_add_file_to_group(struct kobject *kobj, + const struct attribute *attr, const char *group) +{ + struct dentry *dir; + int error; + + dir = lookup_one_len(group, kobj->dentry, strlen(group)); + if (IS_ERR(dir)) + error = PTR_ERR(dir); + else { + error = sysfs_add_file(dir, attr, SYSFS_KOBJ_ATTR); + dput(dir); + } + return error; +} +EXPORT_SYMBOL_GPL(sysfs_add_file_to_group); + + +/** * sysfs_update_file - update the modified timestamp on an object attribute. * @kobj: object we're acting for. * @attr: attribute descriptor. @@ -586,6 +610,26 @@ void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr) } +/** + * sysfs_remove_file_from_group - remove an attribute file from a group. + * @kobj: object we're acting for. + * @attr: attribute descriptor. + * @group: group name. + */ +void sysfs_remove_file_from_group(struct kobject *kobj, + const struct attribute *attr, const char *group) +{ + struct dentry *dir; + + dir = lookup_one_len(group, kobj->dentry, strlen(group)); + if (!IS_ERR(dir)) { + sysfs_hash_and_remove(dir, attr->name); + dput(dir); + } +} +EXPORT_SYMBOL_GPL(sysfs_remove_file_from_group); + + EXPORT_SYMBOL_GPL(sysfs_create_file); EXPORT_SYMBOL_GPL(sysfs_remove_file); EXPORT_SYMBOL_GPL(sysfs_update_file); |