[PATCH net v3] net: dsa: mt7530: fix impossible MDIO address and issue warning

Jakub Kicinski kuba at kernel.org
Wed Jul 3 19:13:08 PDT 2024


On Wed, 3 Jul 2024 00:44:28 +0100 Daniel Golle wrote:
> +	/* The corrected address is calculated as stated below:
> +	 * 0~6   -> 31
> +	 * 8~14  -> 7
> +	 * 16~22 -> 15
> +	 * 24~30 -> 23
> +	 */
> +return ((((phy_addr - MT7530_NUM_PORTS) & ~MT7530_NUM_PORTS) % PHY_MAX_ADDR) +
> +	MT7530_NUM_PORTS) & (PHY_MAX_ADDR - 1);

nit: the return statement lacks indentation

but also based on the comment, isn't it:

	return (round_down(phy_addr, MT7530_NUM_PORTS + 1) - 1)	& (PHY_MAX_ADDR - 1);

?
-- 
pw-bot: cr



More information about the linux-arm-kernel mailing list