[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ffec02336023660b69441336e248a57b7027e9a4.camel@microchip.com>
Date: Tue, 9 Jul 2024 03:14:39 +0000
From: <Arun.Ramadoss@...rochip.com>
To: <enguerrand.de-ribaucourt@...oirfairelinux.com>, <netdev@...r.kernel.org>
CC: <Tristram.Ha@...rochip.com>, <andrew@...n.ch>, <linux@...linux.org.uk>,
<hkallweit1@...il.com>, <Woojung.Huh@...rochip.com>, <kuba@...nel.org>,
<horms@...nel.org>, <UNGLinuxDriver@...rochip.com>
Subject: Re: [PATCH net-next] net: dsa: microchip: ksz9477: split half-duplex
monitoring function
On Mon, 2024-07-08 at 10:49 +0200, Enguerrand de Ribaucourt wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> In order to respect the 80 columns limit, split the half-duplex
> monitoring function in two.
>
> This is just a styling change, no functional change.
>
> Fixes: bf1bff11e497 ("net: dsa: microchip: monitor potential faults
> in half-duplex mode")
No need fixes tag for targetting net-next tree.
> Signed-off-by: Enguerrand de Ribaucourt <
> enguerrand.de-ribaucourt@...oirfairelinux.com>
> ---
> drivers/net/dsa/microchip/ksz9477.c | 87 +++++++++++++++++--------
> ----
> 1 file changed, 50 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/net/dsa/microchip/ksz9477.c
> b/drivers/net/dsa/microchip/ksz9477.c
> index 425e20daf1e9..17f6deb3c598 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c
> @@ -427,54 +427,67 @@ void ksz9477_freeze_mib(struct ksz_device *dev,
> int port, bool freeze)
> mutex_unlock(&p->mib.cnt_mutex);
> }
>
> -int ksz9477_errata_monitor(struct ksz_device *dev, int port,
> - u64 tx_late_col)
> +static int ksz9477_half_duplex_monitor(struct ksz_device *dev, int
> port,
> + u64 tx_late_col)
> {
>
> +
> - if (status & SW_VLAN_ENABLE) {
> - ret = ksz_pread16(dev, port,
> REG_PORT_QM_TX_CNT_0__4, &pqm);
> - if (ret)
> - return ret;
> - ret = ksz_read32(dev, REG_PMAVBC, &pmavbc);
> - if (ret)
> - return ret;
> - if ((FIELD_GET(PMAVBC_MASK, pmavbc) <=
> PMAVBC_MIN) ||
> - (FIELD_GET(PORT_QM_TX_CNT_M, pqm) >=
> PORT_QM_TX_CNT_MAX)) {
> - /* Transmission halt with Half-Duplex
> and VLAN */
> - dev_crit_once(dev->dev,
> - "resources out of
> limits, transmission may be halted\n");
> - }
> + ret = ksz_read32(dev, REG_PMAVBC, &pmavbc);
> + if (ret)
> + return ret;
To increase readability, have a line break between code blocks like
after return statements.
> + if ((FIELD_GET(PMAVBC_MASK, pmavbc) <= PMAVBC_MIN) ||
> + (FIELD_GET(PORT_QM_TX_CNT_M, pqm) >=
> PORT_QM_TX_CNT_MAX)) {
> + /* Transmission halt with Half-Duplex and
> VLAN */
> + dev_crit_once(dev->dev,
> + "resources out of limits,
> transmission may be halted\n");
> }
> }
> +
> + return ret;
> +}
> +
> +int ksz9477_errata_monitor(struct ksz_device *dev, int port,
> + u64 tx_late_col)
> +{
> + u8 status;
> + int ret;
> +
> + ret = ksz_pread8(dev, port, REG_PORT_STATUS_0, &status);
> + if (ret)
> + return ret;
Line break
> + if (!(FIELD_GET(PORT_INTF_SPEED_MASK, status)
> + == PORT_INTF_SPEED_NONE) &&
> + !(status & PORT_INTF_FULL_DUPLEX)) {
> + ret = ksz9477_half_duplex_monitor(dev, port,
> tx_late_col);
> + }
> return ret;
> }
>
> --
> 2.34.1
>
Powered by blists - more mailing lists