diff mbox series

[net-next,3/8] net: phy: add getters for public members of struct phy_package_shared

Message ID b505ed6a-533d-42ad-82d0-93315ce27e7f@gmail.com (mailing list archive)
State New
Headers show
Series net: phy: move PHY package code to its own source file | expand

Commit Message

Heiner Kallweit Feb. 19, 2025, 9:04 p.m. UTC
Add getters for public members, this prepares for making struct
phy_package_shared private to phylib.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/phy_package.c | 12 ++++++++++++
 include/linux/phy.h           |  3 +++
 2 files changed, 15 insertions(+)

Comments

Jakub Kicinski Feb. 25, 2025, 2:01 a.m. UTC | #1
On Wed, 19 Feb 2025 22:04:47 +0100 Heiner Kallweit wrote:
> +struct device_node *phy_package_shared_get_node(struct phy_device *phydev);
> +void *phy_package_shared_get_priv(struct phy_device *phydev);

A bit sad that none of the users can fit in a line with this naming.
Isn't "shared" implied by "package" here ?
How would you feel about phy_package_get_priv() ?
Paolo Abeni Feb. 25, 2025, 9:12 a.m. UTC | #2
On 2/25/25 3:01 AM, Jakub Kicinski wrote:
> On Wed, 19 Feb 2025 22:04:47 +0100 Heiner Kallweit wrote:
>> +struct device_node *phy_package_shared_get_node(struct phy_device *phydev);
>> +void *phy_package_shared_get_priv(struct phy_device *phydev);
> 
> A bit sad that none of the users can fit in a line with this naming.
> Isn't "shared" implied by "package" here ?
> How would you feel about phy_package_get_priv() ?

FWIW I personally agree the latter would be a better name.

@Heiner: could you please give that naming schema a shot here?

/P
Heiner Kallweit Feb. 27, 2025, 9:06 p.m. UTC | #3
On 25.02.2025 10:12, Paolo Abeni wrote:
> On 2/25/25 3:01 AM, Jakub Kicinski wrote:
>> On Wed, 19 Feb 2025 22:04:47 +0100 Heiner Kallweit wrote:
>>> +struct device_node *phy_package_shared_get_node(struct phy_device *phydev);
>>> +void *phy_package_shared_get_priv(struct phy_device *phydev);
>>
>> A bit sad that none of the users can fit in a line with this naming.
>> Isn't "shared" implied by "package" here ?
>> How would you feel about phy_package_get_priv() ?
> 
> FWIW I personally agree the latter would be a better name.
> 
> @Heiner: could you please give that naming schema a shot here?
> 
> /P
> 
Sure. I'll submit a v2 with the suggested changes.
diff mbox series

Patch

diff --git a/drivers/net/phy/phy_package.c b/drivers/net/phy/phy_package.c
index 9b9c200ae..6955b4132 100644
--- a/drivers/net/phy/phy_package.c
+++ b/drivers/net/phy/phy_package.c
@@ -6,6 +6,18 @@ 
 #include <linux/of.h>
 #include <linux/phy.h>
 
+struct device_node *phy_package_shared_get_node(struct phy_device *phydev)
+{
+	return phydev->shared->np;
+}
+EXPORT_SYMBOL_GPL(phy_package_shared_get_node);
+
+void *phy_package_shared_get_priv(struct phy_device *phydev)
+{
+	return phydev->shared->priv;
+}
+EXPORT_SYMBOL_GPL(phy_package_shared_get_priv);
+
 int phy_package_address(struct phy_device *phydev, unsigned int addr_offset)
 {
 	struct phy_package_shared *shared = phydev->shared;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index a8f39e817..ce591307a 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -2095,6 +2095,9 @@  int phy_ethtool_get_link_ksettings(struct net_device *ndev,
 int phy_ethtool_set_link_ksettings(struct net_device *ndev,
 				   const struct ethtool_link_ksettings *cmd);
 int phy_ethtool_nway_reset(struct net_device *ndev);
+
+struct device_node *phy_package_shared_get_node(struct phy_device *phydev);
+void *phy_package_shared_get_priv(struct phy_device *phydev);
 int phy_package_join(struct phy_device *phydev, int base_addr, size_t priv_size);
 int of_phy_package_join(struct phy_device *phydev, size_t priv_size);
 void phy_package_leave(struct phy_device *phydev);