lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 19 Jun 2024 10:09:53 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Sky Huang <SkyLake.Huang@...iatek.com>
Cc: Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Daniel Golle <daniel@...rotopia.org>,
	Qingfang Deng <dqfext@...il.com>,
	Matthias Brugger <matthias.bgg@...il.com>,
	AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org,
	linux-mediatek@...ts.infradead.org,
	Steven Liu <Steven.Liu@...iatek.com>
Subject: Re: [PATCH net-next v7 5/5] net: phy: add driver for built-in 2.5G
 ethernet PHY on MT7988

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!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ