All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Richard Cochran <richardcochran@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>
Subject: Re: [PATCH RFC net-next 11/20] net: dsa: mv88e6xxx: split out EXTTS pin setup
Date: Sun, 28 Sep 2025 10:51:08 +0100	[thread overview]
Message-ID: <aNkFDGQwm-qkgkvV@shell.armlinux.org.uk> (raw)
In-Reply-To: <eabf052b-02a0-4440-b0f7-c831d9ebaa23@lunn.ch>

On Thu, Sep 18, 2025 at 10:59:07PM +0200, Andrew Lunn wrote:
> >  static const struct mv88e6xxx_cc_coeffs *
> >  mv88e6xxx_cc_coeff_get(struct mv88e6xxx_chip *chip)
> >  {
> > @@ -352,27 +366,18 @@ static int mv88e6352_ptp_enable_extts(struct mv88e6xxx_chip *chip,
> >  		return -EBUSY;
> >  
> >  	mv88e6xxx_reg_lock(chip);
> > +	err = mv88e6352_ptp_pin_setup(chip, pin, PTP_PF_EXTTS, on);
> >  
> > -	if (on) {
> > -		func = MV88E6352_G2_SCRATCH_GPIO_PCTL_EVREQ;
> > -
> > -		err = mv88e6352_set_gpio_func(chip, pin, func, true);
> > -		if (err)
> > -			goto out;
> > -
> > +	if (!on) {
> 
> Inverting the if () makes this a little bit harder to review. But it
> does remove a goto. I probably would of kept the code in the same
> order. But:
> 
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>

It's not the goto, but:

	if (on && !err) {
                schedule_delayed_work(&chip->tai_event_work,
                                      TAI_EVENT_WORK_INTERVAL);

                err = mv88e6352_config_eventcap(chip, rising);
	} else if (!on) {
                /* Always cancel the work, even if an error occurs */
                cancel_delayed_work_sync(&chip->tai_event_work);
	}

would be the alternative, which is IMHO less readable, and more
error-prone. However, there is an issue that if
mv88e6352_config_eventcap() returns an error, we leave the work
scheduled. So maybe:

	if (on && !err) {
                schedule_delayed_work(&chip->tai_event_work,
                                      TAI_EVENT_WORK_INTERVAL);

                err = mv88e6352_config_eventcap(chip, rising);
	}

	if (!on || err) {
                /* Always cancel the work, even if an error occurs */
                cancel_delayed_work_sync(&chip->tai_event_work);
	}

which is more difficult to get one's head around.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2025-09-28  9:51 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-18 17:38 [PATCH RFC net-next 00/20] Marvell PTP stuffs Russell King (Oracle)
2025-09-18 17:38 ` [PATCH RFC net-next 01/20] ptp: marvell: add core support for Marvell PTP Russell King
2025-09-18 17:39 ` [PATCH RFC net-next 02/20] net: phy: add hwtstamp_get() method for mii timestampers Russell King (Oracle)
2025-09-18 20:38   ` Andrew Lunn
2025-09-18 17:39 ` [PATCH RFC net-next 03/20] net: phy: marvell: add PHY PTP support Russell King
2025-09-18 20:12   ` Andrew Lunn
2025-09-18 20:33     ` Russell King (Oracle)
2025-09-19  1:47       ` Andrew Lunn
2025-09-18 17:39 ` [PATCH RFC net-next 04/20] net: dsa: mv88e6xxx: split out set_ptp_cpu_port() code Russell King (Oracle)
2025-09-18 20:46   ` Andrew Lunn
2025-09-18 17:39 ` [PATCH RFC net-next 05/20] net: dsa: mv88e6xxx: convert PTP clock_read() method to take chip Russell King (Oracle)
2025-09-18 20:13   ` Andrew Lunn
2025-09-18 17:39 ` [PATCH RFC net-next 06/20] net: dsa: mv88e6xxx: convert PTP ptp_verify() " Russell King (Oracle)
2025-09-18 20:48   ` Andrew Lunn
2025-09-18 17:39 ` [PATCH RFC net-next 07/20] net: dsa: mv88e6xxx: convert PTP ptp_enable() " Russell King (Oracle)
2025-09-18 20:48   ` Andrew Lunn
2025-09-18 17:39 ` [PATCH RFC net-next 08/20] net: dsa: mv88e6xxx: convert mv88e6xxx_hwtstamp_work() " Russell King (Oracle)
2025-09-18 20:51   ` Andrew Lunn
2025-09-18 17:39 ` [PATCH RFC net-next 09/20] net: dsa: mv88e6xxx: always verify PTP_PF_NONE Russell King (Oracle)
2025-09-18 20:14   ` Andrew Lunn
2025-09-18 17:39 ` [PATCH RFC net-next 10/20] net: dsa: mv88e6xxx: only support EXTTS for pins Russell King (Oracle)
2025-09-19 11:29   ` Vadim Fedorenko
2025-09-19 13:50     ` Russell King (Oracle)
2025-09-18 17:39 ` [PATCH RFC net-next 11/20] net: dsa: mv88e6xxx: split out EXTTS pin setup Russell King (Oracle)
2025-09-18 20:59   ` Andrew Lunn
2025-09-28  9:51     ` Russell King (Oracle) [this message]
2025-09-18 17:39 ` [PATCH RFC net-next 12/20] net: dsa: mv88e6xxx: move EXTTS flag validation and pin lookup Russell King (Oracle)
2025-09-18 17:39 ` [PATCH RFC net-next 13/20] net: dsa: mv88e6xxx: convert to marvell TAI Russell King (Oracle)
2025-09-18 17:40 ` [PATCH RFC net-next 14/20] net: dsa: mv88e6xxx: convert mv88e6xxx_cc_coeffs to marvell_tai_param Russell King (Oracle)
2025-09-18 17:40 ` [PATCH RFC net-next 15/20] net: dsa: mv88e6xxx: allow generic core to configure global regs Russell King (Oracle)
2025-09-18 17:40 ` [PATCH RFC net-next 16/20] net: dsa: mv88e6xxx: add beginnings of generic Marvell PTP ts layer Russell King (Oracle)
2025-09-18 17:40 ` [PATCH RFC net-next 17/20] net: dsa: mv88e6xxx: switch tx timestamping to core Russell King (Oracle)
2025-09-18 17:40 ` [PATCH RFC net-next 18/20] net: dsa: mv88e6xxx: switch rx " Russell King (Oracle)
2025-09-18 17:40 ` [PATCH RFC net-next 19/20] net: dsa: mv88e6xxx: switch hwtstamp config to core XXX Fix 6165 Russell King (Oracle)
2025-09-18 17:40 ` [PATCH RFC net-next 20/20] net: dsa: mv88e6xxx: add ptp irq support Russell King (Oracle)

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=aNkFDGQwm-qkgkvV@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.