aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaiman Long <longman@redhat.com>2017-01-19 09:31:52 -0500
committerIngo Molnar <mingo@kernel.org>2017-01-20 03:46:44 -0500
commit06321dd2d1ae5b5bdc847958ab9e71d22a29a33e (patch)
treed0d84edbcf13c7ca73a759c575cf30c4bc007509
parent85b36c931ff328297572a3e6136fac573795ad79 (diff)
locking/rwsem: Remove unnecessary atomic_long_t casts
Since sem->count had been changed to a atomic_long_t type, it is no longer necessary to use the atomic_long_t cast anymore. So remove them. Signed-off-by: Waiman Long <longman@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-arch@vger.kernel.org Link: http://lkml.kernel.org/r/1484836312-6656-1-git-send-email-longman@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--include/asm-generic/rwsem.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/include/asm-generic/rwsem.h b/include/asm-generic/rwsem.h
index 5be122e3d326..6c6a2141f271 100644
--- a/include/asm-generic/rwsem.h
+++ b/include/asm-generic/rwsem.h
@@ -33,7 +33,7 @@
33 */ 33 */
34static inline void __down_read(struct rw_semaphore *sem) 34static inline void __down_read(struct rw_semaphore *sem)
35{ 35{
36 if (unlikely(atomic_long_inc_return_acquire((atomic_long_t *)&sem->count) <= 0)) 36 if (unlikely(atomic_long_inc_return_acquire(&sem->count) <= 0))
37 rwsem_down_read_failed(sem); 37 rwsem_down_read_failed(sem);
38} 38}
39 39
@@ -58,7 +58,7 @@ static inline void __down_write(struct rw_semaphore *sem)
58 long tmp; 58 long tmp;
59 59
60 tmp = atomic_long_add_return_acquire(RWSEM_ACTIVE_WRITE_BIAS, 60 tmp = atomic_long_add_return_acquire(RWSEM_ACTIVE_WRITE_BIAS,
61 (atomic_long_t *)&sem->count); 61 &sem->count);
62 if (unlikely(tmp != RWSEM_ACTIVE_WRITE_BIAS)) 62 if (unlikely(tmp != RWSEM_ACTIVE_WRITE_BIAS))
63 rwsem_down_write_failed(sem); 63 rwsem_down_write_failed(sem);
64} 64}
@@ -68,7 +68,7 @@ static inline int __down_write_killable(struct rw_semaphore *sem)
68 long tmp; 68 long tmp;
69 69
70 tmp = atomic_long_add_return_acquire(RWSEM_ACTIVE_WRITE_BIAS, 70 tmp = atomic_long_add_return_acquire(RWSEM_ACTIVE_WRITE_BIAS,
71 (atomic_long_t *)&sem->count); 71 &sem->count);
72 if (unlikely(tmp != RWSEM_ACTIVE_WRITE_BIAS)) 72 if (unlikely(tmp != RWSEM_ACTIVE_WRITE_BIAS))
73 if (IS_ERR(rwsem_down_write_failed_killable(sem))) 73 if (IS_ERR(rwsem_down_write_failed_killable(sem)))
74 return -EINTR; 74 return -EINTR;
@@ -91,7 +91,7 @@ static inline void __up_read(struct rw_semaphore *sem)
91{ 91{
92 long tmp; 92 long tmp;
93 93
94 tmp = atomic_long_dec_return_release((atomic_long_t *)&sem->count); 94 tmp = atomic_long_dec_return_release(&sem->count);
95 if (unlikely(tmp < -1 && (tmp & RWSEM_ACTIVE_MASK) == 0)) 95 if (unlikely(tmp < -1 && (tmp & RWSEM_ACTIVE_MASK) == 0))
96 rwsem_wake(sem); 96 rwsem_wake(sem);
97} 97}
@@ -102,7 +102,7 @@ static inline void __up_read(struct rw_semaphore *sem)
102static inline void __up_write(struct rw_semaphore *sem) 102static inline void __up_write(struct rw_semaphore *sem)
103{ 103{
104 if (unlikely(atomic_long_sub_return_release(RWSEM_ACTIVE_WRITE_BIAS, 104 if (unlikely(atomic_long_sub_return_release(RWSEM_ACTIVE_WRITE_BIAS,
105 (atomic_long_t *)&sem->count) < 0)) 105 &sem->count) < 0))
106 rwsem_wake(sem); 106 rwsem_wake(sem);
107} 107}
108 108
@@ -120,8 +120,7 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
120 * read-locked region is ok to be re-ordered into the 120 * read-locked region is ok to be re-ordered into the
121 * write side. As such, rely on RELEASE semantics. 121 * write side. As such, rely on RELEASE semantics.
122 */ 122 */
123 tmp = atomic_long_add_return_release(-RWSEM_WAITING_BIAS, 123 tmp = atomic_long_add_return_release(-RWSEM_WAITING_BIAS, &sem->count);
124 (atomic_long_t *)&sem->count);
125 if (tmp < 0) 124 if (tmp < 0)
126 rwsem_downgrade_wake(sem); 125 rwsem_downgrade_wake(sem);
127} 126}