Skip to content

Commit e2f81e8

Browse files
committed
net: constify dev pointer in misc instance lock helpers
lockdep asserts and predicates can operate on const pointers. In the future this will let us add asserts in functions which operate on const pointers like dev_get_min_mp_channel_count(). Acked-by: Stanislav Fomichev <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent bae2da8 commit e2f81e8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

include/net/netdev_lock.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,20 @@ static inline bool netdev_trylock(struct net_device *dev)
1111
return mutex_trylock(&dev->lock);
1212
}
1313

14-
static inline void netdev_assert_locked(struct net_device *dev)
14+
static inline void netdev_assert_locked(const struct net_device *dev)
1515
{
1616
lockdep_assert_held(&dev->lock);
1717
}
1818

19-
static inline void netdev_assert_locked_or_invisible(struct net_device *dev)
19+
static inline void
20+
netdev_assert_locked_or_invisible(const struct net_device *dev)
2021
{
2122
if (dev->reg_state == NETREG_REGISTERED ||
2223
dev->reg_state == NETREG_UNREGISTERING)
2324
netdev_assert_locked(dev);
2425
}
2526

26-
static inline bool netdev_need_ops_lock(struct net_device *dev)
27+
static inline bool netdev_need_ops_lock(const struct net_device *dev)
2728
{
2829
bool ret = dev->request_ops_lock || !!dev->queue_mgmt_ops;
2930

@@ -46,7 +47,7 @@ static inline void netdev_unlock_ops(struct net_device *dev)
4647
netdev_unlock(dev);
4748
}
4849

49-
static inline void netdev_ops_assert_locked(struct net_device *dev)
50+
static inline void netdev_ops_assert_locked(const struct net_device *dev)
5051
{
5152
if (netdev_need_ops_lock(dev))
5253
lockdep_assert_held(&dev->lock);

0 commit comments

Comments
 (0)