Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Qingfang Deng and committed by
Jakub Kicinski
eb370113 0e103816

+11
+11
include/linux/netdevice.h
··· 2765 2765 return (void *)dev->priv; 2766 2766 } 2767 2767 2768 + /** 2769 + * netdev_from_priv() - get network device from priv 2770 + * @priv: network device private data 2771 + * 2772 + * Returns: net_device to which @priv belongs 2773 + */ 2774 + static inline struct net_device *netdev_from_priv(const void *priv) 2775 + { 2776 + return container_of(priv, struct net_device, priv); 2777 + } 2778 + 2768 2779 /* Set the sysfs physical device reference for the network logical device 2769 2780 * if set prior to registration will cause a symlink during initialization. 2770 2781 */