rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 0/3] net: phy: detach PHY driver OPs from phy_driver struct
Date: Sat, 17 Feb 2024 20:41:11 +0100	[thread overview]
Message-ID: <20240217194116.8565-1-ansuelsmth@gmail.com> (raw)

Posting as RFC due to the massive change to a fundamental struct.

While adding some PHY ID for Aquantia, I notice that there is a
big problem with duplicating OPs with each PHY.

The original idea to prevent this was to use mask on the PHY ID
and identify PHY Family. Problem is that OEM started to use all
kind of PHY ID and this is not doable, hence for PHY that have
the same OPs, we have to duplicate all of them.

This is present in Aquantia PHY, but is much more present in
other PHY, especially in the BCM7XXX where they use a big macro
for common PHYs.

To reduce patch delta, I added the additional variable without
adding tabs as this would have resulted in a massive patch.
Also to have patch bisectable, this change has to be in one go
hence I had to use this trick to reduce patch delta.

Other solution to this problem were to introduce additional
variables to phy_driver struct but that would have resulted
in having 2 different way to do the same thing and that is not O.K.

I took care to compile-test all the PHY, only exception is the unique
RUST driver, where I still have to learn that funny language and
I didn't had time to update it, so that is the only driver that
I think require some fixup.

I posted 2 example that would benefits from this change, but I can
find much more in other PHY driver.

Christian Marangi (3):
  net: phy: detach PHY driver OPs from phy_driver struct
  net: phy: aquantia: use common OPs for PHYs where possible
  net: phy: bcm7xxx: use common OPs for PHYs where possible

 drivers/net/phy/adin.c                   |   4 +
 drivers/net/phy/adin1100.c               |   2 +
 drivers/net/phy/amd.c                    |   4 +
 drivers/net/phy/aquantia/aquantia_main.c | 189 +++++++++--------------
 drivers/net/phy/ax88796b.c               |   6 +
 drivers/net/phy/bcm-cygnus.c             |   4 +
 drivers/net/phy/bcm54140.c               |   2 +
 drivers/net/phy/bcm63xx.c                |   4 +
 drivers/net/phy/bcm7xxx.c                |  72 +++++----
 drivers/net/phy/bcm84881.c               |   2 +
 drivers/net/phy/bcm87xx.c                |   4 +
 drivers/net/phy/broadcom.c               |  42 +++++
 drivers/net/phy/cicada.c                 |   4 +
 drivers/net/phy/cortina.c                |   2 +
 drivers/net/phy/davicom.c                |   8 +
 drivers/net/phy/dp83640.c                |   2 +
 drivers/net/phy/dp83822.c                |   8 +-
 drivers/net/phy/dp83848.c                |   2 +
 drivers/net/phy/dp83867.c                |   2 +
 drivers/net/phy/dp83869.c                |   2 +
 drivers/net/phy/dp83tc811.c              |   2 +
 drivers/net/phy/dp83td510.c              |   2 +
 drivers/net/phy/dp83tg720.c              |   2 +
 drivers/net/phy/et1011c.c                |   2 +
 drivers/net/phy/icplus.c                 |   8 +
 drivers/net/phy/intel-xway.c             |  20 +++
 drivers/net/phy/lxt.c                    |   8 +
 drivers/net/phy/marvell-88q2xxx.c        |   2 +
 drivers/net/phy/marvell-88x2222.c        |   2 +
 drivers/net/phy/marvell.c                |  44 +++++-
 drivers/net/phy/marvell10g.c             |  16 +-
 drivers/net/phy/mediatek-ge-soc.c        |   4 +
 drivers/net/phy/mediatek-ge.c            |   4 +
 drivers/net/phy/meson-gxl.c              |   4 +
 drivers/net/phy/micrel.c                 |  54 ++++++-
 drivers/net/phy/microchip.c              |   2 +
 drivers/net/phy/microchip_t1.c           |   4 +
 drivers/net/phy/microchip_t1s.c          |   4 +
 drivers/net/phy/motorcomm.c              |   8 +
 drivers/net/phy/mscc/mscc_main.c         |  30 ++++
 drivers/net/phy/mxl-gpy.c                |  24 +++
 drivers/net/phy/national.c               |   2 +
 drivers/net/phy/ncn26000.c               |   2 +
 drivers/net/phy/nxp-c45-tja11xx.c        |   8 +-
 drivers/net/phy/nxp-cbtx.c               |   2 +
 drivers/net/phy/nxp-tja11xx.c            |  16 +-
 drivers/net/phy/phy-c45.c                |   2 +
 drivers/net/phy/phy-core.c               |  18 ++-
 drivers/net/phy/phy.c                    |  85 +++++-----
 drivers/net/phy/phy_device.c             |  79 +++++-----
 drivers/net/phy/qcom/at803x.c            |  18 ++-
 drivers/net/phy/qcom/qca807x.c           |   4 +
 drivers/net/phy/qcom/qca808x.c           |   2 +
 drivers/net/phy/qcom/qca83xx.c           |  12 +-
 drivers/net/phy/qsemi.c                  |   2 +
 drivers/net/phy/realtek.c                |  46 +++++-
 drivers/net/phy/rockchip.c               |   2 +
 drivers/net/phy/smsc.c                   |  14 ++
 drivers/net/phy/ste10Xp.c                |   4 +
 drivers/net/phy/teranetics.c             |   2 +
 drivers/net/phy/uPD60620.c               |   2 +
 drivers/net/phy/vitesse.c                |  22 +++
 drivers/net/phy/xilinx_gmii2rgmii.c      |  16 +-
 include/linux/phy.h                      |  57 ++++---
 64 files changed, 737 insertions(+), 291 deletions(-)

-- 
2.43.0


             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 Christian Marangi [this message]
2024-02-17 19:41 ` [net-next RFC PATCH 1/3] net: phy: detach PHY driver OPs from phy_driver struct 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 ` [net-next RFC PATCH 3/3] net: phy: bcm7xxx: " Christian Marangi
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-1-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).