aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-26 14:41:08 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-26 14:41:08 -0500
commit92320cec611d4ed44a9bd635727d61f6caa669a7 (patch)
treee5cfe51e7134ea62cc82e59aaf28f191ef4a2543 /fs/sysfs
parent63ae0e5be34cb7593fc5f1135422129f765ac3ef (diff)
parent19c262391c4741b012a5031fc438fb694e77c385 (diff)
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/sysfs')
-rw-r--r--fs/sysfs/file.c44
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)
502 502
503 503
504/** 504/**
505 * sysfs_add_file_to_group - add an attribute file to a pre-existing group.
506 * @kobj: object we're acting for.
507 * @attr: attribute descriptor.
508 * @group: group name.
509 */
510int sysfs_add_file_to_group(struct kobject *kobj,
511 const struct attribute *attr, const char *group)
512{
513 struct dentry *dir;
514 int error;
515
516 dir = lookup_one_len(group, kobj->dentry, strlen(group));
517 if (IS_ERR(dir))
518 error = PTR_ERR(dir);
519 else {
520 error = sysfs_add_file(dir, attr, SYSFS_KOBJ_ATTR);
521 dput(dir);
522 }
523 return error;
524}
525EXPORT_SYMBOL_GPL(sysfs_add_file_to_group);
526
527
528/**
505 * sysfs_update_file - update the modified timestamp on an object attribute. 529 * sysfs_update_file - update the modified timestamp on an object attribute.
506 * @kobj: object we're acting for. 530 * @kobj: object we're acting for.
507 * @attr: attribute descriptor. 531 * @attr: attribute descriptor.
@@ -586,6 +610,26 @@ void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr)
586} 610}
587 611
588 612
613/**
614 * sysfs_remove_file_from_group - remove an attribute file from a group.
615 * @kobj: object we're acting for.
616 * @attr: attribute descriptor.
617 * @group: group name.
618 */
619void sysfs_remove_file_from_group(struct kobject *kobj,
620 const struct attribute *attr, const char *group)
621{
622 struct dentry *dir;
623
624 dir = lookup_one_len(group, kobj->dentry, strlen(group));
625 if (!IS_ERR(dir)) {
626 sysfs_hash_and_remove(dir, attr->name);
627 dput(dir);
628 }
629}
630EXPORT_SYMBOL_GPL(sysfs_remove_file_from_group);
631
632
589EXPORT_SYMBOL_GPL(sysfs_create_file); 633EXPORT_SYMBOL_GPL(sysfs_create_file);
590EXPORT_SYMBOL_GPL(sysfs_remove_file); 634EXPORT_SYMBOL_GPL(sysfs_remove_file);
591EXPORT_SYMBOL_GPL(sysfs_update_file); 635EXPORT_SYMBOL_GPL(sysfs_update_file);