Message ID | 20200520114415.13041-1-brgl@bgdev.pl |
---|---|
Headers | show |
Series | net: provide a devres variant of register_netdev() | expand |
From: Bartosz Golaszewski <brgl@bgdev.pl> Date: Wed, 20 May 2020 13:44:10 +0200 > net: ethernet: mtk_eth_mac: use devm_register_netdev() This patch doesn't apply to net-next. Neither the source file drivers/net/ethernet/mediatek/mtk_eth_mac.c, nor the function mtk_mac_probe() even exist in the net-next GIT tree.
sob., 23 maj 2020 o 00:36 David Miller <davem@davemloft.net> napisaĆ(a): > > From: Bartosz Golaszewski <brgl@bgdev.pl> > Date: Wed, 20 May 2020 13:44:10 +0200 > > > net: ethernet: mtk_eth_mac: use devm_register_netdev() > > This patch doesn't apply to net-next. > > Neither the source file drivers/net/ethernet/mediatek/mtk_eth_mac.c, > nor the function mtk_mac_probe() even exist in the net-next GIT > tree. Indeed. The driver got renamed in v5. I didn't resend a new version of this series because I thought there would be a discussion about its usefulness. I'll send a rebased version then. Bartosz
From: Bartosz Golaszewski <bgolaszewski@baylibre.com> This series applies on top of my mtk-eth-mac series[1]. 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. [1] https://lkml.org/lkml/2020/5/20/507 Bartosz Golaszewski (5): Documentation: devres: add a missing section for networking helpers net: move devres helpers into a separate source file net: devres: define a separate devres structure for devm_alloc_etherdev() net: devres: provide devm_register_netdev() net: ethernet: mtk_eth_mac: use devm_register_netdev() .../driver-api/driver-model/devres.rst | 5 + drivers/net/ethernet/mediatek/mtk_eth_mac.c | 17 +--- include/linux/netdevice.h | 2 + net/Makefile | 2 +- net/devres.c | 95 +++++++++++++++++++ net/ethernet/eth.c | 28 ------ 6 files changed, 104 insertions(+), 45 deletions(-) create mode 100644 net/devres.c