summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2020-05-23 16:56:17 -0700
committerDavid S. Miller <davem@davemloft.net>2020-05-23 16:56:17 -0700
commitc0096a28588d5a72fa290a74593cf9737c0b1cfb (patch)
treed753232b4b8456e57c5f83bc31aab36c1ac4a1d3 /include
parent54b9aca08c9a141f48beb533ccb9ebcee679e855 (diff)
parent9250dccc119e72aecb0dfa786c94b4d8eb67ea29 (diff)
downloadcachepc-linux-c0096a28588d5a72fa290a74593cf9737c0b1cfb.tar.gz
cachepc-linux-c0096a28588d5a72fa290a74593cf9737c0b1cfb.zip
Merge branch 'net-provide-a-devres-variant-of-register_netdev'
Bartosz Golaszewski says: ==================== net: provide a devres variant of register_netdev() Using devres helpers allows to shrink the probing code, avoid memory leaks in error paths make sure the order in which resources are freed is the exact opposite of their allocation. This series proposes to add a devres variant of register_netdev() that will only work with net_device structures whose memory is also managed. First we add the missing documentation entry for the only other networking devres helper: devm_alloc_etherdev(). Next we move devm_alloc_etherdev() into a separate source file. We then use a proxy structure in devm_alloc_etherdev() to improve readability. Last: we implement devm_register_netdev() and use it in mtk-eth-mac driver. v1 -> v2: - rebase on top of net-next after driver rename, no functional changes ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/netdevice.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a18f8fdf4260..1a96e9c4ec36 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -4280,6 +4280,8 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
int register_netdev(struct net_device *dev);
void unregister_netdev(struct net_device *dev);
+int devm_register_netdev(struct device *dev, struct net_device *ndev);
+
/* General hardware address lists handling functions */
int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
struct netdev_hw_addr_list *from_list, int addr_len);