[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aNkFDGQwm-qkgkvV@shell.armlinux.org.uk>
Date: Sun, 28 Sep 2025 10:51:08 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Andrew Lunn <andrew@...n.ch>
Cc: netdev@...r.kernel.org, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Richard Cochran <richardcochran@...il.com>,
Vladimir Oltean <olteanv@...il.com>
Subject: Re: [PATCH RFC net-next 11/20] net: dsa: mv88e6xxx: split out EXTTS
pin setup
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@...n.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!
Powered by blists - more mailing lists