From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: linux-phy@lists.infradead.org
Cc: "Vinod Koul" <vkoul@kernel.org>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org,
linux-arm-msm@vger.kernel.org, linux-can@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-ide@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-riscv@lists.infradead.org,
linux-rockchip@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org,
linux-usb@vger.kernel.org, netdev@vger.kernel.org,
spacemit@lists.linux.dev, UNGLinuxDriver@microchip.com,
"Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>,
"Abhinav Kumar" <abhinav.kumar@linux.dev>,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
"André Draszik" <andre.draszik@linaro.org>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"Andrzej Hajda" <andrzej.hajda@intel.com>,
"Andy Yan" <andy.yan@rock-chips.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Chanho Park" <chanho61.park@samsung.com>,
"Chen-Yu Tsai" <wens@kernel.org>,
"Claudiu Beznea" <claudiu.beznea@tuxon.dev>,
"Damien Le Moal" <dlemoal@kernel.org>,
"Daniel Machon" <daniel.machon@microchip.com>,
"David Airlie" <airlied@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
"Dmitry Baryshkov" <lumag@kernel.org>,
"Eric Dumazet" <edumazet@google.com>,
"Fabio Estevam" <festevam@gmail.com>,
"Frank Li" <Frank.Li@nxp.com>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Heiko Stübner" <heiko@sntech.de>,
"Inki Dae" <inki.dae@samsung.com>,
"Jagan Teki" <jagan@amarulasolutions.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"JC Kuo" <jckuo@nvidia.com>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"Jessica Zhang" <jesszhan0024@gmail.com>,
"Joe Perches" <joe@perches.com>,
"Johan Hovold" <johan+linaro@kernel.org>,
"Jonas Karlman" <jonas@kwiboo.se>,
"Jonathan Hunter" <jonathanh@nvidia.com>,
"Kevin Xie" <kevin.xie@starfivetech.com>,
"Krzysztof Kozlowski" <krzysztof.kozlowski@oss.qualcomm.com>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
"Linus Walleij" <linusw@kernel.org>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Magnus Damm" <magnus.damm@gmail.com>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Marc Kleine-Budde" <mkl@pengutronix.de>,
"Marek Szyprowski" <m.szyprowski@samsung.com>,
"Marijn Suijten" <marijn.suijten@somainline.org>,
"Markus Schneider-Pargmann" <msp@baylibre.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"Mathias Nyman" <mathias.nyman@intel.com>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Maxime Ripard" <mripard@kernel.org>,
"Michael Dege" <michael.dege@renesas.com>,
"Nicolas Ferre" <nicolas.ferre@microchip.com>,
"Niklas Cassel" <cassel@kernel.org>,
"Nitin Rawat" <quic_nitirawa@quicinc.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Peter Chen" <peter.chen@kernel.org>,
"Peter Griffin" <peter.griffin@linaro.org>,
"Rob Clark" <robin.clark@oss.qualcomm.com>,
"Robert Foss" <rfoss@kernel.org>, "Rob Herring" <robh@kernel.org>,
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
"Samuel Holland" <samuel@sholland.org>,
"Sandy Huang" <hjc@rock-chips.com>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Sean Paul" <sean@poorly.run>,
"Sebastian Reichel" <sre@kernel.org>,
"Shawn Guo" <shawn.guo@linaro.org>,
"Shawn Lin" <shawn.lin@rock-chips.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Steen Hegelund" <Steen.Hegelund@microchip.com>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Thinh Nguyen" <Thinh.Nguyen@synopsys.com>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Tudor Ambarus" <tudor.ambarus@linaro.org>,
"Vincent Mailhol" <mailhol@kernel.org>,
"Yixun Lan" <dlan@kernel.org>,
"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>
Subject: Re: [PATCH v7 phy-next 15/27] phy: move provider API out of public <linux/phy/phy.h>
Date: Tue, 5 May 2026 12:30:31 +0300 [thread overview]
Message-ID: <20260505093031.zjewnvpvyiptxz6f@skbuf> (raw)
In-Reply-To: <20260430110652.558622-16-vladimir.oltean@nxp.com>
Sashiko says:
> commit 65f3c7aba94024fd51e12abfeeb5cdaae7e123cd
> Author: Vladimir Oltean <vladimir.oltean@nxp.com>
> phy: move provider API out of public <linux/phy/phy.h>
>
> The major goal is to hide the contents of struct phy from consumer
> drivers by moving the provider API out of the public linux/phy/phy.h
> header and into drivers/phy/phy-provider.h. For temporary compatibility,
> the consumer header currently includes the provider header via a relative
> path.
>
> > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> > index 21aaf2f76e53e..a1aff00fba7c5 100644
> > --- a/drivers/phy/phy-core.c
> > +++ b/drivers/phy/phy-core.c
> [ ... ]
> > @@ -606,6 +622,24 @@ int phy_validate(struct phy *phy, enum phy_mode mode, int submode,
> > }
> > EXPORT_SYMBOL_GPL(phy_validate);
> >
> > +enum phy_mode phy_get_mode(struct phy *phy)
> > +{
> > + return phy->attrs.mode;
>
> The PHY framework supports optional PHYs (represented as NULL pointers via
> devm_phy_optional_get()). Does this unconditional dereference cause a NULL
> pointer dereference if called with an optional PHY?
>
> I noticed this was also the case in the previous inline implementation, and
> that a fix is provided later in the series in the commit "phy: make
> phy_get_mode(), phy_(get|set)_bus_width() NULL tolerant".
>
> > +}
> > +EXPORT_SYMBOL_GPL(phy_get_mode);
> > +
> > +int phy_get_bus_width(struct phy *phy)
> > +{
> > + return phy->attrs.bus_width;
>
> Can this also cause a NULL pointer dereference when called with an optional
> PHY?
>
> > +}
> > +EXPORT_SYMBOL_GPL(phy_get_bus_width);
> > +
> > +void phy_set_bus_width(struct phy *phy, int bus_width)
> > +{
> > + phy->attrs.bus_width = bus_width;
>
> Can this also cause a NULL pointer dereference when called with an optional
> PHY?
It was a conscious decision to move code first and then to start fixing
it up later, so that more context is present in 'git blame'. So I will
ignore these comments for issues that are resolved later in the series.
> > +}
> > +EXPORT_SYMBOL_GPL(phy_set_bus_width);
> [ ... ]
> > diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
> > index ea47975e288ae..f208edd25afee 100644
> > --- a/include/linux/phy/phy.h
> > +++ b/include/linux/phy/phy.h
> > @@ -1,246 +1,38 @@
> > /* SPDX-License-Identifier: GPL-2.0-or-later */
> > /*
> > - * phy.h -- generic phy header file
> > + * phy.h -- Generic PHY consumer API
> [ ... ]
> > -#include <linux/phy/phy-mipi-dphy.h>
> > +#include <linux/phy/phy-props.h>
> >
> > +#include "../../../drivers/phy/phy-provider.h"
>
> Does this relative include of a private driver header break out-of-tree
> module builds?
>
> Out-of-tree modules compile against kernel headers packages that typically do
> not contain the private drivers/ directory tree, which would cause
> compilation to fail with a missing file error.
>
> I note this is resolved later in the series in the commit "phy: remove
> temporary provider compatibility from consumer header".
Yes, out of tree building will temporarily be broken but resolved by the
end of the series for PHY consumers (but remains broken for PHY providers).
My understanding is that support for out of tree modules is best effort,
and I don't see how breakage could be avoided, given Vinod's request to
have phy-provider.h be a non-public header.
next prev parent reply other threads:[~2026-05-05 9:30 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 11:06 [PATCH v7 phy-next 00/27] Split Generic PHY consumer and provider Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 01/27] ata: add <linux/pm_runtime.h> where missing Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 02/27] PCI: Add missing headers transitively included by <linux/phy/phy.h> Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 03/27] usb: add " Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 04/27] drm: add <linux/pm_runtime.h> where missing Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 05/27] phy: " Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 06/27] phy: spacemit: include missing <linux/phy/phy.h> Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 07/27] net: lan969x: include missing <linux/of.h> Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 08/27] PCI: Remove device links to PHY Vladimir Oltean
2026-05-04 7:57 ` Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 09/27] scsi: ufs: exynos: stop poking into struct phy guts Vladimir Oltean
2026-05-04 11:48 ` Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 10/27] scsi: ufs: qcom: keep parallel track of PHY power state Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 11/27] scsi: ufs: qcom: include missing <linux/interrupt.h> Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 12/27] drm/rockchip: dw_hdmi: avoid direct dereference of phy->dev.of_node Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 13/27] usb: host: tegra: " Vladimir Oltean
2026-05-05 9:39 ` Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 14/27] usb: gadget: tegra-xudc: " Vladimir Oltean
2026-05-05 9:34 ` Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 15/27] phy: move provider API out of public <linux/phy/phy.h> Vladimir Oltean
2026-05-05 9:30 ` Vladimir Oltean [this message]
2026-04-30 11:06 ` [PATCH v7 phy-next 16/27] phy: make phy_get_mode(), phy_(get|set)_bus_width() NULL tolerant Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 17/27] phy: introduce phy_get_max_link_rate() helper for consumers Vladimir Oltean
2026-04-30 11:59 ` Geert Uytterhoeven
2026-04-30 13:14 ` Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 18/27] drm/rockchip: dsi: include PHY provider header Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 19/27] drm: bridge: cdns-mhdp8546: use consumer API for getting PHY bus width Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 20/27] media: sunxi: a83-mips-csi2: include PHY provider header Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 21/27] net: renesas: rswitch: " Vladimir Oltean
2026-05-05 9:24 ` Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 22/27] pinctrl: tegra-xusb: " Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 23/27] power: supply: cpcap-charger: include missing <linux/property.h> Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 24/27] phy: include PHY provider header (1/2) Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 25/27] phy: include PHY provider header (2/2) Vladimir Oltean
2026-05-05 9:22 ` Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 26/27] phy: remove temporary provider compatibility from consumer header Vladimir Oltean
2026-04-30 11:06 ` [PATCH v7 phy-next 27/27] MAINTAINERS: add regexes for linux-phy Vladimir Oltean
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=20260505093031.zjewnvpvyiptxz6f@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=Frank.Li@nxp.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=Steen.Hegelund@microchip.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=abhinav.kumar@linux.dev \
--cc=airlied@gmail.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andre.draszik@linaro.org \
--cc=andrew+netdev@lunn.ch \
--cc=andrzej.hajda@intel.com \
--cc=andy.yan@rock-chips.com \
--cc=bhelgaas@google.com \
--cc=cassel@kernel.org \
--cc=chanho61.park@samsung.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=daniel.machon@microchip.com \
--cc=davem@davemloft.net \
--cc=dlan@kernel.org \
--cc=dlemoal@kernel.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=edumazet@google.com \
--cc=festevam@gmail.com \
--cc=freedreno@lists.freedesktop.org \
--cc=geert+renesas@glider.be \
--cc=gregkh@linuxfoundation.org \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=inki.dae@samsung.com \
--cc=jagan@amarulasolutions.com \
--cc=jckuo@nvidia.com \
--cc=jernej.skrabec@gmail.com \
--cc=jesszhan0024@gmail.com \
--cc=joe@perches.com \
--cc=johan+linaro@kernel.org \
--cc=jonas@kwiboo.se \
--cc=jonathanh@nvidia.com \
--cc=kernel@pengutronix.de \
--cc=kevin.xie@starfivetech.com \
--cc=krzysztof.kozlowski@oss.qualcomm.com \
--cc=kuba@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=lumag@kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=magnus.damm@gmail.com \
--cc=mailhol@kernel.org \
--cc=mani@kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=martin.petersen@oracle.com \
--cc=mathias.nyman@intel.com \
--cc=mchehab@kernel.org \
--cc=michael.dege@renesas.com \
--cc=mkl@pengutronix.de \
--cc=mripard@kernel.org \
--cc=msp@baylibre.com \
--cc=neil.armstrong@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=pabeni@redhat.com \
--cc=peter.chen@kernel.org \
--cc=peter.griffin@linaro.org \
--cc=quic_nitirawa@quicinc.com \
--cc=rfoss@kernel.org \
--cc=rmk+kernel@armlinux.org.uk \
--cc=robh@kernel.org \
--cc=robin.clark@oss.qualcomm.com \
--cc=s.hauer@pengutronix.de \
--cc=samuel@sholland.org \
--cc=sean@poorly.run \
--cc=shawn.guo@linaro.org \
--cc=shawn.lin@rock-chips.com \
--cc=simona@ffwll.ch \
--cc=spacemit@lists.linux.dev \
--cc=sre@kernel.org \
--cc=thierry.reding@gmail.com \
--cc=tudor.ambarus@linaro.org \
--cc=tzimmermann@suse.de \
--cc=vkoul@kernel.org \
--cc=wens@kernel.org \
--cc=yoshihiro.shimoda.uh@renesas.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