<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/phy/phy-core.c, branch v6.1.168</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-06-04T12:40:14+00:00</updated>
<entry>
<title>phy: core: don't require set_mode() callback for phy_get_mode() to work</title>
<updated>2025-06-04T12:40:14+00:00</updated>
<author>
<name>Dmitry Baryshkov</name>
<email>dmitry.baryshkov@linaro.org</email>
</author>
<published>2025-02-09T12:31:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cfdf164ef5a4ff57188f8c299c74db481a6231ba'/>
<id>urn:sha1:cfdf164ef5a4ff57188f8c299c74db481a6231ba</id>
<content type='text'>
[ Upstream commit d58c04e305afbaa9dda7969151f06c4efe2c98b0 ]

As reported by Damon Ding, the phy_get_mode() call doesn't work as
expected unless the PHY driver has a .set_mode() call. This prompts PHY
drivers to have empty stubs for .set_mode() for the sake of being able
to get the mode.

Make .set_mode() callback truly optional and update PHY's mode even if
it there is none.

Cc: Damon Ding &lt;damon.ding@rock-chips.com&gt;
Link: https://lore.kernel.org/r/96f8310f-93f1-4bcb-8637-137e1159ff83@rock-chips.com
Tested-by: Damon Ding &lt;damon.ding@rock-chips.com&gt;
Signed-off-by: Dmitry Baryshkov &lt;dmitry.baryshkov@linaro.org&gt;
Link: https://lore.kernel.org/r/20250209-phy-fix-set-moe-v2-1-76e248503856@linaro.org
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>phy: core: Fix that API devm_phy_destroy() fails to destroy the phy</title>
<updated>2025-01-02T09:30:49+00:00</updated>
<author>
<name>Zijun Hu</name>
<email>quic_zijuhu@quicinc.com</email>
</author>
<published>2024-12-13T12:36:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8c6ef358ba2306ae76e087869595654e24f042bd'/>
<id>urn:sha1:8c6ef358ba2306ae76e087869595654e24f042bd</id>
<content type='text'>
commit 4dc48c88fcf82b89fdebd83a906aaa64f40fb8a9 upstream.

For devm_phy_destroy(), its comment says it needs to invoke phy_destroy()
to destroy the phy, but it will not actually invoke the function since
devres_destroy() does not call devm_phy_consume(), and the missing
phy_destroy() call will cause that the phy fails to be destroyed.

Fortunately, the faulty API has not been used by current kernel tree.
Fix by using devres_release() instead of devres_destroy() within the API.

Fixes: ff764963479a ("drivers: phy: add generic PHY framework")
Reviewed-by: Johan Hovold &lt;johan+linaro@kernel.org&gt;
Signed-off-by: Zijun Hu &lt;quic_zijuhu@quicinc.com&gt;
Link: https://lore.kernel.org/r/20241213-phy_core_fix-v6-3-40ae28f5015a@quicinc.com
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>phy: core: Fix that API devm_of_phy_provider_unregister() fails to unregister the phy provider</title>
<updated>2025-01-02T09:30:49+00:00</updated>
<author>
<name>Zijun Hu</name>
<email>quic_zijuhu@quicinc.com</email>
</author>
<published>2024-12-13T12:36:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0f46864e9d5bd5299fd574224756d8f8191eb99f'/>
<id>urn:sha1:0f46864e9d5bd5299fd574224756d8f8191eb99f</id>
<content type='text'>
commit c0b82ab95b4f1fbc3e3aeab9d829d012669524b6 upstream.

For devm_of_phy_provider_unregister(), its comment says it needs to invoke
of_phy_provider_unregister() to unregister the phy provider, but it will
not actually invoke the function since devres_destroy() does not call
devm_phy_provider_release(), and the missing of_phy_provider_unregister()
call will cause:

- The phy provider fails to be unregistered.
- Leak both memory and the OF node refcount.

Fortunately, the faulty API has not been used by current kernel tree.
Fix by using devres_release() instead of devres_destroy() within the API.

Fixes: ff764963479a ("drivers: phy: add generic PHY framework")
Reviewed-by: Johan Hovold &lt;johan+linaro@kernel.org&gt;
Signed-off-by: Zijun Hu &lt;quic_zijuhu@quicinc.com&gt;
Link: https://lore.kernel.org/stable/20241213-phy_core_fix-v6-2-40ae28f5015a%40quicinc.com
Link: https://lore.kernel.org/r/20241213-phy_core_fix-v6-2-40ae28f5015a@quicinc.com
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>phy: core: Fix that API devm_phy_put() fails to release the phy</title>
<updated>2025-01-02T09:30:49+00:00</updated>
<author>
<name>Zijun Hu</name>
<email>quic_zijuhu@quicinc.com</email>
</author>
<published>2024-12-13T12:36:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5c23b6b47bd704575c47f8af5807960bb6a4bf67'/>
<id>urn:sha1:5c23b6b47bd704575c47f8af5807960bb6a4bf67</id>
<content type='text'>
commit fe4bfa9b6d7bd752bfe4700c937f235aa8ce997b upstream.

For devm_phy_put(), its comment says it needs to invoke phy_put() to
release the phy, but it will not actually invoke the function since
devres_destroy() does not call devm_phy_release(), and the missing
phy_put() call will cause:

- The phy fails to be released.
- devm_phy_put() can not fully undo what API devm_phy_get() does.
- Leak refcount of both the module and device for below typical usage:

  devm_phy_get(); // or its variant
  ...
  err = do_something();
  if (err)
      goto err_out;
  ...
  err_out:
  devm_phy_put(); // leak refcount here

  The file(s) affected by this issue are shown below since they have such
  typical usage.
  drivers/pci/controller/cadence/pcie-cadence.c
  drivers/net/ethernet/ti/am65-cpsw-nuss.c

Fix by using devres_release() instead of devres_destroy() within the API.

Fixes: ff764963479a ("drivers: phy: add generic PHY framework")
Cc: stable@vger.kernel.org
Cc: Lorenzo Pieralisi &lt;lpieralisi@kernel.org&gt;
Cc: Krzysztof Wilczyński &lt;kw@linux.com&gt;
Cc: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Cc: David S. Miller &lt;davem@davemloft.net&gt;
Cc: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Jakub Kicinski &lt;kuba@kernel.org&gt;
Cc: Paolo Abeni &lt;pabeni@redhat.com&gt;
Reviewed-by: Johan Hovold &lt;johan+linaro@kernel.org&gt;
Signed-off-by: Zijun Hu &lt;quic_zijuhu@quicinc.com&gt;
Link: https://lore.kernel.org/r/20241213-phy_core_fix-v6-1-40ae28f5015a@quicinc.com
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>phy: core: Fix an OF node refcount leakage in of_phy_provider_lookup()</title>
<updated>2025-01-02T09:30:49+00:00</updated>
<author>
<name>Zijun Hu</name>
<email>quic_zijuhu@quicinc.com</email>
</author>
<published>2024-12-13T12:36:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=be2c737d4af2cebcade968ef6fcbb0279a15821c'/>
<id>urn:sha1:be2c737d4af2cebcade968ef6fcbb0279a15821c</id>
<content type='text'>
commit a2d633cb1421e679b56f1a9fe1f42f089706f1ed upstream.

For macro for_each_child_of_node(parent, child), refcount of @child has
been increased before entering its loop body, so normally needs to call
of_node_put(@child) before returning from the loop body to avoid refcount
leakage.

of_phy_provider_lookup() has such usage but does not call of_node_put()
before returning, so cause leakage of the OF node refcount.

Fix by simply calling of_node_put() before returning from the loop body.

The APIs affected by this issue are shown below since they indirectly
invoke problematic of_phy_provider_lookup().
phy_get()
of_phy_get()
devm_phy_get()
devm_of_phy_get()
devm_of_phy_get_by_index()

Fixes: 2a4c37016ca9 ("phy: core: Fix of_phy_provider_lookup to return PHY provider for sub node")
Cc: stable@vger.kernel.org
Reviewed-by: Johan Hovold &lt;johan+linaro@kernel.org&gt;
Signed-off-by: Zijun Hu &lt;quic_zijuhu@quicinc.com&gt;
Link: https://lore.kernel.org/r/20241213-phy_core_fix-v6-5-40ae28f5015a@quicinc.com
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>phy: core: Fix an OF node refcount leakage in _of_phy_get()</title>
<updated>2025-01-02T09:30:49+00:00</updated>
<author>
<name>Zijun Hu</name>
<email>quic_zijuhu@quicinc.com</email>
</author>
<published>2024-12-13T12:36:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dff3974372f4f9fe1d97993b8aa17d3239b510f0'/>
<id>urn:sha1:dff3974372f4f9fe1d97993b8aa17d3239b510f0</id>
<content type='text'>
commit 5ebdc6be16c2000e37fcb8b4072d442d268ad492 upstream.

_of_phy_get() will directly return when suffers of_device_is_compatible()
error, but it forgets to decrease refcount of OF node @args.np before error
return, the refcount was increased by previous of_parse_phandle_with_args()
so causes the OF node's refcount leakage.

Fix by decreasing the refcount via of_node_put() before the error return.

Fixes: b7563e2796f8 ("phy: work around 'phys' references to usb-nop-xceiv devices")
Cc: stable@vger.kernel.org
Reviewed-by: Johan Hovold &lt;johan+linaro@kernel.org&gt;
Signed-off-by: Zijun Hu &lt;quic_zijuhu@quicinc.com&gt;
Link: https://lore.kernel.org/r/20241213-phy_core_fix-v6-4-40ae28f5015a@quicinc.com
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>phy: core: Warn when phy_power_on is called before phy_init</title>
<updated>2022-04-20T09:15:15+00:00</updated>
<author>
<name>Jules Maselbas</name>
<email>jmaselbas@kalray.eu</email>
</author>
<published>2022-04-07T10:21:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1599069a62c6179fdde9f6e5b54d44531064a79c'/>
<id>urn:sha1:1599069a62c6179fdde9f6e5b54d44531064a79c</id>
<content type='text'>
A warning when the order of phy operation is mixed up by drivers,
this is an atempt to make the phy usage more uniform across (usb)
drivers.

Signed-off-by: Jules Maselbas &lt;jmaselbas@kalray.eu&gt;
Cc: Ahmad Fatoum &lt;a.fatoum@pengutronix.de&gt;
Cc: Amelie DELAUNAY &lt;amelie.delaunay@foss.st.com&gt;
Cc: Minas Harutyunyan &lt;hminas@synopsys.com&gt;
Cc: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
Link: https://lore.kernel.org/r/20220407102108.24211-4-jmaselbas@kalray.eu
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
</entry>
<entry>
<title>phy: core: Update documentation syntax</title>
<updated>2022-04-20T09:15:15+00:00</updated>
<author>
<name>Jules Maselbas</name>
<email>jmaselbas@kalray.eu</email>
</author>
<published>2022-04-07T10:21:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bd5bd02e1517352ff215879362624f4ca6575bdc'/>
<id>urn:sha1:bd5bd02e1517352ff215879362624f4ca6575bdc</id>
<content type='text'>
Update the syntax used by the documentation of phy operation functions.
This is to unify the syntax with the newly added documentation.

Signed-off-by: Jules Maselbas &lt;jmaselbas@kalray.eu&gt;
Link: https://lore.kernel.org/r/20220407102108.24211-3-jmaselbas@kalray.eu
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
</entry>
<entry>
<title>phy: core: Add documentation of phy operation order</title>
<updated>2022-04-20T09:15:15+00:00</updated>
<author>
<name>Jules Maselbas</name>
<email>jmaselbas@kalray.eu</email>
</author>
<published>2022-04-07T10:21:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f1b8d3358af77fc453d6b781f40ee7342a230672'/>
<id>urn:sha1:f1b8d3358af77fc453d6b781f40ee7342a230672</id>
<content type='text'>
Add documentation on phy function usage: init function must be
called before power_on; power_off must be called before exit.

Signed-off-by: Jules Maselbas &lt;jmaselbas@kalray.eu&gt;
Cc: Ahmad Fatoum &lt;a.fatoum@pengutronix.de&gt;
Cc: Amelie DELAUNAY &lt;amelie.delaunay@foss.st.com&gt;
Cc: Minas Harutyunyan &lt;hminas@synopsys.com&gt;
Cc: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
Link: https://lore.kernel.org/r/20220407102108.24211-2-jmaselbas@kalray.eu
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
</entry>
<entry>
<title>phy: Allow a NULL phy name for devm_phy_get()</title>
<updated>2021-05-14T12:18:41+00:00</updated>
<author>
<name>Rob Herring</name>
<email>robh@kernel.org</email>
</author>
<published>2021-04-14T13:55:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8a917813cc74c3e8fa41f16aff90c5931bb49152'/>
<id>urn:sha1:8a917813cc74c3e8fa41f16aff90c5931bb49152</id>
<content type='text'>
For a single PHY, there's no reason to have a phy-names entry in DT.
The DT specific get functions allow for this already, but devm_phy_get()
WARNs in this case. Other subsystems also don't warn in their get
functions. Let's drop the WARN for DT case in devm_phy_get().

Cc: Kishon Vijay Abraham I &lt;kishon@ti.com&gt;
Cc: Vinod Koul &lt;vkoul@kernel.org&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
Link: https://lore.kernel.org/r/20210414135525.3535787-1-robh@kernel.org
Signed-off-by: Vinod Koul &lt;vkoul@kernel.org&gt;
</content>
</entry>
</feed>
