From: Roger Quadros <rogerq@kernel.org>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Siddharth Vadapalli <s-vadapalli@ti.com>,
srk@ti.com, danishanwar@ti.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH net-next 2/4] net: ethernet: ti: am65-cpsw: streamline .probe() error handling
Date: Thu, 16 Jan 2025 14:07:40 +0200 [thread overview]
Message-ID: <c0a72a9a-3c1e-4bdf-9647-6cb9d962fad7@kernel.org> (raw)
In-Reply-To: <Z4ga6N7brU1FrQzx@shell.armlinux.org.uk>
On 15/01/2025 22:30, Russell King (Oracle) wrote:
> On Wed, Jan 15, 2025 at 06:43:01PM +0200, Roger Quadros wrote:
>> Keep things simple by explicitly cleaning up on .probe() error
>> path or .remove(). Get rid of devm_add/remove_action() usage.
>>
>> Rename am65_cpsw_disable_serdes_phy() to
>> am65_cpsw_nuss_cleanup_slave_ports() and move it right before
>> am65_cpsw_nuss_init_slave_ports().
>>
>> Get rid of am65_cpsw_nuss_phylink_cleanup() and introduce
>> am65_cpsw_nuss_cleanup_ndevs() right before am65_cpsw_nuss_init_ndevs()
>>
>> Move channel initiailzation code out of am65_cpsw_nuss_register_ndevs()
>> into new function am65_cpsw_nuss_init_chns().
>> Add am65_cpsw_nuss_remove_chns() to do reverse of
>> am65_cpsw_nuss_init_chns().
>>
>> Add am65_cpsw_nuss_unregister_ndev() to do reverse of
>> am65_cpsw_nuss_register_ndevs().
>>
>> Use the introduced helpers in probe/remove.
>
> Wow, so we're now saying that devm shouldn't be used? Given that patch 1
No. We're not getting rid of all devm_ users in the driver, just the case
for am65_cpsw_nuss_free_rx/tx_chns(). I'll explain below.
> is wrong, I'm not sure I'd trust this patch to be correct either as it
> goes against what I understand is preferred - to avoid explicit cleanups
> that can get in the wrong order or be missed.
>
In this particular case, we had to repeatedly call devm_remove/add_action()
on am65_cpsw_nuss_free_rx/tx_chns() at multiple places as number of channel
can be changed at runtime.
I thought it would be easier to keep track of the cleanup than to keep track
of devm_remove/add_action().
Another motivation for doing so was this paragraph found in
Documentation/process/maintainer-netdev.rst:
|Netdev remains skeptical about promises of all "auto-cleanup" APIs,
|including even ``devm_`` helpers, historically. They are not the preferred
|style of implementation, merely an acceptable one.
--
cheers,
-roger
next prev parent reply other threads:[~2025-01-16 12:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 16:42 [PATCH net-next 0/4] net: ethernet: ti: am65-cpsw: streamline RX/TX queue creation and cleanup Roger Quadros
2025-01-15 16:43 ` [PATCH net-next 1/4] net: ethernet: am65-cpsw: call netif_carrier_on/off() when appropriate Roger Quadros
2025-01-15 17:13 ` Maxime Chevallier
2025-01-16 11:49 ` Roger Quadros
2025-01-15 20:28 ` Russell King (Oracle)
2025-01-15 16:43 ` [PATCH net-next 2/4] net: ethernet: ti: am65-cpsw: streamline .probe() error handling Roger Quadros
2025-01-15 20:30 ` Russell King (Oracle)
2025-01-16 12:07 ` Roger Quadros [this message]
2025-01-17 0:49 ` Jakub Kicinski
2025-01-15 16:43 ` [PATCH net-next 3/4] net: ethernet: ti: am65-cpsw: streamline RX queue creation and cleanup Roger Quadros
2025-01-15 16:43 ` [PATCH net-next 4/4] net: ethernet: ti: am65-cpsw: streamline TX " Roger Quadros
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c0a72a9a-3c1e-4bdf-9647-6cb9d962fad7@kernel.org \
--to=rogerq@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=s-vadapalli@ti.com \
--cc=srk@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox