diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-15 18:05:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-15 18:05:46 -0400 |
commit | e7957ec6b6edf7838c7d7506669ffb6e28ec481b (patch) | |
tree | 91c6c28b6d93b181bd626736d94f79ed59d7a8c8 /fs | |
parent | 59c0b586aebdfff2c79d61139a2f5ea3b6d62675 (diff) | |
parent | 83db93f4de2d9ae441a491d1dc61c2204f0195de (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6:
sysfs: Allow sysfs_notify_dirent to be called from interrupt context.
sysfs: Allow sysfs_move_dir(..., NULL) again.
Diffstat (limited to 'fs')
-rw-r--r-- | fs/sysfs/dir.c | 3 | ||||
-rw-r--r-- | fs/sysfs/file.c | 14 |
2 files changed, 10 insertions, 7 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 0050fc40e8c9..5fad489ce5bc 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -894,7 +894,8 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj) | |||
894 | 894 | ||
895 | mutex_lock(&sysfs_rename_mutex); | 895 | mutex_lock(&sysfs_rename_mutex); |
896 | BUG_ON(!sd->s_parent); | 896 | BUG_ON(!sd->s_parent); |
897 | new_parent_sd = new_parent_kobj->sd ? new_parent_kobj->sd : &sysfs_root; | 897 | new_parent_sd = (new_parent_kobj && new_parent_kobj->sd) ? |
898 | new_parent_kobj->sd : &sysfs_root; | ||
898 | 899 | ||
899 | error = 0; | 900 | error = 0; |
900 | if (sd->s_parent == new_parent_sd) | 901 | if (sd->s_parent == new_parent_sd) |
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 561a9c050cef..f5ea4680f15f 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -268,7 +268,7 @@ static int sysfs_get_open_dirent(struct sysfs_dirent *sd, | |||
268 | struct sysfs_open_dirent *od, *new_od = NULL; | 268 | struct sysfs_open_dirent *od, *new_od = NULL; |
269 | 269 | ||
270 | retry: | 270 | retry: |
271 | spin_lock(&sysfs_open_dirent_lock); | 271 | spin_lock_irq(&sysfs_open_dirent_lock); |
272 | 272 | ||
273 | if (!sd->s_attr.open && new_od) { | 273 | if (!sd->s_attr.open && new_od) { |
274 | sd->s_attr.open = new_od; | 274 | sd->s_attr.open = new_od; |
@@ -281,7 +281,7 @@ static int sysfs_get_open_dirent(struct sysfs_dirent *sd, | |||
281 | list_add_tail(&buffer->list, &od->buffers); | 281 | list_add_tail(&buffer->list, &od->buffers); |
282 | } | 282 | } |
283 | 283 | ||
284 | spin_unlock(&sysfs_open_dirent_lock); | 284 | spin_unlock_irq(&sysfs_open_dirent_lock); |
285 | 285 | ||
286 | if (od) { | 286 | if (od) { |
287 | kfree(new_od); | 287 | kfree(new_od); |
@@ -315,8 +315,9 @@ static void sysfs_put_open_dirent(struct sysfs_dirent *sd, | |||
315 | struct sysfs_buffer *buffer) | 315 | struct sysfs_buffer *buffer) |
316 | { | 316 | { |
317 | struct sysfs_open_dirent *od = sd->s_attr.open; | 317 | struct sysfs_open_dirent *od = sd->s_attr.open; |
318 | unsigned long flags; | ||
318 | 319 | ||
319 | spin_lock(&sysfs_open_dirent_lock); | 320 | spin_lock_irqsave(&sysfs_open_dirent_lock, flags); |
320 | 321 | ||
321 | list_del(&buffer->list); | 322 | list_del(&buffer->list); |
322 | if (atomic_dec_and_test(&od->refcnt)) | 323 | if (atomic_dec_and_test(&od->refcnt)) |
@@ -324,7 +325,7 @@ static void sysfs_put_open_dirent(struct sysfs_dirent *sd, | |||
324 | else | 325 | else |
325 | od = NULL; | 326 | od = NULL; |
326 | 327 | ||
327 | spin_unlock(&sysfs_open_dirent_lock); | 328 | spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags); |
328 | 329 | ||
329 | kfree(od); | 330 | kfree(od); |
330 | } | 331 | } |
@@ -456,8 +457,9 @@ static unsigned int sysfs_poll(struct file *filp, poll_table *wait) | |||
456 | void sysfs_notify_dirent(struct sysfs_dirent *sd) | 457 | void sysfs_notify_dirent(struct sysfs_dirent *sd) |
457 | { | 458 | { |
458 | struct sysfs_open_dirent *od; | 459 | struct sysfs_open_dirent *od; |
460 | unsigned long flags; | ||
459 | 461 | ||
460 | spin_lock(&sysfs_open_dirent_lock); | 462 | spin_lock_irqsave(&sysfs_open_dirent_lock, flags); |
461 | 463 | ||
462 | od = sd->s_attr.open; | 464 | od = sd->s_attr.open; |
463 | if (od) { | 465 | if (od) { |
@@ -465,7 +467,7 @@ void sysfs_notify_dirent(struct sysfs_dirent *sd) | |||
465 | wake_up_interruptible(&od->poll); | 467 | wake_up_interruptible(&od->poll); |
466 | } | 468 | } |
467 | 469 | ||
468 | spin_unlock(&sysfs_open_dirent_lock); | 470 | spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags); |
469 | } | 471 | } |
470 | EXPORT_SYMBOL_GPL(sysfs_notify_dirent); | 472 | EXPORT_SYMBOL_GPL(sysfs_notify_dirent); |
471 | 473 | ||