From: Paolo Abeni <pabeni@redhat.com>
To: "Csókás Bence" <csokas.bence@prolan.hu>,
"Wei Fang" <wei.fang@nxp.com>, "Frank Li" <frank.li@nxp.com>
Cc: Shenwei Wang <shenwei.wang@nxp.com>,
Clark Wang <xiaoning.wang@nxp.com>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Richard Cochran <richardcochran@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
"imx@lists.linux.dev" <imx@lists.linux.dev>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net 1/2] net: fec: Restart PPS after link state change
Date: Tue, 1 Oct 2024 11:20:49 +0200 [thread overview]
Message-ID: <998a4b7e-8d29-4702-87fb-726117369240@redhat.com> (raw)
In-Reply-To: <6be53466-fd53-44e9-b83a-b714737865dc@prolan.hu>
On 9/30/24 10:20, Csókás Bence wrote:
> On 2024. 09. 25. 6:37, Wei Fang wrote:
>>> +/* Restore PTP functionality after a reset */ void
>>> +fec_ptp_restore_state(struct fec_enet_private *fep) {
>>> + unsigned long flags;
>>> +
>>> + spin_lock_irqsave(&fep->tmreg_lock, flags);
>>> +
>>> + /* Reset turned it off, so adjust our status flag */
>>> + fep->pps_enable = 0;
>>> +
>>> + spin_unlock_irqrestore(&fep->tmreg_lock, flags);
>>> +
>>> + /* Restart PPS if needed */
>>> + if (fep->ptp_saved_state.pps_enable) {
>>
>> It's better to put " fep->pps_enable = 0" here so that it does
>> not need to be set when PPS is disabled.
>
> It doesn't hurt to set it to 0 when it's already 0, and it saves us
> having to unlock separately in the if {} and else blocks. Plus, after
> reset, PPS will be turned off unconditionally, since the actual HW gets
> reset.
I agree with Csókás, the proposed code looks simpler and more readable.
I'm applying this.
Thanks!
Paolo
next prev parent reply other threads:[~2024-10-01 9:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-24 9:37 [PATCH net 1/2] net: fec: Restart PPS after link state change Csókás, Bence
2024-09-24 9:37 ` [PATCH net 2/2] net: fec: Reload PTP registers after link-state change Csókás, Bence
2024-09-25 5:22 ` Wei Fang
2024-10-07 16:49 ` Guenter Roeck
2024-10-08 5:49 ` Wei Fang
2024-09-25 4:37 ` [PATCH net 1/2] net: fec: Restart PPS after link state change Wei Fang
2024-09-30 8:20 ` Csókás Bence
2024-10-01 9:20 ` Paolo Abeni [this message]
2024-10-01 9:30 ` patchwork-bot+netdevbpf
-- strict thread matches above, loose matches on Subject: below --
2024-09-23 9:23 Csókás, Bence
2024-09-23 10:41 ` Wei Fang
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=998a4b7e-8d29-4702-87fb-726117369240@redhat.com \
--to=pabeni@redhat.com \
--cc=csokas.bence@prolan.hu \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=frank.li@nxp.com \
--cc=imx@lists.linux.dev \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=shenwei.wang@nxp.com \
--cc=wei.fang@nxp.com \
--cc=xiaoning.wang@nxp.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