* [PATCH] net: phy: motorcomm: make const array mac_addr_reg static
@ 2025-08-07 13:15 Colin Ian King
2025-08-08 18:48 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2025-08-07 13:15 UTC (permalink / raw)
To: Frank, Andrew Lunn, Heiner Kallweit, Russell King,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev
Cc: kernel-janitors, linux-kernel
Don't populate the const read-only arrays mac_addr_reg on the stack at
run time, instead make them static, this reduces the object code size.
Size before:
text data bss dec hex filename
65066 11352 0 76418 12a82 drivers/net/phy/motorcomm.o
Size after:
text data bss dec hex filename
64761 11512 0 76273 129f1 drivers/net/phy/motorcomm.o
Reducton of 145 bytes (gcc 14.2.0 x86-64)
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
drivers/net/phy/motorcomm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c
index 0e91f5d1a4fd..aeae7ec897c6 100644
--- a/drivers/net/phy/motorcomm.c
+++ b/drivers/net/phy/motorcomm.c
@@ -536,7 +536,7 @@ static void ytphy_get_wol(struct phy_device *phydev,
static int ytphy_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
{
struct net_device *p_attached_dev;
- const u16 mac_addr_reg[] = {
+ static const u16 mac_addr_reg[] = {
YTPHY_WOL_MACADDR2_REG,
YTPHY_WOL_MACADDR1_REG,
YTPHY_WOL_MACADDR0_REG,
@@ -608,7 +608,7 @@ static int ytphy_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
static int yt8531_set_wol(struct phy_device *phydev,
struct ethtool_wolinfo *wol)
{
- const u16 mac_addr_reg[] = {
+ static const u16 mac_addr_reg[] = {
YTPHY_WOL_MACADDR2_REG,
YTPHY_WOL_MACADDR1_REG,
YTPHY_WOL_MACADDR0_REG,
--
2.50.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: phy: motorcomm: make const array mac_addr_reg static
2025-08-07 13:15 [PATCH] net: phy: motorcomm: make const array mac_addr_reg static Colin Ian King
@ 2025-08-08 18:48 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2025-08-08 18:48 UTC (permalink / raw)
To: Colin Ian King
Cc: Frank, Andrew Lunn, Heiner Kallweit, Russell King,
David S . Miller, Eric Dumazet, Paolo Abeni, netdev,
kernel-janitors, linux-kernel
On Thu, 7 Aug 2025 14:15:04 +0100 Colin Ian King wrote:
> Don't populate the const read-only arrays mac_addr_reg on the stack at
> run time, instead make them static, this reduces the object code size.
>
> Size before:
> text data bss dec hex filename
> 65066 11352 0 76418 12a82 drivers/net/phy/motorcomm.o
>
> Size after:
> text data bss dec hex filename
> 64761 11512 0 76273 129f1 drivers/net/phy/motorcomm.o
## Form letter - net-next-closed
We have already submitted our pull request with net-next material for v6.17,
and therefore net-next is closed for new drivers, features, code refactoring
and optimizations. We are currently accepting bug fixes only.
Please repost when net-next reopens after Aug 11th.
RFC patches sent for review only are obviously welcome at any time.
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
--
pw-bot: defer
pv-bot: closed
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-08 18:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07 13:15 [PATCH] net: phy: motorcomm: make const array mac_addr_reg static Colin Ian King
2025-08-08 18:48 ` Jakub Kicinski
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).