From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>,
David Miller <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Simon Horman <horms@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH net-next 4/4] net: phy: directly copy struct mdio_board_info in mdiobus_register_board_info
Date: Wed, 11 Jun 2025 22:13:02 +0200 [thread overview]
Message-ID: <af371f2a-42f3-4d94-80b9-3420380a3f6f@gmail.com> (raw)
In-Reply-To: <6ae7bda0-c093-468a-8ac0-50a2afa73c45@gmail.com>
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
next prev parent reply other threads:[~2025-06-11 20:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Heiner Kallweit [this message]
2025-06-13 15:10 ` [PATCH net-next 4/4] net: phy: directly copy struct mdio_board_info in mdiobus_register_board_info Andrew Lunn
2025-06-14 0:20 ` [PATCH net-next 0/4] net: phy: improve mdio-boardinfo handling patchwork-bot+netdevbpf
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=af371f2a-42f3-4d94-80b9-3420380a3f6f@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 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.