[PATCH net-next v7 5/5] net: phy: add driver for built-in 2.5G ethernet PHY on MT7988

Russell King (Oracle) linux at armlinux.org.uk
Wed Jun 19 02:09:53 PDT 2024


On Thu, Jun 13, 2024 at 06:40:23PM +0800, Sky Huang wrote:
> +static const unsigned long supported_triggers =
> +	(BIT(TRIGGER_NETDEV_FULL_DUPLEX) |
> +	 BIT(TRIGGER_NETDEV_LINK)        |
> +	 BIT(TRIGGER_NETDEV_LINK_10)     |
> +	 BIT(TRIGGER_NETDEV_LINK_100)    |
> +	 BIT(TRIGGER_NETDEV_LINK_1000)   |
> +	 BIT(TRIGGER_NETDEV_LINK_2500)   |
> +	 BIT(TRIGGER_NETDEV_RX)          |
> +	 BIT(TRIGGER_NETDEV_TX));

Absolutely no need for the outer parens around this.

type foo assignment-operator expr;

There is no reason to ever put parens around expr in this kind of thing.
assignment-operator are things like =, |=, &=, <<=, >>=, and so forth.

Excessive parens detracts from readability, and leads to mistakes. If
operator precedence is a worry, then knowing the common C precedence
rules rather than littering code with extra parens would be good so
that code can remain readable.

> +static struct phy_driver mtk_gephy_driver[] = {
> +	{
> +		PHY_ID_MATCH_MODEL(MTK_2P5GPHY_ID_MT7988),
> +		.name		= "MediaTek MT7988 2.5GbE PHY",
> +		.probe		= mt798x_2p5ge_phy_probe,
> +		.config_init	= mt798x_2p5ge_phy_config_init,
> +		.config_aneg    = mt798x_2p5ge_phy_config_aneg,
> +		.get_features	= mt798x_2p5ge_phy_get_features,
> +		.read_status	= mt798x_2p5ge_phy_read_status,
> +		.get_rate_matching	= mt798x_2p5ge_phy_get_rate_matching,
> +		.suspend	= genphy_suspend,
> +		.resume		= genphy_resume,
> +		.read_page	= mtk_phy_read_page,
> +		.write_page	= mtk_phy_write_page,
> +		.led_blink_set	= mt798x_2p5ge_phy_led_blink_set,
> +		.led_brightness_set = mt798x_2p5ge_phy_led_brightness_set,
> +		.led_hw_is_supported = mt798x_2p5ge_phy_led_hw_is_supported,
> +		.led_hw_control_get = mt798x_2p5ge_phy_led_hw_control_get,
> +		.led_hw_control_set = mt798x_2p5ge_phy_led_hw_control_set,

I don't see the point of trying to align some of these method
declarators but not others. Consistency is important.

I know several PHY drivers do this, this will be because new methods
with longer names have been added over time, and to reformat the
tables of every driver would be noise. However, new implementations
should at least make an effort to have consistency.

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!



More information about the Linux-mediatek mailing list