From: Christian Marangi <ansuelsmth@gmail.com>
To: "Michael Hennerich" <michael.hennerich@analog.com>,
"Andrew Lunn" <andrew@lunn.ch>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Florian Fainelli" <florian.fainelli@broadcom.com>,
"Broadcom internal kernel review list"
<bcm-kernel-feedback-list@broadcom.com>,
"Ray Jui" <rjui@broadcom.com>,
"Scott Branden" <sbranden@broadcom.com>,
"Richard Cochran" <richardcochran@gmail.com>,
"Marek Behún" <kabel@kernel.org>,
"Daniel Golle" <daniel@makrotopia.org>,
"Qingfang Deng" <dqfext@gmail.com>,
"SkyLake Huang" <SkyLake.Huang@mediatek.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Kevin Hilman" <khilman@baylibre.com>,
"Jerome Brunet" <jbrunet@baylibre.com>,
"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
"Arun Ramadoss" <arun.ramadoss@microchip.com>,
UNGLinuxDriver@microchip.com, "Peter Geis" <pgwipeout@gmail.com>,
Frank <Frank.Sae@motor-comm.com>, "Xu Liang" <lxu@maxlinear.com>,
"Piergiorgio Beruto" <piergiorgio.beruto@gmail.com>,
"Andrei Botila" <andrei.botila@oss.nxp.com>,
"Bjorn Andersson" <andersson@kernel.org>,
"Konrad Dybcio" <konrad.dybcio@linaro.org>,
"Heiko Stuebner" <heiko@sntech.de>,
"Michal Simek" <michal.simek@amd.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Wedson Almeida Filho" <wedsonaf@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@samsung.com>,
"Alice Ryhl" <aliceryhl@google.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Christian Marangi" <ansuelsmth@gmail.com>,
"Robert Marko" <robimarko@gmail.com>,
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
"Vladimir Oltean" <vladimir.oltean@nxp.com>,
"David Epping" <david.epping@missinglinkelectronics.com>,
"Harini Katakam" <harini.katakam@amd.com>,
"Simon Horman" <horms@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org,
linux-rockchip@lists.infradead.org,
rust-for-linux@vger.kernel.org,
linux-mediatek@lists.infradead.org
Subject: [net-next RFC PATCH 3/3] net: phy: bcm7xxx: use common OPs for PHYs where possible
Date: Sat, 17 Feb 2024 20:41:14 +0100 [thread overview]
Message-ID: <20240217194116.8565-4-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20240217194116.8565-1-ansuelsmth@gmail.com>
Group common OPs for PHY, make them static and reference these
statically link OPs table instead of duplicating them for each PHY.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/phy/bcm7xxx.c | 80 +++++++++++++++++++++------------------
1 file changed, 44 insertions(+), 36 deletions(-)
diff --git a/drivers/net/phy/bcm7xxx.c b/drivers/net/phy/bcm7xxx.c
index c820a94b30a4..adfe364846dd 100644
--- a/drivers/net/phy/bcm7xxx.c
+++ b/drivers/net/phy/bcm7xxx.c
@@ -840,6 +840,17 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev)
return ret;
}
+static const struct phy_driver_ops bcm7xxx_28nm_gpy_ops = {
+ .config_init = bcm7xxx_28nm_config_init,
+ .resume = bcm7xxx_28nm_resume,
+ .get_tunable = bcm7xxx_28nm_get_tunable,
+ .set_tunable = bcm7xxx_28nm_set_tunable,
+ .get_sset_count = bcm_phy_get_sset_count,
+ .get_strings = bcm_phy_get_strings,
+ .get_stats = bcm7xxx_28nm_get_phy_stats,
+ .probe = bcm7xxx_28nm_probe,
+};
+
#define BCM7XXX_28NM_GPHY(_oui, _name) \
{ \
.phy_id = (_oui), \
@@ -847,18 +858,20 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev)
.name = _name, \
/* PHY_GBIT_FEATURES */ \
.flags = PHY_IS_INTERNAL, \
- .ops = &(const struct phy_driver_ops){ \
- .config_init = bcm7xxx_28nm_config_init, \
- .resume = bcm7xxx_28nm_resume, \
- .get_tunable = bcm7xxx_28nm_get_tunable, \
- .set_tunable = bcm7xxx_28nm_set_tunable, \
- .get_sset_count = bcm_phy_get_sset_count, \
- .get_strings = bcm_phy_get_strings, \
- .get_stats = bcm7xxx_28nm_get_phy_stats, \
- .probe = bcm7xxx_28nm_probe, \
- }, \
+ .ops = &bcm7xxx_28nm_gpy_ops, \
}
+static const struct phy_driver_ops bcm7xxx_28nm_ephy_ops = {
+ .config_init = bcm7xxx_28nm_ephy_config_init,
+ .resume = bcm7xxx_28nm_ephy_resume,
+ .get_sset_count = bcm_phy_get_sset_count,
+ .get_strings = bcm_phy_get_strings,
+ .get_stats = bcm7xxx_28nm_get_phy_stats,
+ .probe = bcm7xxx_28nm_probe,
+ .read_mmd = bcm7xxx_28nm_ephy_read_mmd,
+ .write_mmd = bcm7xxx_28nm_ephy_write_mmd,
+};
+
#define BCM7XXX_28NM_EPHY(_oui, _name) \
{ \
.phy_id = (_oui), \
@@ -866,18 +879,16 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev)
.name = _name, \
/* PHY_BASIC_FEATURES */ \
.flags = PHY_IS_INTERNAL, \
- .ops = &(const struct phy_driver_ops){ \
- .config_init = bcm7xxx_28nm_ephy_config_init, \
- .resume = bcm7xxx_28nm_ephy_resume, \
- .get_sset_count = bcm_phy_get_sset_count, \
- .get_strings = bcm_phy_get_strings, \
- .get_stats = bcm7xxx_28nm_get_phy_stats, \
- .probe = bcm7xxx_28nm_probe, \
- .read_mmd = bcm7xxx_28nm_ephy_read_mmd, \
- .write_mmd = bcm7xxx_28nm_ephy_write_mmd, \
- }, \
+ .ops = &bcm7xxx_28nm_ephy_ops, \
}
+static const struct phy_driver_ops bcm7xxx_40nm_ephy_ops = {
+ .soft_reset = genphy_soft_reset,
+ .config_init = bcm7xxx_config_init,
+ .suspend = bcm7xxx_suspend,
+ .resume = bcm7xxx_config_init,
+};
+
#define BCM7XXX_40NM_EPHY(_oui, _name) \
{ \
.phy_id = (_oui), \
@@ -885,14 +896,20 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev)
.name = _name, \
/* PHY_BASIC_FEATURES */ \
.flags = PHY_IS_INTERNAL, \
- .ops = &(const struct phy_driver_ops){ \
- .soft_reset = genphy_soft_reset, \
- .config_init = bcm7xxx_config_init, \
- .suspend = bcm7xxx_suspend, \
- .resume = bcm7xxx_config_init, \
- }, \
+ .ops = &bcm7xxx_40nm_ephy_ops, \
}
+static const struct phy_driver_ops bcm7xxx_16nm_ephy_ops = {
+ .get_sset_count = bcm_phy_get_sset_count,
+ .get_strings = bcm_phy_get_strings,
+ .get_stats = bcm7xxx_28nm_get_phy_stats,
+ .probe = bcm7xxx_28nm_probe,
+ .config_init = bcm7xxx_16nm_ephy_config_init,
+ .config_aneg = genphy_config_aneg,
+ .read_status = genphy_read_status,
+ .resume = bcm7xxx_16nm_ephy_resume,
+};
+
#define BCM7XXX_16NM_EPHY(_oui, _name) \
{ \
.phy_id = (_oui), \
@@ -900,16 +917,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev)
.name = _name, \
/* PHY_BASIC_FEATURES */ \
.flags = PHY_IS_INTERNAL, \
- .ops = &(const struct phy_driver_ops){ \
- .get_sset_count = bcm_phy_get_sset_count, \
- .get_strings = bcm_phy_get_strings, \
- .get_stats = bcm7xxx_28nm_get_phy_stats, \
- .probe = bcm7xxx_28nm_probe, \
- .config_init = bcm7xxx_16nm_ephy_config_init, \
- .config_aneg = genphy_config_aneg, \
- .read_status = genphy_read_status, \
- .resume = bcm7xxx_16nm_ephy_resume, \
- }, \
+ .ops = &bcm7xxx_16nm_ephy_ops, \
}
static struct phy_driver bcm7xxx_driver[] = {
--
2.43.0
next prev parent reply other threads:[~2024-02-17 19:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-17 19:41 [net-next RFC PATCH 0/3] net: phy: detach PHY driver OPs from phy_driver struct Christian Marangi
2024-02-17 19:41 ` [net-next RFC PATCH 1/3] " Christian Marangi
2024-02-17 19:41 ` [net-next RFC PATCH 2/3] net: phy: aquantia: use common OPs for PHYs where possible Christian Marangi
2024-02-17 19:41 ` Christian Marangi [this message]
2024-02-17 19:53 ` [net-next RFC PATCH 0/3] net: phy: detach PHY driver OPs from phy_driver struct Russell King (Oracle)
2024-02-17 23:22 ` Christian Marangi
2024-02-18 12:39 ` Russell King (Oracle)
2024-02-17 22:21 ` Andrew Lunn
2024-02-17 23:27 ` Christian Marangi
2024-02-17 23:48 ` Andrew Lunn
2024-02-17 22:37 ` Trevor Gross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240217194116.8565-4-ansuelsmth@gmail.com \
--to=ansuelsmth@gmail.com \
--cc=Frank.Sae@motor-comm.com \
--cc=SkyLake.Huang@mediatek.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=a.hindborg@samsung.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=andersson@kernel.org \
--cc=andrei.botila@oss.nxp.com \
--cc=andrew@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=arun.ramadoss@microchip.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=david.epping@missinglinkelectronics.com \
--cc=dqfext@gmail.com \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=gary@garyguo.net \
--cc=harini.katakam@amd.com \
--cc=heiko@sntech.de \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=jbrunet@baylibre.com \
--cc=kabel@kernel.org \
--cc=khilman@baylibre.com \
--cc=konrad.dybcio@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=lxu@maxlinear.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=matthias.bgg@gmail.com \
--cc=michael.hennerich@analog.com \
--cc=michal.simek@amd.com \
--cc=neil.armstrong@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=pabeni@redhat.com \
--cc=pgwipeout@gmail.com \
--cc=piergiorgio.beruto@gmail.com \
--cc=richardcochran@gmail.com \
--cc=rjui@broadcom.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=robimarko@gmail.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=sbranden@broadcom.com \
--cc=vladimir.oltean@nxp.com \
--cc=wedsonaf@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).