Skip to content

Commit 05b9380

Browse files
Matthew WilcoxKAGA-KOKO
authored andcommitted
lockdep: Convert some users to const
These users of lockdep_is_held() either wanted lockdep_is_held to take a const pointer, or would benefit from providing a const pointer. Signed-off-by: Matthew Wilcox <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Cc: "David S. Miller" <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 08f36ff commit 05b9380

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

include/linux/backing-dev.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ static inline bool inode_to_wb_is_valid(struct inode *inode)
332332
* holding either @inode->i_lock, @inode->i_mapping->tree_lock, or the
333333
* associated wb's list_lock.
334334
*/
335-
static inline struct bdi_writeback *inode_to_wb(struct inode *inode)
335+
static inline struct bdi_writeback *inode_to_wb(const struct inode *inode)
336336
{
337337
#ifdef CONFIG_LOCKDEP
338338
WARN_ON_ONCE(debug_locks &&

include/linux/srcu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void synchronize_srcu(struct srcu_struct *sp);
9292
* relies on normal RCU, it can be called from the CPU which
9393
* is in the idle loop from an RCU point of view or offline.
9494
*/
95-
static inline int srcu_read_lock_held(struct srcu_struct *sp)
95+
static inline int srcu_read_lock_held(const struct srcu_struct *sp)
9696
{
9797
if (!debug_lockdep_rcu_enabled())
9898
return 1;
@@ -101,7 +101,7 @@ static inline int srcu_read_lock_held(struct srcu_struct *sp)
101101

102102
#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
103103

104-
static inline int srcu_read_lock_held(struct srcu_struct *sp)
104+
static inline int srcu_read_lock_held(const struct srcu_struct *sp)
105105
{
106106
return 1;
107107
}

include/net/sock.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,10 +1445,8 @@ do { \
14451445
} while (0)
14461446

14471447
#ifdef CONFIG_LOCKDEP
1448-
static inline bool lockdep_sock_is_held(const struct sock *csk)
1448+
static inline bool lockdep_sock_is_held(const struct sock *sk)
14491449
{
1450-
struct sock *sk = (struct sock *)csk;
1451-
14521450
return lockdep_is_held(&sk->sk_lock) ||
14531451
lockdep_is_held(&sk->sk_lock.slock);
14541452
}

0 commit comments

Comments
 (0)