All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] net: phy: improve mdio-boardinfo handling
@ 2025-06-11 20:08 Heiner Kallweit
  2025-06-11 20:09 ` [PATCH net-next 1/4] net: phy: simplify mdiobus_setup_mdiodev_from_board_info Heiner Kallweit
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Heiner Kallweit @ 2025-06-11 20:08 UTC (permalink / raw)
  To: Andrew Lunn, Paolo Abeni, Jakub Kicinski, David Miller,
	Eric Dumazet, Simon Horman, Andrew Lunn, Russell King - ARM Linux
  Cc: netdev@vger.kernel.org

This series includes smaller improvements to mdio-boardinfo handling.

Heiner Kallweit (4):
  net: phy: simplify mdiobus_setup_mdiodev_from_board_info
  net: phy: move definition of struct mdio_board_entry to
    mdio-boardinfo.c
  net: phy: improve mdio-boardinfo.h
  net: phy: directly copy struct mdio_board_info in
    mdiobus_register_board_info

 drivers/net/phy/mdio-boardinfo.c | 29 ++++++++++++++---------------
 drivers/net/phy/mdio-boardinfo.h |  9 ++-------
 2 files changed, 16 insertions(+), 22 deletions(-)

-- 
2.49.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net-next 1/4] net: phy: simplify mdiobus_setup_mdiodev_from_board_info
  2025-06-11 20:08 [PATCH net-next 0/4] net: phy: improve mdio-boardinfo handling Heiner Kallweit
@ 2025-06-11 20:09 ` Heiner Kallweit
  2025-06-13 15:08   ` Andrew Lunn
  2025-06-11 20:10 ` [PATCH net-next 2/4] net: phy: move definition of struct mdio_board_entry to mdio-boardinfo.c Heiner Kallweit
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Heiner Kallweit @ 2025-06-11 20:09 UTC (permalink / raw)
  To: Andrew Lunn, Paolo Abeni, Jakub Kicinski, David Miller,
	Eric Dumazet, Simon Horman, Andrew Lunn, Russell King - ARM Linux
  Cc: netdev@vger.kernel.org

- Move declaration of variable bi into list_for_each_entry_safe()
- The return value of cb() effectively isn't used, this allows to simplify
  the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/mdio-boardinfo.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/net/phy/mdio-boardinfo.c b/drivers/net/phy/mdio-boardinfo.c
index 2de679a68..0360c0d08 100644
--- a/drivers/net/phy/mdio-boardinfo.c
+++ b/drivers/net/phy/mdio-boardinfo.c
@@ -26,24 +26,18 @@ void mdiobus_setup_mdiodev_from_board_info(struct mii_bus *bus,
 					   (struct mii_bus *bus,
 					    struct mdio_board_info *bi))
 {
-	struct mdio_board_entry *be;
-	struct mdio_board_entry *tmp;
-	struct mdio_board_info *bi;
-	int ret;
+	struct mdio_board_entry *be, *tmp;
 
 	mutex_lock(&mdio_board_lock);
 	list_for_each_entry_safe(be, tmp, &mdio_board_list, list) {
-		bi = &be->board_info;
+		struct mdio_board_info *bi = &be->board_info;
 
 		if (strcmp(bus->id, bi->bus_id))
 			continue;
 
 		mutex_unlock(&mdio_board_lock);
-		ret = cb(bus, bi);
+		cb(bus, bi);
 		mutex_lock(&mdio_board_lock);
-		if (ret)
-			continue;
-
 	}
 	mutex_unlock(&mdio_board_lock);
 }
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 2/4] net: phy: move definition of struct mdio_board_entry to mdio-boardinfo.c
  2025-06-11 20:08 [PATCH net-next 0/4] net: phy: improve mdio-boardinfo handling Heiner Kallweit
  2025-06-11 20:09 ` [PATCH net-next 1/4] net: phy: simplify mdiobus_setup_mdiodev_from_board_info Heiner Kallweit
@ 2025-06-11 20:10 ` Heiner Kallweit
  2025-06-13 15:09   ` Andrew Lunn
  2025-06-11 20:11 ` [PATCH net-next 3/4] net: phy: improve mdio-boardinfo.h Heiner Kallweit
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Heiner Kallweit @ 2025-06-11 20:10 UTC (permalink / raw)
  To: Andrew Lunn, Paolo Abeni, Jakub Kicinski, David Miller,
	Eric Dumazet, Simon Horman, Andrew Lunn, Russell King - ARM Linux
  Cc: netdev@vger.kernel.org

Struct mdio_board_entry isn't used outside mdio-boardinfo.c, so remove
the definition from the header file.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/mdio-boardinfo.c | 5 +++++
 drivers/net/phy/mdio-boardinfo.h | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/phy/mdio-boardinfo.c b/drivers/net/phy/mdio-boardinfo.c
index 0360c0d08..2b2728b68 100644
--- a/drivers/net/phy/mdio-boardinfo.c
+++ b/drivers/net/phy/mdio-boardinfo.c
@@ -14,6 +14,11 @@
 static LIST_HEAD(mdio_board_list);
 static DEFINE_MUTEX(mdio_board_lock);
 
+struct mdio_board_entry {
+	struct list_head	list;
+	struct mdio_board_info	board_info;
+};
+
 /**
  * mdiobus_setup_mdiodev_from_board_info - create and setup MDIO devices
  * from pre-collected board specific MDIO information
diff --git a/drivers/net/phy/mdio-boardinfo.h b/drivers/net/phy/mdio-boardinfo.h
index 773bb5139..765c64713 100644
--- a/drivers/net/phy/mdio-boardinfo.h
+++ b/drivers/net/phy/mdio-boardinfo.h
@@ -10,11 +10,6 @@
 #include <linux/phy.h>
 #include <linux/mutex.h>
 
-struct mdio_board_entry {
-	struct list_head	list;
-	struct mdio_board_info	board_info;
-};
-
 void mdiobus_setup_mdiodev_from_board_info(struct mii_bus *bus,
 					   int (*cb)
 					   (struct mii_bus *bus,
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 3/4] net: phy: improve mdio-boardinfo.h
  2025-06-11 20:08 [PATCH net-next 0/4] net: phy: improve mdio-boardinfo handling Heiner Kallweit
  2025-06-11 20:09 ` [PATCH net-next 1/4] net: phy: simplify mdiobus_setup_mdiodev_from_board_info Heiner Kallweit
  2025-06-11 20:10 ` [PATCH net-next 2/4] net: phy: move definition of struct mdio_board_entry to mdio-boardinfo.c Heiner Kallweit
@ 2025-06-11 20:11 ` Heiner Kallweit
  2025-06-13 15:09   ` Andrew Lunn
  2025-06-11 20:13 ` [PATCH net-next 4/4] net: phy: directly copy struct mdio_board_info in mdiobus_register_board_info Heiner Kallweit
  2025-06-14  0:20 ` [PATCH net-next 0/4] net: phy: improve mdio-boardinfo handling patchwork-bot+netdevbpf
  4 siblings, 1 reply; 10+ messages in thread
From: Heiner Kallweit @ 2025-06-11 20:11 UTC (permalink / raw)
  To: Andrew Lunn, Paolo Abeni, Jakub Kicinski, David Miller,
	Eric Dumazet, Simon Horman, Andrew Lunn, Russell King - ARM Linux
  Cc: netdev@vger.kernel.org

There's no need to include phy.h and mutex.h in mdio-boardinfo.h.
However mdio-boardinfo.c included phy.h indirectly this way so far,
include it explicitly instead. Whilst at it, sort the included
headers properly.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/mdio-boardinfo.c | 7 ++++---
 drivers/net/phy/mdio-boardinfo.h | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/phy/mdio-boardinfo.c b/drivers/net/phy/mdio-boardinfo.c
index 2b2728b68..b1e7a5920 100644
--- a/drivers/net/phy/mdio-boardinfo.c
+++ b/drivers/net/phy/mdio-boardinfo.c
@@ -3,11 +3,12 @@
  * mdio-boardinfo - Collect pre-declarations for MDIO devices
  */
 
-#include <linux/kernel.h>
-#include <linux/slab.h>
 #include <linux/export.h>
-#include <linux/mutex.h>
+#include <linux/kernel.h>
 #include <linux/list.h>
+#include <linux/mutex.h>
+#include <linux/phy.h>
+#include <linux/slab.h>
 
 #include "mdio-boardinfo.h"
 
diff --git a/drivers/net/phy/mdio-boardinfo.h b/drivers/net/phy/mdio-boardinfo.h
index 765c64713..0878b7787 100644
--- a/drivers/net/phy/mdio-boardinfo.h
+++ b/drivers/net/phy/mdio-boardinfo.h
@@ -7,8 +7,8 @@
 #ifndef __MDIO_BOARD_INFO_H
 #define __MDIO_BOARD_INFO_H
 
-#include <linux/phy.h>
-#include <linux/mutex.h>
+struct mii_bus;
+struct mdio_board_info;
 
 void mdiobus_setup_mdiodev_from_board_info(struct mii_bus *bus,
 					   int (*cb)
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 4/4] net: phy: directly copy struct mdio_board_info in mdiobus_register_board_info
  2025-06-11 20:08 [PATCH net-next 0/4] net: phy: improve mdio-boardinfo handling Heiner Kallweit
                   ` (2 preceding siblings ...)
  2025-06-11 20:11 ` [PATCH net-next 3/4] net: phy: improve mdio-boardinfo.h Heiner Kallweit
@ 2025-06-11 20:13 ` Heiner Kallweit
  2025-06-13 15:10   ` Andrew Lunn
  2025-06-14  0:20 ` [PATCH net-next 0/4] net: phy: improve mdio-boardinfo handling patchwork-bot+netdevbpf
  4 siblings, 1 reply; 10+ messages in thread
From: Heiner Kallweit @ 2025-06-11 20:13 UTC (permalink / raw)
  To: Andrew Lunn, Paolo Abeni, Jakub Kicinski, David Miller,
	Eric Dumazet, Simon Horman, Andrew Lunn, Russell King - ARM Linux
  Cc: netdev@vger.kernel.org

Using a direct assignment instead of memcpy reduces the text segment
size from 0x273 bytes to 0x19b bytes in my case.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/mdio-boardinfo.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/mdio-boardinfo.c b/drivers/net/phy/mdio-boardinfo.c
index b1e7a5920..d3184e8f1 100644
--- a/drivers/net/phy/mdio-boardinfo.c
+++ b/drivers/net/phy/mdio-boardinfo.c
@@ -62,14 +62,13 @@ int mdiobus_register_board_info(const struct mdio_board_info *info,
 				unsigned int n)
 {
 	struct mdio_board_entry *be;
-	unsigned int i;
 
 	be = kcalloc(n, sizeof(*be), GFP_KERNEL);
 	if (!be)
 		return -ENOMEM;
 
-	for (i = 0; i < n; i++, be++, info++) {
-		memcpy(&be->board_info, info, sizeof(*info));
+	for (int i = 0; i < n; i++, be++) {
+		be->board_info = info[i];
 		mutex_lock(&mdio_board_lock);
 		list_add_tail(&be->list, &mdio_board_list);
 		mutex_unlock(&mdio_board_lock);
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 1/4] net: phy: simplify mdiobus_setup_mdiodev_from_board_info
  2025-06-11 20:09 ` [PATCH net-next 1/4] net: phy: simplify mdiobus_setup_mdiodev_from_board_info Heiner Kallweit
@ 2025-06-13 15:08   ` Andrew Lunn
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Lunn @ 2025-06-13 15:08 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Andrew Lunn, Paolo Abeni, Jakub Kicinski, David Miller,
	Eric Dumazet, Simon Horman, Russell King - ARM Linux,
	netdev@vger.kernel.org

On Wed, Jun 11, 2025 at 10:09:36PM +0200, Heiner Kallweit wrote:
> - Move declaration of variable bi into list_for_each_entry_safe()
> - The return value of cb() effectively isn't used, this allows to simplify
>   the code.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 2/4] net: phy: move definition of struct mdio_board_entry to mdio-boardinfo.c
  2025-06-11 20:10 ` [PATCH net-next 2/4] net: phy: move definition of struct mdio_board_entry to mdio-boardinfo.c Heiner Kallweit
@ 2025-06-13 15:09   ` Andrew Lunn
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Lunn @ 2025-06-13 15:09 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Andrew Lunn, Paolo Abeni, Jakub Kicinski, David Miller,
	Eric Dumazet, Simon Horman, Russell King - ARM Linux,
	netdev@vger.kernel.org

On Wed, Jun 11, 2025 at 10:10:27PM +0200, Heiner Kallweit wrote:
> Struct mdio_board_entry isn't used outside mdio-boardinfo.c, so remove
> the definition from the header file.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 3/4] net: phy: improve mdio-boardinfo.h
  2025-06-11 20:11 ` [PATCH net-next 3/4] net: phy: improve mdio-boardinfo.h Heiner Kallweit
@ 2025-06-13 15:09   ` Andrew Lunn
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Lunn @ 2025-06-13 15:09 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Andrew Lunn, Paolo Abeni, Jakub Kicinski, David Miller,
	Eric Dumazet, Simon Horman, Russell King - ARM Linux,
	netdev@vger.kernel.org

On Wed, Jun 11, 2025 at 10:11:21PM +0200, Heiner Kallweit wrote:
> There's no need to include phy.h and mutex.h in mdio-boardinfo.h.
> However mdio-boardinfo.c included phy.h indirectly this way so far,
> include it explicitly instead. Whilst at it, sort the included
> headers properly.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 4/4] net: phy: directly copy struct mdio_board_info in mdiobus_register_board_info
  2025-06-11 20:13 ` [PATCH net-next 4/4] net: phy: directly copy struct mdio_board_info in mdiobus_register_board_info Heiner Kallweit
@ 2025-06-13 15:10   ` Andrew Lunn
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Lunn @ 2025-06-13 15:10 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Andrew Lunn, Paolo Abeni, Jakub Kicinski, David Miller,
	Eric Dumazet, Simon Horman, Russell King - ARM Linux,
	netdev@vger.kernel.org

On Wed, Jun 11, 2025 at 10:13:02PM +0200, Heiner Kallweit wrote:
> Using a direct assignment instead of memcpy reduces the text segment
> size from 0x273 bytes to 0x19b bytes in my case.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 0/4] net: phy: improve mdio-boardinfo handling
  2025-06-11 20:08 [PATCH net-next 0/4] net: phy: improve mdio-boardinfo handling Heiner Kallweit
                   ` (3 preceding siblings ...)
  2025-06-11 20:13 ` [PATCH net-next 4/4] net: phy: directly copy struct mdio_board_info in mdiobus_register_board_info Heiner Kallweit
@ 2025-06-14  0:20 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-06-14  0:20 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: andrew+netdev, pabeni, kuba, davem, edumazet, horms, andrew,
	linux, netdev

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 11 Jun 2025 22:08:47 +0200 you wrote:
> This series includes smaller improvements to mdio-boardinfo handling.
> 
> Heiner Kallweit (4):
>   net: phy: simplify mdiobus_setup_mdiodev_from_board_info
>   net: phy: move definition of struct mdio_board_entry to
>     mdio-boardinfo.c
>   net: phy: improve mdio-boardinfo.h
>   net: phy: directly copy struct mdio_board_info in
>     mdiobus_register_board_info
> 
> [...]

Here is the summary with links:
  - [net-next,1/4] net: phy: simplify mdiobus_setup_mdiodev_from_board_info
    https://git.kernel.org/netdev/net-next/c/0893bf6bb414
  - [net-next,2/4] net: phy: move definition of struct mdio_board_entry to mdio-boardinfo.c
    https://git.kernel.org/netdev/net-next/c/db4920604a3f
  - [net-next,3/4] net: phy: improve mdio-boardinfo.h
    https://git.kernel.org/netdev/net-next/c/11d40db27155
  - [net-next,4/4] net: phy: directly copy struct mdio_board_info in mdiobus_register_board_info
    https://git.kernel.org/netdev/net-next/c/f59fdcef3a58

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-06-14  0:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-11 20:08 [PATCH net-next 0/4] net: phy: improve mdio-boardinfo handling Heiner Kallweit
2025-06-11 20:09 ` [PATCH net-next 1/4] net: phy: simplify mdiobus_setup_mdiodev_from_board_info Heiner Kallweit
2025-06-13 15:08   ` Andrew Lunn
2025-06-11 20:10 ` [PATCH net-next 2/4] net: phy: move definition of struct mdio_board_entry to mdio-boardinfo.c Heiner Kallweit
2025-06-13 15:09   ` Andrew Lunn
2025-06-11 20:11 ` [PATCH net-next 3/4] net: phy: improve mdio-boardinfo.h Heiner Kallweit
2025-06-13 15:09   ` Andrew Lunn
2025-06-11 20:13 ` [PATCH net-next 4/4] net: phy: directly copy struct mdio_board_info in mdiobus_register_board_info Heiner Kallweit
2025-06-13 15:10   ` Andrew Lunn
2025-06-14  0:20 ` [PATCH net-next 0/4] net: phy: improve mdio-boardinfo handling patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.