From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Sky Huang <SkyLake.Huang@mediatek.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Daniel Golle <daniel@makrotopia.org>,
Qingfang Deng <dqfext@gmail.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
Steven Liu <Steven.Liu@mediatek.com>
Subject: Re: [PATCH net-next 8/9] net: phy: mediatek: Change mtk-ge-soc.c line wrapping
Date: Fri, 4 Oct 2024 13:07:48 +0100 [thread overview]
Message-ID: <Zv_alBqCPvrSzRPL@shell.armlinux.org.uk> (raw)
In-Reply-To: <20241004102413.5838-9-SkyLake.Huang@mediatek.com>
Hi,
On Fri, Oct 04, 2024 at 06:24:12PM +0800, Sky Huang wrote:
> diff --git a/drivers/net/phy/mediatek/mtk-ge-soc.c b/drivers/net/phy/mediatek/mtk-ge-soc.c
> index 26c2183..cb6838b 100644
> --- a/drivers/net/phy/mediatek/mtk-ge-soc.c
> +++ b/drivers/net/phy/mediatek/mtk-ge-soc.c
> @@ -295,7 +295,8 @@ static int cal_cycle(struct phy_device *phydev, int devad,
> ret = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1,
> MTK_PHY_RG_AD_CAL_CLK, reg_val,
> reg_val & MTK_PHY_DA_CAL_CLK, 500,
> - ANALOG_INTERNAL_OPERATION_MAX_US, false);
> + ANALOG_INTERNAL_OPERATION_MAX_US,
> + false);
This is fine.
> if (ret) {
> phydev_err(phydev, "Calibration cycle timeout\n");
> return ret;
> @@ -304,7 +305,7 @@ static int cal_cycle(struct phy_device *phydev, int devad,
> phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_AD_CALIN,
> MTK_PHY_DA_CALIN_FLAG);
> ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_AD_CAL_COMP) >>
> - MTK_PHY_AD_CAL_COMP_OUT_SHIFT;
> + MTK_PHY_AD_CAL_COMP_OUT_SHIFT;
Before cleaning this up, please first make it propagate any error code
correctly (a bug fix):
ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_AD_CAL_COMP);
if (ret < 0)
return ret;
ret >>= MTK_PHY_AD_CAL_COMP_OUT_SHIFT;
and then you won't need to change it in this patch. A better solution to
the shift would be to look at FIELD_GET().
> phydev_dbg(phydev, "cal_val: 0x%x, ret: %d\n", cal_val, ret);
>
> return ret;
> @@ -394,38 +395,46 @@ static int tx_amp_fill_result(struct phy_device *phydev, u16 *buf)
> }
>
> phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TXVLD_DA_RG,
> - MTK_PHY_DA_TX_I2MPB_A_GBE_MASK, (buf[0] + bias[0]) << 10);
> + MTK_PHY_DA_TX_I2MPB_A_GBE_MASK,
> + (buf[0] + bias[0]) << 10);
Another cleanup would be to use FIELD_PREP() for these.
> -static const unsigned long supported_triggers = (BIT(TRIGGER_NETDEV_FULL_DUPLEX) |
> - BIT(TRIGGER_NETDEV_HALF_DUPLEX) |
> - BIT(TRIGGER_NETDEV_LINK) |
> - BIT(TRIGGER_NETDEV_LINK_10) |
> - BIT(TRIGGER_NETDEV_LINK_100) |
> - BIT(TRIGGER_NETDEV_LINK_1000) |
> - BIT(TRIGGER_NETDEV_RX) |
> - BIT(TRIGGER_NETDEV_TX));
> +static const unsigned long supported_triggers =
> + (BIT(TRIGGER_NETDEV_FULL_DUPLEX) |
> + BIT(TRIGGER_NETDEV_HALF_DUPLEX) |
> + BIT(TRIGGER_NETDEV_LINK) |
> + BIT(TRIGGER_NETDEV_LINK_10) |
> + BIT(TRIGGER_NETDEV_LINK_100) |
> + BIT(TRIGGER_NETDEV_LINK_1000) |
> + BIT(TRIGGER_NETDEV_RX) |
> + BIT(TRIGGER_NETDEV_TX));
The outer parens are unnecessary, and thus could be removed.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2024-10-04 12:09 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-04 10:24 [PATCH net-next 0/9] net: phy: mediatek: Introduce mtk-phy-lib which integrates common part of MediaTek's internal ethernet PHYs Sky Huang
2024-10-04 10:24 ` [PATCH net-next 1/9] net: phy: mediatek: Re-organize MediaTek ethernet phy drivers Sky Huang
2024-10-06 21:19 ` Andrew Lunn
2024-10-07 6:38 ` kernel test robot
2024-10-04 10:24 ` [PATCH net-next 2/9] net: phy: mediatek: Fix spelling errors and rearrange variables Sky Huang
2024-10-06 21:20 ` Andrew Lunn
2024-10-04 10:24 ` [PATCH net-next 3/9] net: phy: mediatek: Move LED helper functions into mtk phy lib Sky Huang
2024-10-06 21:28 ` Andrew Lunn
2024-10-07 4:30 ` SkyLake Huang (黃啟澤)
2024-10-07 12:50 ` Andrew Lunn
2024-10-04 10:24 ` [PATCH net-next 4/9] net: phy: mediatek: Improve readability of mtk-phy-lib.c's mtk_phy_led_hw_ctrl_set() Sky Huang
2024-10-06 21:29 ` Andrew Lunn
2024-10-04 10:24 ` [PATCH net-next 5/9] net: phy: mediatek: Integrate read/write page helper functions Sky Huang
2024-10-06 21:29 ` Andrew Lunn
2024-10-04 10:24 ` [PATCH net-next 6/9] net: phy: mediatek: Hook LED helper functions in mtk-ge.c Sky Huang
2024-10-06 21:32 ` Andrew Lunn
2024-10-07 10:43 ` SkyLake Huang (黃啟澤)
2024-10-04 10:24 ` [PATCH net-next 7/9] net: phy: mediatek: add MT7530 & MT7531's PHY ID macros Sky Huang
2024-10-06 21:32 ` Andrew Lunn
2024-10-04 10:24 ` [PATCH net-next 8/9] net: phy: mediatek: Change mtk-ge-soc.c line wrapping Sky Huang
2024-10-04 12:07 ` Russell King (Oracle) [this message]
2024-10-07 10:52 ` SkyLake Huang (黃啟澤)
2024-10-04 10:24 ` [PATCH net-next 9/9] net: phy: mediatek: Add token ring access helper functions in mtk-phy-lib Sky Huang
2024-10-04 22:43 ` [PATCH net-next 0/9] net: phy: mediatek: Introduce mtk-phy-lib which integrates common part of MediaTek's internal ethernet PHYs Jakub Kicinski
2024-10-07 10:59 ` SkyLake Huang (黃啟澤)
2024-10-09 1:48 ` Daniel Golle
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=Zv_alBqCPvrSzRPL@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=SkyLake.Huang@mediatek.com \
--cc=Steven.Liu@mediatek.com \
--cc=andrew@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=dqfext@gmail.com \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).