net: constify netdev->dev_addr - x86 changes
Subsystems (6)
Jakub Kicinski
maintainercover net: constify netdev->dev_addr - x86 changes
Resending these so they can get merged while I battle random cross builds.
Jakub Kicinski (4):
net: ax88796c: don't write to netdev->dev_addr directly
mlxsw: constify address in mlxsw_sp_port_dev_addr_set
wilc1000: copy address before calling wilc_set_mac_address
ipw2200: constify address in ipw_send_adapter_address
drivers/net/ethernet/asix/ax88796c_main.c | 18 ++++++++++-------- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 2 +- drivers/net/wireless/intel/ipw2x00/ipw2200.c | 2 +- .../net/wireless/microchip/wilc1000/netdev.c | 6 +++--- 4 files changed, 15 insertions(+), 13 deletions(-)
Signature · 1 line
2.31.1
Jakub Kicinski
maintainerPATCH 1/4 net: ax88796c: don't write to netdev->dev_addr directly
The future is here, convert the new driver as we are about to make netdev->dev_addr const.
--- drivers/net/ethernet/asix/ax88796c_main.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/net/ethernet/asix/ax88796c_main.c +10 -8
@@ -144,12 +144,13 @@ static void ax88796c_set_mac_addr(struct net_device *ndev)static void ax88796c_load_mac_addr (struct net_device *ndev) {struct ax88796c_device *ax_local =to_ax88796c_device (ndev); +u8 addr[ETH_ALEN ];u16 temp;lockdep_assert_held (&ax_local->spi_lock);/* Try the device tree first */ -if (!eth_platform_get_mac_address (&ax_local->spi->dev, ndev->dev_addr) && +if (!platform_get_ethdev_address (&ax_local->spi->dev, ndev) &&is_valid_ether_addr (ndev->dev_addr)) {if (netif_msg_probe (ax_local)) dev_info(&ax_local->spi->dev,
@@ -159,18 +160,19 @@ static void ax88796c_load_mac_addr(struct net_device *ndev)/* Read the MAC address from AX88796C */ temp =AX_READ (&ax_local->ax_spi,P3_MACASR0 ); - ndev->dev_addr[5 ] = (u8 )temp; - ndev->dev_addr[4 ] = (u8)(temp >>8 ); + addr[5 ] = (u8 )temp; + addr[4 ] = (u8)(temp >>8 ); temp =AX_READ (&ax_local->ax_spi,P3_MACASR1 ); - ndev->dev_addr[3 ] = (u8 )temp; - ndev->dev_addr[2 ] = (u8)(temp >>8 ); + addr[3 ] = (u8 )temp; + addr[2 ] = (u8)(temp >>8 ); temp =AX_READ (&ax_local->ax_spi,P3_MACASR2 ); - ndev->dev_addr[1 ] = (u8 )temp; - ndev->dev_addr[0 ] = (u8)(temp >>8 ); + addr[1 ] = (u8 )temp; + addr[0 ] = (u8)(temp >>8 ); -if (is_valid_ether_addr (ndev->dev_addr)) { +if (is_valid_ether_addr (addr)) { +eth_hw_addr_set (ndev, addr);if (netif_msg_probe (ax_local))dev_info (&ax_local->spi->dev,"MAC address read from ASIX chip\n" );
Signature · 1 line
2.31.1
Jakub Kicinski
maintainerPATCH 2/4 mlxsw: constify address in mlxsw_sp_port_dev_addr_set
In reply to Jakub KicinskiArgument comes from netdev->dev_addr directly, it needs a const.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +1 -1
@@ -303,7 +303,7 @@ int mlxsw_sp_port_admin_status_set(struct mlxsw_sp_port *mlxsw_sp_port, }static int mlxsw_sp_port_dev_addr_set (struct mlxsw_sp_port *mlxsw_sp_port, -unsigned char *addr) +const unsigned char *addr) {struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;char ppad_pl[MLXSW_REG_PPAD_LEN ];
Signature · 1 line
2.31.1
Jakub Kicinski
maintainerPATCH 3/4 wilc1000: copy address before calling wilc_set_mac_address
In reply to Jakub Kicinskiwilc_set_mac_address() calls IO routines which don't guarantee the pointer won't be written to. Make a copy.
---
CC: [email protected]
CC: [email protected]
--- drivers/net/wireless/microchip/wilc1000/netdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/microchip/wilc1000/netdev.c +3 -3
@@ -574,6 +574,7 @@ static int wilc_mac_open(struct net_device *ndev)struct wilc *wl = vif->wilc;int ret =0 ;struct mgmt_frame_regs mgmt_regs = {}; +u8 addr[ETH_ALEN ]__aligned(2) ;if (!wl || !wl->dev) {netdev_err (ndev,"device not ready\n" );
@@ -596,10 +597,9 @@ static int wilc_mac_open(struct net_device *ndev) vif->idx);if (is_valid_ether_addr (ndev->dev_addr)) { -wilc_set_mac_address (vif, ndev->dev_addr); +ether_addr_copy (addr, ndev->dev_addr); +wilc_set_mac_address (vif, addr); }else { -u8 addr[ETH_ALEN ]; -wilc_get_mac_address (vif, addr);eth_hw_addr_set (ndev, addr); }
Signature · 1 line
2.31.1
Jakub Kicinski
maintainerPATCH 4/4 ipw2200: constify address in ipw_send_adapter_address
In reply to Jakub KicinskiAdd const to the address param of ipw_send_adapter_address() all the functions down the chain have already been changed.
Not sure how I lost this in the rebase.
---
CC: [email protected]
--- drivers/net/wireless/intel/ipw2x00/ipw2200.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/ipw2x00/ipw2200.c +1 -1
@@ -2303,7 +2303,7 @@ static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) ssid); } -static int ipw_send_adapter_address (struct ipw_priv *priv,u8 * mac) +static int ipw_send_adapter_address (struct ipw_priv *priv,const u8 * mac) {if (!priv || !mac) {IPW_ERROR ("Invalid args\n" );
Signature · 1 line
2.31.1
Re: [PATCH net-next 4/4] ipw2200: constify address in ipw_send_adapter_address
Quoted 6 lines · Jakub Kicinski
Add const to the address param of
ipw_send_adapter_address()all the functions down the chain have already been changed.Not sure how I lost this in the rebase.
Quoted 8 lines
Acked-by Kalle Valo <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>---
CC: [email protected]--- drivers/net/wireless/intel/ipw2x00/ipw2200.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
drivers/net/wireless/intel/ipw2x00/ipw2200.c +1
-2@@ -2303,7 +2303,7 @@ static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) ssid); } -static int ipw_send_adapter_address (struct ipw_priv *priv,u8 * mac) +static int ipw_send_adapter_address (struct ipw_priv *priv,const u8 * mac) {if (!priv || !mac) {IPW_ERROR ("Invalid args\n" ); --2.31.1
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 9 lines · On Thu, 18 Nov 2021 06:27:16 -0800 you wrote:
Resending these so they can get merged while I battle random cross builds.
Jakub Kicinski (4):
net: ax88796c: don't write tonetdev->dev_addrdirectly
mlxsw: constify address inmlxsw_sp_port_dev_addr_set
wilc1000: copy address before callingwilc_set_mac_address
ipw2200: constify address inipw_send_adapter_address[...]
Here is the summary with links:
- [net-next,1/4] net: ax88796c: don't write to netdev->dev_addr directly
https://git.kernel.org/netdev/net-next/c/e291422c8f00 - [net-next,2/4] mlxsw: constify address in mlxsw_sp_port_dev_addr_set https://git.kernel.org/netdev/net-next/c/54612b4a8bc7 - [net-next,3/4] wilc1000: copy address before calling wilc_set_mac_address https://git.kernel.org/netdev/net-next/c/b09d58025e3c - [net-next,4/4] ipw2200: constify address in ipw_send_adapter_address https://git.kernel.org/netdev/net-next/c/a608e6794b08
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html