diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-22 19:02:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-22 19:02:13 -0400 |
commit | 5d4e2d08e7fdf7339f84a1c670d296a77e02f881 (patch) | |
tree | 1c419660defa56191091dfdf50fdb57a72009173 /fs | |
parent | fb2123fad3b499f0898835b19dbb93b18d27ee98 (diff) | |
parent | 94ca629e40eb7e997be21d8065c25e4f3797b03f (diff) |
Merge tag 'driver-core-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core updates from Greg Kroah-Hartman:
"Here's the driver core, and other driver subsystems, pull request for
the 3.5-rc1 merge window.
Outside of a few minor driver core changes, we ended up with the
following different subsystem and core changes as well, due to
interdependancies on the driver core:
- hyperv driver updates
- drivers/memory being created and some drivers moved into it
- extcon driver subsystem created out of the old Android staging
switch driver code
- dynamic debug updates
- printk rework, and /dev/kmsg changes
All of this has been tested in the linux-next releases for a few weeks
with no reported problems.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
Fix up conflicts in drivers/extcon/extcon-max8997.c where git noticed
that a patch to the deleted drivers/misc/max8997-muic.c driver needs to
be applied to this one.
* tag 'driver-core-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (90 commits)
uio_pdrv_genirq: get irq through platform resource if not set otherwise
memory: tegra{20,30}-mc: Remove empty *_remove()
printk() - isolate KERN_CONT users from ordinary complete lines
sysfs: get rid of some lockdep false positives
Drivers: hv: util: Properly handle version negotiations.
Drivers: hv: Get rid of an unnecessary check in vmbus_prep_negotiate_resp()
memory: tegra{20,30}-mc: Use dev_err_ratelimited()
driver core: Add dev_*_ratelimited() family
Driver Core: don't oops with unregistered driver in driver_find_device()
printk() - restore prefix/timestamp printing for multi-newline strings
printk: add stub for prepend_timestamp()
ARM: tegra30: Make MC optional in Kconfig
ARM: tegra20: Make MC optional in Kconfig
ARM: tegra30: MC: Remove unnecessary BUG*()
ARM: tegra20: MC: Remove unnecessary BUG*()
printk: correctly align __log_buf
ARM: tegra30: Add Tegra Memory Controller(MC) driver
ARM: tegra20: Add Tegra Memory Controller(MC) driver
printk() - restore timestamp printing at console output
printk() - do not merge continuation lines of different threads
...
Diffstat (limited to 'fs')
-rw-r--r-- | fs/sysfs/dir.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 35a36d39fa2c..e6bb9b2a4cbe 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -132,6 +132,24 @@ static void sysfs_unlink_sibling(struct sysfs_dirent *sd) | |||
132 | rb_erase(&sd->s_rb, &sd->s_parent->s_dir.children); | 132 | rb_erase(&sd->s_rb, &sd->s_parent->s_dir.children); |
133 | } | 133 | } |
134 | 134 | ||
135 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
136 | |||
137 | /* Test for attributes that want to ignore lockdep for read-locking */ | ||
138 | static bool ignore_lockdep(struct sysfs_dirent *sd) | ||
139 | { | ||
140 | return sysfs_type(sd) == SYSFS_KOBJ_ATTR && | ||
141 | sd->s_attr.attr->ignore_lockdep; | ||
142 | } | ||
143 | |||
144 | #else | ||
145 | |||
146 | static inline bool ignore_lockdep(struct sysfs_dirent *sd) | ||
147 | { | ||
148 | return true; | ||
149 | } | ||
150 | |||
151 | #endif | ||
152 | |||
135 | /** | 153 | /** |
136 | * sysfs_get_active - get an active reference to sysfs_dirent | 154 | * sysfs_get_active - get an active reference to sysfs_dirent |
137 | * @sd: sysfs_dirent to get an active reference to | 155 | * @sd: sysfs_dirent to get an active reference to |
@@ -155,15 +173,17 @@ struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd) | |||
155 | return NULL; | 173 | return NULL; |
156 | 174 | ||
157 | t = atomic_cmpxchg(&sd->s_active, v, v + 1); | 175 | t = atomic_cmpxchg(&sd->s_active, v, v + 1); |
158 | if (likely(t == v)) { | 176 | if (likely(t == v)) |
159 | rwsem_acquire_read(&sd->dep_map, 0, 1, _RET_IP_); | 177 | break; |
160 | return sd; | ||
161 | } | ||
162 | if (t < 0) | 178 | if (t < 0) |
163 | return NULL; | 179 | return NULL; |
164 | 180 | ||
165 | cpu_relax(); | 181 | cpu_relax(); |
166 | } | 182 | } |
183 | |||
184 | if (likely(!ignore_lockdep(sd))) | ||
185 | rwsem_acquire_read(&sd->dep_map, 0, 1, _RET_IP_); | ||
186 | return sd; | ||
167 | } | 187 | } |
168 | 188 | ||
169 | /** | 189 | /** |
@@ -180,7 +200,8 @@ void sysfs_put_active(struct sysfs_dirent *sd) | |||
180 | if (unlikely(!sd)) | 200 | if (unlikely(!sd)) |
181 | return; | 201 | return; |
182 | 202 | ||
183 | rwsem_release(&sd->dep_map, 1, _RET_IP_); | 203 | if (likely(!ignore_lockdep(sd))) |
204 | rwsem_release(&sd->dep_map, 1, _RET_IP_); | ||
184 | v = atomic_dec_return(&sd->s_active); | 205 | v = atomic_dec_return(&sd->s_active); |
185 | if (likely(v != SD_DEACTIVATED_BIAS)) | 206 | if (likely(v != SD_DEACTIVATED_BIAS)) |
186 | return; | 207 | return; |
@@ -858,7 +879,6 @@ int sysfs_rename(struct sysfs_dirent *sd, | |||
858 | struct sysfs_dirent *new_parent_sd, const void *new_ns, | 879 | struct sysfs_dirent *new_parent_sd, const void *new_ns, |
859 | const char *new_name) | 880 | const char *new_name) |
860 | { | 881 | { |
861 | const char *dup_name = NULL; | ||
862 | int error; | 882 | int error; |
863 | 883 | ||
864 | mutex_lock(&sysfs_mutex); | 884 | mutex_lock(&sysfs_mutex); |
@@ -875,11 +895,11 @@ int sysfs_rename(struct sysfs_dirent *sd, | |||
875 | /* rename sysfs_dirent */ | 895 | /* rename sysfs_dirent */ |
876 | if (strcmp(sd->s_name, new_name) != 0) { | 896 | if (strcmp(sd->s_name, new_name) != 0) { |
877 | error = -ENOMEM; | 897 | error = -ENOMEM; |
878 | new_name = dup_name = kstrdup(new_name, GFP_KERNEL); | 898 | new_name = kstrdup(new_name, GFP_KERNEL); |
879 | if (!new_name) | 899 | if (!new_name) |
880 | goto out; | 900 | goto out; |
881 | 901 | ||
882 | dup_name = sd->s_name; | 902 | kfree(sd->s_name); |
883 | sd->s_name = new_name; | 903 | sd->s_name = new_name; |
884 | } | 904 | } |
885 | 905 | ||
@@ -895,7 +915,6 @@ int sysfs_rename(struct sysfs_dirent *sd, | |||
895 | error = 0; | 915 | error = 0; |
896 | out: | 916 | out: |
897 | mutex_unlock(&sysfs_mutex); | 917 | mutex_unlock(&sysfs_mutex); |
898 | kfree(dup_name); | ||
899 | return error; | 918 | return error; |
900 | } | 919 | } |
901 | 920 | ||