* [PATCH net-next 0/2] net: phy: fixed_phy: add helper fixed_phy_register_100fd
@ 2025-10-17 20:11 Heiner Kallweit
2025-10-17 20:12 ` [PATCH net-next 1/2] " Heiner Kallweit
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Heiner Kallweit @ 2025-10-17 20:11 UTC (permalink / raw)
To: Andrew Lunn, Andrew Lunn, Russell King - ARM Linux, Paolo Abeni,
Jakub Kicinski, David Miller, Eric Dumazet, Vladimir Oltean
Cc: netdev@vger.kernel.org
In few places a 100FD fixed PHY is used. Create a helper so that users
don't have to define the struct fixed_phy_status. First user is the
dsa loop driver. A follow-up series will remove the usage of
fixed_phy_add() from bcm47xx and coldfire/m5272, then this helper
will be used too.
Heiner Kallweit (2):
net: phy: fixed_phy: add helper fixed_phy_register_100fd
net: dsa: loop: use new helper fixed_phy_register_100fd
drivers/net/dsa/dsa_loop.c | 7 +------
drivers/net/phy/fixed_phy.c | 12 ++++++++++++
include/linux/phy_fixed.h | 6 ++++++
3 files changed, 19 insertions(+), 6 deletions(-)
--
2.51.1.dirty
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH net-next 1/2] net: phy: fixed_phy: add helper fixed_phy_register_100fd
2025-10-17 20:11 [PATCH net-next 0/2] net: phy: fixed_phy: add helper fixed_phy_register_100fd Heiner Kallweit
@ 2025-10-17 20:12 ` Heiner Kallweit
2025-10-17 20:42 ` Gerhard Engleder
2025-10-17 20:55 ` Florian Fainelli
2025-10-17 20:14 ` [PATCH net-next 2/2] net: dsa: loop: use new " Heiner Kallweit
2025-10-22 1:20 ` [PATCH net-next 0/2] net: phy: fixed_phy: add " Jakub Kicinski
2 siblings, 2 replies; 9+ messages in thread
From: Heiner Kallweit @ 2025-10-17 20:12 UTC (permalink / raw)
To: Andrew Lunn, Andrew Lunn, Russell King - ARM Linux, Paolo Abeni,
Jakub Kicinski, David Miller, Eric Dumazet, Vladimir Oltean
Cc: netdev@vger.kernel.org
In few places a 100FD fixed PHY is used. Create a helper so that users
don't have to define the struct fixed_phy_status.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/fixed_phy.c | 12 ++++++++++++
include/linux/phy_fixed.h | 6 ++++++
2 files changed, 18 insertions(+)
diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
index 0e1b28f06..bdc3a4bff 100644
--- a/drivers/net/phy/fixed_phy.c
+++ b/drivers/net/phy/fixed_phy.c
@@ -227,6 +227,18 @@ struct phy_device *fixed_phy_register(const struct fixed_phy_status *status,
}
EXPORT_SYMBOL_GPL(fixed_phy_register);
+struct phy_device *fixed_phy_register_100fd(void)
+{
+ static const struct fixed_phy_status status = {
+ .link = 1,
+ .speed = SPEED_100,
+ .duplex = DUPLEX_FULL,
+ };
+
+ return fixed_phy_register(&status, NULL);
+}
+EXPORT_SYMBOL_GPL(fixed_phy_register_100fd);
+
void fixed_phy_unregister(struct phy_device *phy)
{
phy_device_remove(phy);
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index d17ff750c..08275ef64 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -20,6 +20,7 @@ extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
void fixed_phy_add(const struct fixed_phy_status *status);
struct phy_device *fixed_phy_register(const struct fixed_phy_status *status,
struct device_node *np);
+struct phy_device *fixed_phy_register_100fd(void);
extern void fixed_phy_unregister(struct phy_device *phydev);
extern int fixed_phy_set_link_update(struct phy_device *phydev,
@@ -34,6 +35,11 @@ fixed_phy_register(const struct fixed_phy_status *status,
return ERR_PTR(-ENODEV);
}
+static inline struct phy_device *fixed_phy_register_100fd(void)
+{
+ return ERR_PTR(-ENODEV);
+}
+
static inline void fixed_phy_unregister(struct phy_device *phydev)
{
}
--
2.51.1.dirty
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 2/2] net: dsa: loop: use new helper fixed_phy_register_100fd
2025-10-17 20:11 [PATCH net-next 0/2] net: phy: fixed_phy: add helper fixed_phy_register_100fd Heiner Kallweit
2025-10-17 20:12 ` [PATCH net-next 1/2] " Heiner Kallweit
@ 2025-10-17 20:14 ` Heiner Kallweit
2025-10-17 20:43 ` Gerhard Engleder
2025-10-22 1:20 ` [PATCH net-next 0/2] net: phy: fixed_phy: add " Jakub Kicinski
2 siblings, 1 reply; 9+ messages in thread
From: Heiner Kallweit @ 2025-10-17 20:14 UTC (permalink / raw)
To: Andrew Lunn, Andrew Lunn, Russell King - ARM Linux, Paolo Abeni,
Jakub Kicinski, David Miller, Eric Dumazet, Vladimir Oltean
Cc: netdev@vger.kernel.org
Use new helper fixed_phy_register_100fd() to simplify the code.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/dsa/dsa_loop.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c
index 650d93226..4a416f271 100644
--- a/drivers/net/dsa/dsa_loop.c
+++ b/drivers/net/dsa/dsa_loop.c
@@ -441,11 +441,6 @@ static int __init dsa_loop_create_switch_mdiodev(void)
static int __init dsa_loop_init(void)
{
- struct fixed_phy_status status = {
- .link = 1,
- .speed = SPEED_100,
- .duplex = DUPLEX_FULL,
- };
unsigned int i;
int ret;
@@ -454,7 +449,7 @@ static int __init dsa_loop_init(void)
return ret;
for (i = 0; i < NUM_FIXED_PHYS; i++)
- phydevs[i] = fixed_phy_register(&status, NULL);
+ phydevs[i] = fixed_phy_register_100fd();
ret = mdio_driver_register(&dsa_loop_drv);
if (ret) {
--
2.51.1.dirty
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 1/2] net: phy: fixed_phy: add helper fixed_phy_register_100fd
2025-10-17 20:12 ` [PATCH net-next 1/2] " Heiner Kallweit
@ 2025-10-17 20:42 ` Gerhard Engleder
2025-10-17 20:55 ` Florian Fainelli
1 sibling, 0 replies; 9+ messages in thread
From: Gerhard Engleder @ 2025-10-17 20:42 UTC (permalink / raw)
To: Heiner Kallweit
Cc: netdev@vger.kernel.org, Eric Dumazet, Jakub Kicinski,
David Miller, Andrew Lunn, Vladimir Oltean,
Russell King - ARM Linux, Paolo Abeni, Andrew Lunn
On 17.10.25 22:12, Heiner Kallweit wrote:
> In few places a 100FD fixed PHY is used. Create a helper so that users
> don't have to define the struct fixed_phy_status.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> drivers/net/phy/fixed_phy.c | 12 ++++++++++++
> include/linux/phy_fixed.h | 6 ++++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
> index 0e1b28f06..bdc3a4bff 100644
> --- a/drivers/net/phy/fixed_phy.c
> +++ b/drivers/net/phy/fixed_phy.c
> @@ -227,6 +227,18 @@ struct phy_device *fixed_phy_register(const struct fixed_phy_status *status,
> }
> EXPORT_SYMBOL_GPL(fixed_phy_register);
>
> +struct phy_device *fixed_phy_register_100fd(void)
> +{
> + static const struct fixed_phy_status status = {
> + .link = 1,
> + .speed = SPEED_100,
> + .duplex = DUPLEX_FULL,
> + };
> +
> + return fixed_phy_register(&status, NULL);
> +}
> +EXPORT_SYMBOL_GPL(fixed_phy_register_100fd);
> +
> void fixed_phy_unregister(struct phy_device *phy)
> {
> phy_device_remove(phy);
> diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
> index d17ff750c..08275ef64 100644
> --- a/include/linux/phy_fixed.h
> +++ b/include/linux/phy_fixed.h
> @@ -20,6 +20,7 @@ extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
> void fixed_phy_add(const struct fixed_phy_status *status);
> struct phy_device *fixed_phy_register(const struct fixed_phy_status *status,
> struct device_node *np);
> +struct phy_device *fixed_phy_register_100fd(void);
>
> extern void fixed_phy_unregister(struct phy_device *phydev);
> extern int fixed_phy_set_link_update(struct phy_device *phydev,
> @@ -34,6 +35,11 @@ fixed_phy_register(const struct fixed_phy_status *status,
> return ERR_PTR(-ENODEV);
> }
>
> +static inline struct phy_device *fixed_phy_register_100fd(void)
> +{
> + return ERR_PTR(-ENODEV);
> +}
> +
> static inline void fixed_phy_unregister(struct phy_device *phydev)
> {
> }
Reviewed-by: Gerhard Engleder <gerhard@engleder-embedded.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 2/2] net: dsa: loop: use new helper fixed_phy_register_100fd
2025-10-17 20:14 ` [PATCH net-next 2/2] net: dsa: loop: use new " Heiner Kallweit
@ 2025-10-17 20:43 ` Gerhard Engleder
0 siblings, 0 replies; 9+ messages in thread
From: Gerhard Engleder @ 2025-10-17 20:43 UTC (permalink / raw)
To: Heiner Kallweit
Cc: netdev@vger.kernel.org, Andrew Lunn, Andrew Lunn,
Russell King - ARM Linux, Paolo Abeni, Jakub Kicinski,
David Miller, Eric Dumazet, Vladimir Oltean
On 17.10.25 22:14, Heiner Kallweit wrote:
> Use new helper fixed_phy_register_100fd() to simplify the code.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> drivers/net/dsa/dsa_loop.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c
> index 650d93226..4a416f271 100644
> --- a/drivers/net/dsa/dsa_loop.c
> +++ b/drivers/net/dsa/dsa_loop.c
> @@ -441,11 +441,6 @@ static int __init dsa_loop_create_switch_mdiodev(void)
>
> static int __init dsa_loop_init(void)
> {
> - struct fixed_phy_status status = {
> - .link = 1,
> - .speed = SPEED_100,
> - .duplex = DUPLEX_FULL,
> - };
> unsigned int i;
> int ret;
>
> @@ -454,7 +449,7 @@ static int __init dsa_loop_init(void)
> return ret;
>
> for (i = 0; i < NUM_FIXED_PHYS; i++)
> - phydevs[i] = fixed_phy_register(&status, NULL);
> + phydevs[i] = fixed_phy_register_100fd();
>
> ret = mdio_driver_register(&dsa_loop_drv);
> if (ret) {
Reviewed-by: Gerhard Engleder <gerhard@engleder-embedded.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 1/2] net: phy: fixed_phy: add helper fixed_phy_register_100fd
2025-10-17 20:12 ` [PATCH net-next 1/2] " Heiner Kallweit
2025-10-17 20:42 ` Gerhard Engleder
@ 2025-10-17 20:55 ` Florian Fainelli
2025-10-17 21:04 ` Heiner Kallweit
1 sibling, 1 reply; 9+ messages in thread
From: Florian Fainelli @ 2025-10-17 20:55 UTC (permalink / raw)
To: Heiner Kallweit, Andrew Lunn, Andrew Lunn,
Russell King - ARM Linux, Paolo Abeni, Jakub Kicinski,
David Miller, Eric Dumazet, Vladimir Oltean
Cc: netdev@vger.kernel.org
On 10/17/25 13:12, Heiner Kallweit wrote:
> In few places a 100FD fixed PHY is used. Create a helper so that users
> don't have to define the struct fixed_phy_status.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> drivers/net/phy/fixed_phy.c | 12 ++++++++++++
> include/linux/phy_fixed.h | 6 ++++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
> index 0e1b28f06..bdc3a4bff 100644
> --- a/drivers/net/phy/fixed_phy.c
> +++ b/drivers/net/phy/fixed_phy.c
> @@ -227,6 +227,18 @@ struct phy_device *fixed_phy_register(const struct fixed_phy_status *status,
> }
> EXPORT_SYMBOL_GPL(fixed_phy_register);
>
> +struct phy_device *fixed_phy_register_100fd(void)
> +{
> + static const struct fixed_phy_status status = {
> + .link = 1,
> + .speed = SPEED_100,
> + .duplex = DUPLEX_FULL,
> + };
> +
> + return fixed_phy_register(&status, NULL);
> +}
> +EXPORT_SYMBOL_GPL(fixed_phy_register_100fd);
Would not you want this to be a static inline helper directly?
--
Florian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 1/2] net: phy: fixed_phy: add helper fixed_phy_register_100fd
2025-10-17 20:55 ` Florian Fainelli
@ 2025-10-17 21:04 ` Heiner Kallweit
0 siblings, 0 replies; 9+ messages in thread
From: Heiner Kallweit @ 2025-10-17 21:04 UTC (permalink / raw)
To: Florian Fainelli, Andrew Lunn, Andrew Lunn,
Russell King - ARM Linux, Paolo Abeni, Jakub Kicinski,
David Miller, Eric Dumazet, Vladimir Oltean
Cc: netdev@vger.kernel.org
On 10/17/2025 10:55 PM, Florian Fainelli wrote:
> On 10/17/25 13:12, Heiner Kallweit wrote:
>> In few places a 100FD fixed PHY is used. Create a helper so that users
>> don't have to define the struct fixed_phy_status.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>> drivers/net/phy/fixed_phy.c | 12 ++++++++++++
>> include/linux/phy_fixed.h | 6 ++++++
>> 2 files changed, 18 insertions(+)
>>
>> diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
>> index 0e1b28f06..bdc3a4bff 100644
>> --- a/drivers/net/phy/fixed_phy.c
>> +++ b/drivers/net/phy/fixed_phy.c
>> @@ -227,6 +227,18 @@ struct phy_device *fixed_phy_register(const struct fixed_phy_status *status,
>> }
>> EXPORT_SYMBOL_GPL(fixed_phy_register);
>> +struct phy_device *fixed_phy_register_100fd(void)
>> +{
>> + static const struct fixed_phy_status status = {
>> + .link = 1,
>> + .speed = SPEED_100,
>> + .duplex = DUPLEX_FULL,
>> + };
>> +
>> + return fixed_phy_register(&status, NULL);
>> +}
>> +EXPORT_SYMBOL_GPL(fixed_phy_register_100fd);
>
> Would not you want this to be a static inline helper directly?
Wouldn't then again each user allocate its own struct fixed_phy_status?
As-is we allocate it only once.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 0/2] net: phy: fixed_phy: add helper fixed_phy_register_100fd
2025-10-17 20:11 [PATCH net-next 0/2] net: phy: fixed_phy: add helper fixed_phy_register_100fd Heiner Kallweit
2025-10-17 20:12 ` [PATCH net-next 1/2] " Heiner Kallweit
2025-10-17 20:14 ` [PATCH net-next 2/2] net: dsa: loop: use new " Heiner Kallweit
@ 2025-10-22 1:20 ` Jakub Kicinski
2025-10-25 18:59 ` Heiner Kallweit
2 siblings, 1 reply; 9+ messages in thread
From: Jakub Kicinski @ 2025-10-22 1:20 UTC (permalink / raw)
To: Heiner Kallweit
Cc: Andrew Lunn, Andrew Lunn, Russell King - ARM Linux, Paolo Abeni,
David Miller, Eric Dumazet, Vladimir Oltean,
netdev@vger.kernel.org
On Fri, 17 Oct 2025 22:11:44 +0200 Heiner Kallweit wrote:
> In few places a 100FD fixed PHY is used. Create a helper so that users
> don't have to define the struct fixed_phy_status. First user is the
> dsa loop driver. A follow-up series will remove the usage of
> fixed_phy_add() from bcm47xx and coldfire/m5272, then this helper
> will be used too.
Not knowing the area too well it looks like struct fixed_phy_status
is an argument struct to make it easier to add / pass thru extra
attrs without having to modify all the callers. This series goes
in the opposite direction trying to make the callers not have to
declare the argument struct.
When reading the code it may also be easier to graps the code if
the definition is local vs having to look at fixed_phy_register_100fd()
Granted the function name kinda makes it obvious what it does.
Lastly: 19 insertions(+), 6 deletions(-)
So the improvement here is not immediately obvious to me.
Maybe it'd be easier to appreciate this series if it was in one
piece with what you mentioned as a follow up?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 0/2] net: phy: fixed_phy: add helper fixed_phy_register_100fd
2025-10-22 1:20 ` [PATCH net-next 0/2] net: phy: fixed_phy: add " Jakub Kicinski
@ 2025-10-25 18:59 ` Heiner Kallweit
0 siblings, 0 replies; 9+ messages in thread
From: Heiner Kallweit @ 2025-10-25 18:59 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Andrew Lunn, Andrew Lunn, Russell King - ARM Linux, Paolo Abeni,
David Miller, Eric Dumazet, Vladimir Oltean,
netdev@vger.kernel.org
On 10/22/2025 3:20 AM, Jakub Kicinski wrote:
> On Fri, 17 Oct 2025 22:11:44 +0200 Heiner Kallweit wrote:
>> In few places a 100FD fixed PHY is used. Create a helper so that users
>> don't have to define the struct fixed_phy_status. First user is the
>> dsa loop driver. A follow-up series will remove the usage of
>> fixed_phy_add() from bcm47xx and coldfire/m5272, then this helper
>> will be used too.
>
> Not knowing the area too well it looks like struct fixed_phy_status
> is an argument struct to make it easier to add / pass thru extra
> attrs without having to modify all the callers. This series goes
> in the opposite direction trying to make the callers not have to
> declare the argument struct.
>
> When reading the code it may also be easier to graps the code if
> the definition is local vs having to look at fixed_phy_register_100fd()
> Granted the function name kinda makes it obvious what it does.
>
> Lastly: 19 insertions(+), 6 deletions(-)
>
> So the improvement here is not immediately obvious to me.
> Maybe it'd be easier to appreciate this series if it was in one
> piece with what you mentioned as a follow up?
Makes sense, I'll prepare and submit the full series.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-10-25 18:59 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-17 20:11 [PATCH net-next 0/2] net: phy: fixed_phy: add helper fixed_phy_register_100fd Heiner Kallweit
2025-10-17 20:12 ` [PATCH net-next 1/2] " Heiner Kallweit
2025-10-17 20:42 ` Gerhard Engleder
2025-10-17 20:55 ` Florian Fainelli
2025-10-17 21:04 ` Heiner Kallweit
2025-10-17 20:14 ` [PATCH net-next 2/2] net: dsa: loop: use new " Heiner Kallweit
2025-10-17 20:43 ` Gerhard Engleder
2025-10-22 1:20 ` [PATCH net-next 0/2] net: phy: fixed_phy: add " Jakub Kicinski
2025-10-25 18:59 ` Heiner Kallweit
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).