summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/sfc/efx.h
diff options
context:
space:
mode:
authorEdward Cree <ecree@solarflare.com>2016-06-15 17:43:43 +0100
committerDavid S. Miller <davem@davemloft.net>2016-06-15 22:26:25 -0700
commitdd98708cf6a7981ad5bc23b1e10c548689482ef7 (patch)
treefcd520dc48e6eccc891ff98703a9fd0acb8248e6 /drivers/net/ethernet/sfc/efx.h
parentebfcd0fd90b88088e4d3841c4be9a8c5753d3993 (diff)
downloadlwn-dd98708cf6a7981ad5bc23b1e10c548689482ef7.tar.gz
lwn-dd98708cf6a7981ad5bc23b1e10c548689482ef7.zip
sfc: Assert filter_sem write locked when required
Based on a patch by Andrew Rybchenko <Andrew.Rybchenko@oktetlabs.ru> Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sfc/efx.h')
-rw-r--r--drivers/net/ethernet/sfc/efx.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/efx.h
index 5e3f93f04e62..c3ae739e9c7a 100644
--- a/drivers/net/ethernet/sfc/efx.h
+++ b/drivers/net/ethernet/sfc/efx.h
@@ -274,4 +274,13 @@ static inline void efx_device_detach_sync(struct efx_nic *efx)
netif_tx_unlock_bh(dev);
}
+static inline bool efx_rwsem_assert_write_locked(struct rw_semaphore *sem)
+{
+ if (WARN_ON(down_read_trylock(sem))) {
+ up_read(sem);
+ return false;
+ }
+ return true;
+}
+
#endif /* EFX_EFX_H */