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]
Message-ID: <20240218190034.15447-6-ansuelsmth@gmail.com>
Date: Sun, 18 Feb 2024 20:00:31 +0100
From: Christian Marangi <ansuelsmth@...il.com>
To: Andrew Lunn <andrew@...n.ch>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Russell King <linux@...linux.org.uk>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	Florian Fainelli <florian.fainelli@...adcom.com>,
	Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
	Christian Marangi <ansuelsmth@...il.com>,
	Robert Marko <robimarko@...il.com>,
	"Russell King (Oracle)" <rmk+kernel@...linux.org.uk>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@....com>,
	Nipun Gupta <nipun.gupta@....com>,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	Puneet Gupta <puneet.gupta@....com>,
	Abhijit Gangurde <abhijit.gangurde@....com>,
	Umang Jain <umang.jain@...asonboard.com>,
	netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [net-next RFC PATCH 5/6] net: phy: aquantia: group common OPs for PHYs where possible

Group common OPS for PHY where possible by defining multiple PHYs for
similar PHY drivers instead of duplicating them for each PHY.

Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
---
 drivers/net/phy/aquantia/aquantia_main.c | 170 +++++++++--------------
 1 file changed, 64 insertions(+), 106 deletions(-)

diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c
index a6a7980585f5..4a788fc8e26a 100644
--- a/drivers/net/phy/aquantia/aquantia_main.c
+++ b/drivers/net/phy/aquantia/aquantia_main.c
@@ -770,16 +770,26 @@ static int aqr111_config_init(struct phy_device *phydev)
 
 static struct phy_driver aqr_driver[] = {
 {
-	PHY_ID_MATCH_MODEL(PHY_ID_AQ1202),
-	.name		= "Aquantia AQ1202",
-	.config_aneg    = aqr_config_aneg,
-	.config_intr	= aqr_config_intr,
-	.handle_interrupt = aqr_handle_interrupt,
-	.read_status	= aqr_read_status,
-},
-{
-	PHY_ID_MATCH_MODEL(PHY_ID_AQ2104),
-	.name		= "Aquantia AQ2104",
+	.name		= "Aquantia AQ1202/AQ2104/AQR106/AQR405",
+	.ids		= (const struct mdio_device_id []){
+		{
+			PHY_ID_MATCH_MODEL(PHY_ID_AQ1202),
+			.name		= "Aquantia AQ1202"
+		},
+		{
+			PHY_ID_MATCH_MODEL(PHY_ID_AQ2104),
+			.name           = "Aquantia AQ2104",
+		},
+		{
+			PHY_ID_MATCH_MODEL(PHY_ID_AQR106),
+			.name           = "Aquantia AQR106",
+		},
+		{
+			PHY_ID_MATCH_MODEL(PHY_ID_AQR405),
+			.name           = "Aquantia AQR405",
+		},
+		{ /* sentinel */ },
+	},
 	.config_aneg    = aqr_config_aneg,
 	.config_intr	= aqr_config_intr,
 	.handle_interrupt = aqr_handle_interrupt,
@@ -796,16 +806,22 @@ static struct phy_driver aqr_driver[] = {
 	.resume		= aqr107_resume,
 },
 {
-	PHY_ID_MATCH_MODEL(PHY_ID_AQR106),
-	.name		= "Aquantia AQR106",
-	.config_aneg    = aqr_config_aneg,
-	.config_intr	= aqr_config_intr,
-	.handle_interrupt = aqr_handle_interrupt,
-	.read_status	= aqr_read_status,
-},
-{
-	PHY_ID_MATCH_MODEL(PHY_ID_AQR107),
-	.name		= "Aquantia AQR107",
+	.name		= "Aquantia AQR107/AQR112/AQR412",
+	.ids		= (const struct mdio_device_id []){
+		{
+			PHY_ID_MATCH_MODEL(PHY_ID_AQR107),
+			.name		= "Aquantia AQR107"
+		},
+		{
+			PHY_ID_MATCH_MODEL(PHY_ID_AQR112),
+			.name           = "Aquantia AQR112",
+		},
+		{
+			PHY_ID_MATCH_MODEL(PHY_ID_AQR412),
+			.name           = "Aquantia AQR412",
+		},
+		{ /* sentinel */ },
+	},
 	.probe		= aqr107_probe,
 	.get_rate_matching = aqr107_get_rate_matching,
 	.config_init	= aqr107_config_init,
@@ -842,27 +858,22 @@ static struct phy_driver aqr_driver[] = {
 	.link_change_notify = aqr107_link_change_notify,
 },
 {
-	PHY_ID_MATCH_MODEL(PHY_ID_AQR111),
-	.name		= "Aquantia AQR111",
-	.probe		= aqr107_probe,
-	.get_rate_matching = aqr107_get_rate_matching,
-	.config_init	= aqr111_config_init,
-	.config_aneg    = aqr_config_aneg,
-	.config_intr	= aqr_config_intr,
-	.handle_interrupt = aqr_handle_interrupt,
-	.read_status	= aqr107_read_status,
-	.get_tunable    = aqr107_get_tunable,
-	.set_tunable    = aqr107_set_tunable,
-	.suspend	= aqr107_suspend,
-	.resume		= aqr107_resume,
-	.get_sset_count	= aqr107_get_sset_count,
-	.get_strings	= aqr107_get_strings,
-	.get_stats	= aqr107_get_stats,
-	.link_change_notify = aqr107_link_change_notify,
-},
-{
-	PHY_ID_MATCH_MODEL(PHY_ID_AQR111B0),
-	.name		= "Aquantia AQR111B0",
+	.name		= "Aquantia AQR111/AQR111B0",
+	.ids		= (const struct mdio_device_id []){
+		{
+			PHY_ID_MATCH_MODEL(PHY_ID_AQR111),
+			.name		= "Aquantia AQR111"
+		},
+		{
+			PHY_ID_MATCH_MODEL(PHY_ID_AQR111B0),
+			.name           = "Aquantia AQR111B0",
+		},
+		{
+			PHY_ID_MATCH_MODEL(PHY_ID_AQR106),
+			.name           = "Aquantia AQR106",
+		},
+		{ /* sentinel */ },
+	},
 	.probe		= aqr107_probe,
 	.get_rate_matching = aqr107_get_rate_matching,
 	.config_init	= aqr111_config_init,
@@ -880,71 +891,18 @@ static struct phy_driver aqr_driver[] = {
 	.link_change_notify = aqr107_link_change_notify,
 },
 {
-	PHY_ID_MATCH_MODEL(PHY_ID_AQR405),
-	.name		= "Aquantia AQR405",
-	.config_aneg    = aqr_config_aneg,
-	.config_intr	= aqr_config_intr,
-	.handle_interrupt = aqr_handle_interrupt,
-	.read_status	= aqr_read_status,
-},
-{
-	PHY_ID_MATCH_MODEL(PHY_ID_AQR112),
-	.name		= "Aquantia AQR112",
-	.probe		= aqr107_probe,
-	.config_aneg    = aqr_config_aneg,
-	.config_intr	= aqr_config_intr,
-	.handle_interrupt = aqr_handle_interrupt,
-	.get_tunable    = aqr107_get_tunable,
-	.set_tunable    = aqr107_set_tunable,
-	.suspend	= aqr107_suspend,
-	.resume		= aqr107_resume,
-	.read_status	= aqr107_read_status,
-	.get_rate_matching = aqr107_get_rate_matching,
-	.get_sset_count = aqr107_get_sset_count,
-	.get_strings	= aqr107_get_strings,
-	.get_stats	= aqr107_get_stats,
-	.link_change_notify = aqr107_link_change_notify,
-},
-{
-	PHY_ID_MATCH_MODEL(PHY_ID_AQR412),
-	.name		= "Aquantia AQR412",
-	.probe		= aqr107_probe,
-	.config_aneg    = aqr_config_aneg,
-	.config_intr	= aqr_config_intr,
-	.handle_interrupt = aqr_handle_interrupt,
-	.get_tunable    = aqr107_get_tunable,
-	.set_tunable    = aqr107_set_tunable,
-	.suspend	= aqr107_suspend,
-	.resume		= aqr107_resume,
-	.read_status	= aqr107_read_status,
-	.get_rate_matching = aqr107_get_rate_matching,
-	.get_sset_count = aqr107_get_sset_count,
-	.get_strings	= aqr107_get_strings,
-	.get_stats	= aqr107_get_stats,
-	.link_change_notify = aqr107_link_change_notify,
-},
-{
-	PHY_ID_MATCH_MODEL(PHY_ID_AQR113),
-	.name		= "Aquantia AQR113",
-	.probe          = aqr107_probe,
-	.get_rate_matching = aqr107_get_rate_matching,
-	.config_init    = aqr113c_config_init,
-	.config_aneg    = aqr_config_aneg,
-	.config_intr    = aqr_config_intr,
-	.handle_interrupt       = aqr_handle_interrupt,
-	.read_status    = aqr107_read_status,
-	.get_tunable    = aqr107_get_tunable,
-	.set_tunable    = aqr107_set_tunable,
-	.suspend        = aqr107_suspend,
-	.resume         = aqr107_resume,
-	.get_sset_count = aqr107_get_sset_count,
-	.get_strings    = aqr107_get_strings,
-	.get_stats      = aqr107_get_stats,
-	.link_change_notify = aqr107_link_change_notify,
-},
-{
-	PHY_ID_MATCH_MODEL(PHY_ID_AQR113C),
-	.name           = "Aquantia AQR113C",
+	.name		= "Aquantia AQR113/AQR113C",
+	.ids		= (const struct mdio_device_id []){
+		{
+			PHY_ID_MATCH_MODEL(PHY_ID_AQR113),
+			.name		= "Aquantia AQR113"
+		},
+		{
+			PHY_ID_MATCH_MODEL(PHY_ID_AQR113C),
+			.name           = "Aquantia AQR113C",
+		},
+		{ /* sentinel */ },
+	},
 	.probe          = aqr107_probe,
 	.get_rate_matching = aqr107_get_rate_matching,
 	.config_init    = aqr113c_config_init,
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ