diff options
Diffstat (limited to 'fs/sysfs/file.c')
-rw-r--r-- | fs/sysfs/file.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 74e3478d9cb4..a68cbef3a674 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -851,7 +851,13 @@ static unsigned int kernfs_file_poll(struct file *filp, poll_table *wait) | |||
851 | return DEFAULT_POLLMASK|POLLERR|POLLPRI; | 851 | return DEFAULT_POLLMASK|POLLERR|POLLPRI; |
852 | } | 852 | } |
853 | 853 | ||
854 | void sysfs_notify_dirent(struct sysfs_dirent *sd) | 854 | /** |
855 | * kernfs_notify - notify a kernfs file | ||
856 | * @sd: file to notify | ||
857 | * | ||
858 | * Notify @sd such that poll(2) on @sd wakes up. | ||
859 | */ | ||
860 | void kernfs_notify(struct sysfs_dirent *sd) | ||
855 | { | 861 | { |
856 | struct sysfs_open_dirent *od; | 862 | struct sysfs_open_dirent *od; |
857 | unsigned long flags; | 863 | unsigned long flags; |
@@ -868,22 +874,27 @@ void sysfs_notify_dirent(struct sysfs_dirent *sd) | |||
868 | 874 | ||
869 | spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags); | 875 | spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags); |
870 | } | 876 | } |
871 | EXPORT_SYMBOL_GPL(sysfs_notify_dirent); | 877 | EXPORT_SYMBOL_GPL(kernfs_notify); |
872 | 878 | ||
873 | void sysfs_notify(struct kobject *k, const char *dir, const char *attr) | 879 | void sysfs_notify(struct kobject *k, const char *dir, const char *attr) |
874 | { | 880 | { |
875 | struct sysfs_dirent *sd = k->sd; | 881 | struct sysfs_dirent *sd = k->sd, *tmp; |
876 | |||
877 | mutex_lock(&sysfs_mutex); | ||
878 | 882 | ||
879 | if (sd && dir) | 883 | if (sd && dir) |
880 | sd = sysfs_find_dirent(sd, dir, NULL); | 884 | sd = sysfs_get_dirent(sd, dir); |
881 | if (sd && attr) | 885 | else |
882 | sd = sysfs_find_dirent(sd, attr, NULL); | 886 | sysfs_get(sd); |
883 | if (sd) | ||
884 | sysfs_notify_dirent(sd); | ||
885 | 887 | ||
886 | mutex_unlock(&sysfs_mutex); | 888 | if (sd && attr) { |
889 | tmp = sysfs_get_dirent(sd, attr); | ||
890 | sysfs_put(sd); | ||
891 | sd = tmp; | ||
892 | } | ||
893 | |||
894 | if (sd) { | ||
895 | kernfs_notify(sd); | ||
896 | sysfs_put(sd); | ||
897 | } | ||
887 | } | 898 | } |
888 | EXPORT_SYMBOL_GPL(sysfs_notify); | 899 | EXPORT_SYMBOL_GPL(sysfs_notify); |
889 | 900 | ||