[PATCH net-next 2/3] net: phy: mediatek: Move some macros to phy-lib for later use

Andrew Lunn andrew at lunn.ch
Sun Jan 19 09:20:17 PST 2025


On Thu, Jan 16, 2025 at 09:21:57AM +0800, Sky Huang wrote:
> From: Sky Huang <skylake.huang at mediatek.com>
> 
> Move some macros to phy-lib because MediaTek's 2.5G built-in
> ethernet PHY will also use them.
> 
> Signed-off-by: Sky Huang <skylake.huang at mediatek.com>
> ---
>  drivers/net/phy/mediatek/mtk-ge.c | 4 ----
>  drivers/net/phy/mediatek/mtk.h    | 4 ++++
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/phy/mediatek/mtk-ge.c b/drivers/net/phy/mediatek/mtk-ge.c
> index 79663da..937254a 100644
> --- a/drivers/net/phy/mediatek/mtk-ge.c
> +++ b/drivers/net/phy/mediatek/mtk-ge.c
> @@ -8,10 +8,6 @@
>  #define MTK_GPHY_ID_MT7530		0x03a29412
>  #define MTK_GPHY_ID_MT7531		0x03a29441
>  
> -#define MTK_PHY_PAGE_EXTENDED_1			0x0001
> -#define MTK_PHY_AUX_CTRL_AND_STATUS		0x14
> -#define   MTK_PHY_ENABLE_DOWNSHIFT		BIT(4)
> -
>  #define MTK_PHY_PAGE_EXTENDED_2			0x0002
>  #define MTK_PHY_PAGE_EXTENDED_3			0x0003
>  #define MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG11	0x11
> diff --git a/drivers/net/phy/mediatek/mtk.h b/drivers/net/phy/mediatek/mtk.h
> index 712a9f0..cda1dc8 100644
> --- a/drivers/net/phy/mediatek/mtk.h
> +++ b/drivers/net/phy/mediatek/mtk.h
> @@ -8,7 +8,11 @@
>  #ifndef _MTK_EPHY_H_
>  #define _MTK_EPHY_H_
>  
> +#define MTK_PHY_AUX_CTRL_AND_STATUS		0x14
> +#define   MTK_PHY_ENABLE_DOWNSHIFT		BIT(4)
> +
>  #define MTK_EXT_PAGE_ACCESS			0x1f
> +#define MTK_PHY_PAGE_EXTENDED_1			0x0001
>  #define MTK_PHY_PAGE_STANDARD			0x0000
>  #define MTK_PHY_PAGE_EXTENDED_52B5		0x52b5

A patch like this i can easily review. I can see somethings removed
from one file and added to another, without any changes. It is
obviously correct, and toke about 10 seconds to review.

Another way to look at this. Say somebody reports your previous patch
breaks their system. How are you going to debug it? If rather than
being one huge patch, it was 10 simpler patches, you could ask them to
run a git bisect. That will narrow down the code where you need to
look for the bug to 1/10 of the code. And that one patch will
hopefully be a lot simpler, making the code inspection to find the
problem a lot simpler....

Reviewed-by: Andrew Lunn <andrew at lunn.ch>

    Andrew



More information about the Linux-mediatek mailing list