diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-02-11 07:20:56 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-02-11 07:20:56 -0500 |
commit | a9834cb205bf0d2b52da7f603f43b62a09f503b7 (patch) | |
tree | 43d2e68f1450011b778f90caa53253cfaa9d88de /fs | |
parent | 48694bdb38769c8b9fad4750df25681e32bd815a (diff) | |
parent | 511d5c4212948fe55035b8fed61ac0e125af5a05 (diff) |
Merge branch 'acpi-pm'
* acpi-pm: (35 commits)
ACPI / PM: Handle missing _PSC in acpi_bus_update_power()
ACPI / PM: Do not power manage devices in unknown initial states
ACPI / PM: Fix acpi_bus_get_device() check in drivers/acpi/device_pm.c
ACPI / PM: Fix /proc/acpi/wakeup for devices w/o bus or parent
ACPI / PM: Fix consistency check for power resources during resume
ACPI / PM: Expose lists of device power resources to user space
sysfs: Functions for adding/removing symlinks to/from attribute groups
ACPI / PM: Expose current status of ACPI power resources
ACPI / PM: Expose power states of ACPI devices to user space
ACPI / scan: Prevent device add uevents from racing with user space
ACPI / PM: Fix device power state value after transitions to D3cold
ACPI / PM: Use string "D3cold" to represent ACPI_STATE_D3_COLD
ACPI / PM: Sanitize checks in acpi_power_on_resources()
ACPI / PM: Always evaluate _PSn after setting power resources
ACPI / PM: Introduce helper for executing _PSn methods
ACPI / PM: Make acpi_bus_init_power() more robust
ACPI / PM: Fix build for unusual combination of Kconfig options
ACPI / PM: remove leading whitespace from #ifdef
ACPI / PM: Consolidate suspend-specific and hibernate-specific code
ACPI / PM: Move device power management functions to device_pm.c
...
Diffstat (limited to 'fs')
-rw-r--r-- | fs/sysfs/group.c | 42 | ||||
-rw-r--r-- | fs/sysfs/symlink.c | 45 | ||||
-rw-r--r-- | fs/sysfs/sysfs.h | 2 |
3 files changed, 76 insertions, 13 deletions
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index 2df555c66d57..aec3d5c98c94 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c | |||
@@ -205,6 +205,48 @@ void sysfs_unmerge_group(struct kobject *kobj, | |||
205 | } | 205 | } |
206 | EXPORT_SYMBOL_GPL(sysfs_unmerge_group); | 206 | EXPORT_SYMBOL_GPL(sysfs_unmerge_group); |
207 | 207 | ||
208 | /** | ||
209 | * sysfs_add_link_to_group - add a symlink to an attribute group. | ||
210 | * @kobj: The kobject containing the group. | ||
211 | * @group_name: The name of the group. | ||
212 | * @target: The target kobject of the symlink to create. | ||
213 | * @link_name: The name of the symlink to create. | ||
214 | */ | ||
215 | int sysfs_add_link_to_group(struct kobject *kobj, const char *group_name, | ||
216 | struct kobject *target, const char *link_name) | ||
217 | { | ||
218 | struct sysfs_dirent *dir_sd; | ||
219 | int error = 0; | ||
220 | |||
221 | dir_sd = sysfs_get_dirent(kobj->sd, NULL, group_name); | ||
222 | if (!dir_sd) | ||
223 | return -ENOENT; | ||
224 | |||
225 | error = sysfs_create_link_sd(dir_sd, target, link_name); | ||
226 | sysfs_put(dir_sd); | ||
227 | |||
228 | return error; | ||
229 | } | ||
230 | EXPORT_SYMBOL_GPL(sysfs_add_link_to_group); | ||
231 | |||
232 | /** | ||
233 | * sysfs_remove_link_from_group - remove a symlink from an attribute group. | ||
234 | * @kobj: The kobject containing the group. | ||
235 | * @group_name: The name of the group. | ||
236 | * @link_name: The name of the symlink to remove. | ||
237 | */ | ||
238 | void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name, | ||
239 | const char *link_name) | ||
240 | { | ||
241 | struct sysfs_dirent *dir_sd; | ||
242 | |||
243 | dir_sd = sysfs_get_dirent(kobj->sd, NULL, group_name); | ||
244 | if (dir_sd) { | ||
245 | sysfs_hash_and_remove(dir_sd, NULL, link_name); | ||
246 | sysfs_put(dir_sd); | ||
247 | } | ||
248 | } | ||
249 | EXPORT_SYMBOL_GPL(sysfs_remove_link_from_group); | ||
208 | 250 | ||
209 | EXPORT_SYMBOL_GPL(sysfs_create_group); | 251 | EXPORT_SYMBOL_GPL(sysfs_create_group); |
210 | EXPORT_SYMBOL_GPL(sysfs_update_group); | 252 | EXPORT_SYMBOL_GPL(sysfs_update_group); |
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c index 3c9eb5624f5e..8c940df97a52 100644 --- a/fs/sysfs/symlink.c +++ b/fs/sysfs/symlink.c | |||
@@ -21,26 +21,17 @@ | |||
21 | 21 | ||
22 | #include "sysfs.h" | 22 | #include "sysfs.h" |
23 | 23 | ||
24 | static int sysfs_do_create_link(struct kobject *kobj, struct kobject *target, | 24 | static int sysfs_do_create_link_sd(struct sysfs_dirent *parent_sd, |
25 | const char *name, int warn) | 25 | struct kobject *target, |
26 | const char *name, int warn) | ||
26 | { | 27 | { |
27 | struct sysfs_dirent *parent_sd = NULL; | ||
28 | struct sysfs_dirent *target_sd = NULL; | 28 | struct sysfs_dirent *target_sd = NULL; |
29 | struct sysfs_dirent *sd = NULL; | 29 | struct sysfs_dirent *sd = NULL; |
30 | struct sysfs_addrm_cxt acxt; | 30 | struct sysfs_addrm_cxt acxt; |
31 | enum kobj_ns_type ns_type; | 31 | enum kobj_ns_type ns_type; |
32 | int error; | 32 | int error; |
33 | 33 | ||
34 | BUG_ON(!name); | 34 | BUG_ON(!name || !parent_sd); |
35 | |||
36 | if (!kobj) | ||
37 | parent_sd = &sysfs_root; | ||
38 | else | ||
39 | parent_sd = kobj->sd; | ||
40 | |||
41 | error = -EFAULT; | ||
42 | if (!parent_sd) | ||
43 | goto out_put; | ||
44 | 35 | ||
45 | /* target->sd can go away beneath us but is protected with | 36 | /* target->sd can go away beneath us but is protected with |
46 | * sysfs_assoc_lock. Fetch target_sd from it. | 37 | * sysfs_assoc_lock. Fetch target_sd from it. |
@@ -96,6 +87,34 @@ static int sysfs_do_create_link(struct kobject *kobj, struct kobject *target, | |||
96 | } | 87 | } |
97 | 88 | ||
98 | /** | 89 | /** |
90 | * sysfs_create_link_sd - create symlink to a given object. | ||
91 | * @sd: directory we're creating the link in. | ||
92 | * @target: object we're pointing to. | ||
93 | * @name: name of the symlink. | ||
94 | */ | ||
95 | int sysfs_create_link_sd(struct sysfs_dirent *sd, struct kobject *target, | ||
96 | const char *name) | ||
97 | { | ||
98 | return sysfs_do_create_link_sd(sd, target, name, 1); | ||
99 | } | ||
100 | |||
101 | static int sysfs_do_create_link(struct kobject *kobj, struct kobject *target, | ||
102 | const char *name, int warn) | ||
103 | { | ||
104 | struct sysfs_dirent *parent_sd = NULL; | ||
105 | |||
106 | if (!kobj) | ||
107 | parent_sd = &sysfs_root; | ||
108 | else | ||
109 | parent_sd = kobj->sd; | ||
110 | |||
111 | if (!parent_sd) | ||
112 | return -EFAULT; | ||
113 | |||
114 | return sysfs_do_create_link_sd(parent_sd, target, name, warn); | ||
115 | } | ||
116 | |||
117 | /** | ||
99 | * sysfs_create_link - create symlink between two objects. | 118 | * sysfs_create_link - create symlink between two objects. |
100 | * @kobj: object whose directory we're creating the link in. | 119 | * @kobj: object whose directory we're creating the link in. |
101 | * @target: object we're pointing to. | 120 | * @target: object we're pointing to. |
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index d73c0932bbd6..d1e4043eb0c3 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
@@ -240,3 +240,5 @@ void unmap_bin_file(struct sysfs_dirent *attr_sd); | |||
240 | * symlink.c | 240 | * symlink.c |
241 | */ | 241 | */ |
242 | extern const struct inode_operations sysfs_symlink_inode_operations; | 242 | extern const struct inode_operations sysfs_symlink_inode_operations; |
243 | int sysfs_create_link_sd(struct sysfs_dirent *sd, struct kobject *target, | ||
244 | const char *name); | ||