mirror of
https://github.com/torvalds/linux.git
synced 2026-08-02 13:22:02 +02:00
net: add netdev_from_priv() helper
Add a helper to get netdev from private data pointer, so drivers won't have to store redundant netdev in priv. Signed-off-by: Qingfang Deng <dqfext@gmail.com> Link: https://patch.msgid.link/20260320075605.490832-1-dqfext@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
0e10381626
commit
eb37011395
|
|
@ -2765,6 +2765,17 @@ static inline void *netdev_priv(const struct net_device *dev)
|
|||
return (void *)dev->priv;
|
||||
}
|
||||
|
||||
/**
|
||||
* netdev_from_priv() - get network device from priv
|
||||
* @priv: network device private data
|
||||
*
|
||||
* Returns: net_device to which @priv belongs
|
||||
*/
|
||||
static inline struct net_device *netdev_from_priv(const void *priv)
|
||||
{
|
||||
return container_of(priv, struct net_device, priv);
|
||||
}
|
||||
|
||||
/* Set the sysfs physical device reference for the network logical device
|
||||
* if set prior to registration will cause a symlink during initialization.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user