linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v2 4/5] net: devres: provide devm_register_netdev()
@ 2020-05-23 14:34 Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2020-05-23 14:34 UTC (permalink / raw)
  To: Bartosz Golaszewski, devicetree, linux-arm-kernel,
	linux-mediatek, netdev
  Cc: Edwin Peer, kernel-janitors, Stephane Le Provost, Arnd Bergmann,
	Jonathan Corbet, Pedro Tsai, Sean Wang, Fabien Parent,
	linux-kernel, Mark Lee, Bartosz Golaszewski, Andrew Perepech,
	John Crispin, Matthias Brugger, Jakub Kicinski, David S. Miller,
	Heiner Kallweit

…
> +++ b/net/devres.c
> @@ -38,3 +38,58 @@ struct net_device *devm_alloc_etherdev_mqs(struct device *dev, int sizeof_priv,
> + *	This is a devres variant of register_netdev() for which the unregister
> + *	function will be call automatically when the managing device is

Is the following wording variant more appropriate?

+ *	function will be automatically called when the managing device is


Regards,
Markus

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [PATCH v2 0/5] net: provide a devres variant of register_netdev()
@ 2020-05-23 13:27 Bartosz Golaszewski
  2020-05-23 13:27 ` [PATCH v2 4/5] net: devres: provide devm_register_netdev() Bartosz Golaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: Bartosz Golaszewski @ 2020-05-23 13:27 UTC (permalink / raw)
  To: Jonathan Corbet, David S . Miller, Matthias Brugger,
	John Crispin, Sean Wang, Mark Lee, Jakub Kicinski, Arnd Bergmann,
	Fabien Parent, Heiner Kallweit, Edwin Peer
  Cc: devicetree, Stephane Le Provost, netdev, linux-kernel,
	Bartosz Golaszewski, linux-mediatek, Andrew Perepech, Pedro Tsai,
	linux-arm-kernel

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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

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_star_emac: use devm_register_netdev()

 .../driver-api/driver-model/devres.rst        |  5 +
 drivers/net/ethernet/mediatek/mtk_star_emac.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

-- 
2.25.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-23 17:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-23 14:34 [PATCH v2 4/5] net: devres: provide devm_register_netdev() Markus Elfring
  -- strict thread matches above, loose matches on Subject: below --
2020-05-23 13:27 [PATCH v2 0/5] net: provide a devres variant of register_netdev() Bartosz Golaszewski
2020-05-23 13:27 ` [PATCH v2 4/5] net: devres: provide devm_register_netdev() Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).