netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: natsemi: fix hw address initialization for jazz and xtensa
@ 2021-11-30 14:36 Max Filippov
  2021-11-30 15:35 ` Randy Dunlap
  2021-12-01  2:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Max Filippov @ 2021-11-30 14:36 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, Max Filippov, Randy Dunlap, David S. Miller,
	Jakub Kicinski

Use eth_hw_addr_set function instead of writing the address directly to
net_device::dev_addr.

Fixes: adeef3e32146 ("net: constify netdev->dev_addr")
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
---
 drivers/net/ethernet/natsemi/jazzsonic.c | 6 ++++--
 drivers/net/ethernet/natsemi/xtsonic.c   | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/natsemi/jazzsonic.c b/drivers/net/ethernet/natsemi/jazzsonic.c
index d74a80f010c5..3f371faeb6d0 100644
--- a/drivers/net/ethernet/natsemi/jazzsonic.c
+++ b/drivers/net/ethernet/natsemi/jazzsonic.c
@@ -114,6 +114,7 @@ static int sonic_probe1(struct net_device *dev)
 	struct sonic_local *lp = netdev_priv(dev);
 	int err = -ENODEV;
 	int i;
+	unsigned char addr[ETH_ALEN];
 
 	if (!request_mem_region(dev->base_addr, SONIC_MEM_SIZE, jazz_sonic_string))
 		return -EBUSY;
@@ -143,9 +144,10 @@ static int sonic_probe1(struct net_device *dev)
 	SONIC_WRITE(SONIC_CEP,0);
 	for (i=0; i<3; i++) {
 		val = SONIC_READ(SONIC_CAP0-i);
-		dev->dev_addr[i*2] = val;
-		dev->dev_addr[i*2+1] = val >> 8;
+		addr[i*2] = val;
+		addr[i*2+1] = val >> 8;
 	}
+	eth_hw_addr_set(dev, addr);
 
 	lp->dma_bitmode = SONIC_BITMODE32;
 
diff --git a/drivers/net/ethernet/natsemi/xtsonic.c b/drivers/net/ethernet/natsemi/xtsonic.c
index ca4686094701..7d51bcb1b918 100644
--- a/drivers/net/ethernet/natsemi/xtsonic.c
+++ b/drivers/net/ethernet/natsemi/xtsonic.c
@@ -127,6 +127,7 @@ static int __init sonic_probe1(struct net_device *dev)
 	unsigned int base_addr = dev->base_addr;
 	int i;
 	int err = 0;
+	unsigned char addr[ETH_ALEN];
 
 	if (!request_mem_region(base_addr, 0x100, xtsonic_string))
 		return -EBUSY;
@@ -163,9 +164,10 @@ static int __init sonic_probe1(struct net_device *dev)
 
 	for (i=0; i<3; i++) {
 		unsigned int val = SONIC_READ(SONIC_CAP0-i);
-		dev->dev_addr[i*2] = val;
-		dev->dev_addr[i*2+1] = val >> 8;
+		addr[i*2] = val;
+		addr[i*2+1] = val >> 8;
 	}
+	eth_hw_addr_set(dev, addr);
 
 	lp->dma_bitmode = SONIC_BITMODE32;
 
-- 
2.20.1


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

* Re: [PATCH] net: natsemi: fix hw address initialization for jazz and xtensa
  2021-11-30 14:36 [PATCH] net: natsemi: fix hw address initialization for jazz and xtensa Max Filippov
@ 2021-11-30 15:35 ` Randy Dunlap
  2021-12-01  2:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2021-11-30 15:35 UTC (permalink / raw)
  To: Max Filippov, netdev; +Cc: linux-kernel, David S. Miller, Jakub Kicinski

Hi Max,

On 11/30/21 06:36, Max Filippov wrote:
> Use eth_hw_addr_set function instead of writing the address directly to
> net_device::dev_addr.
> 
> Fixes: adeef3e32146 ("net: constify netdev->dev_addr")
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> Cc: Randy Dunlap <rdunlap@infradead.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Jakub Kicinski <kuba@kernel.org>
Looks good. Thanks.

Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested

> ---
>  drivers/net/ethernet/natsemi/jazzsonic.c | 6 ++++--
>  drivers/net/ethernet/natsemi/xtsonic.c   | 6 ++++--
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/natsemi/jazzsonic.c b/drivers/net/ethernet/natsemi/jazzsonic.c
> index d74a80f010c5..3f371faeb6d0 100644
> --- a/drivers/net/ethernet/natsemi/jazzsonic.c
> +++ b/drivers/net/ethernet/natsemi/jazzsonic.c
> @@ -114,6 +114,7 @@ static int sonic_probe1(struct net_device *dev)
>  	struct sonic_local *lp = netdev_priv(dev);
>  	int err = -ENODEV;
>  	int i;
> +	unsigned char addr[ETH_ALEN];
>  
>  	if (!request_mem_region(dev->base_addr, SONIC_MEM_SIZE, jazz_sonic_string))
>  		return -EBUSY;
> @@ -143,9 +144,10 @@ static int sonic_probe1(struct net_device *dev)
>  	SONIC_WRITE(SONIC_CEP,0);
>  	for (i=0; i<3; i++) {
>  		val = SONIC_READ(SONIC_CAP0-i);
> -		dev->dev_addr[i*2] = val;
> -		dev->dev_addr[i*2+1] = val >> 8;
> +		addr[i*2] = val;
> +		addr[i*2+1] = val >> 8;
>  	}
> +	eth_hw_addr_set(dev, addr);
>  
>  	lp->dma_bitmode = SONIC_BITMODE32;
>  
> diff --git a/drivers/net/ethernet/natsemi/xtsonic.c b/drivers/net/ethernet/natsemi/xtsonic.c
> index ca4686094701..7d51bcb1b918 100644
> --- a/drivers/net/ethernet/natsemi/xtsonic.c
> +++ b/drivers/net/ethernet/natsemi/xtsonic.c
> @@ -127,6 +127,7 @@ static int __init sonic_probe1(struct net_device *dev)
>  	unsigned int base_addr = dev->base_addr;
>  	int i;
>  	int err = 0;
> +	unsigned char addr[ETH_ALEN];
>  
>  	if (!request_mem_region(base_addr, 0x100, xtsonic_string))
>  		return -EBUSY;
> @@ -163,9 +164,10 @@ static int __init sonic_probe1(struct net_device *dev)
>  
>  	for (i=0; i<3; i++) {
>  		unsigned int val = SONIC_READ(SONIC_CAP0-i);
> -		dev->dev_addr[i*2] = val;
> -		dev->dev_addr[i*2+1] = val >> 8;
> +		addr[i*2] = val;
> +		addr[i*2+1] = val >> 8;
>  	}
> +	eth_hw_addr_set(dev, addr);
>  
>  	lp->dma_bitmode = SONIC_BITMODE32;
>  
> 

-- 
~Randy

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

* Re: [PATCH] net: natsemi: fix hw address initialization for jazz and xtensa
  2021-11-30 14:36 [PATCH] net: natsemi: fix hw address initialization for jazz and xtensa Max Filippov
  2021-11-30 15:35 ` Randy Dunlap
@ 2021-12-01  2:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-12-01  2:50 UTC (permalink / raw)
  To: Max Filippov; +Cc: netdev, linux-kernel, rdunlap, davem, kuba

Hello:

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

On Tue, 30 Nov 2021 06:36:00 -0800 you wrote:
> Use eth_hw_addr_set function instead of writing the address directly to
> net_device::dev_addr.
> 
> Fixes: adeef3e32146 ("net: constify netdev->dev_addr")
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> Cc: Randy Dunlap <rdunlap@infradead.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Jakub Kicinski <kuba@kernel.org>
> 
> [...]

Here is the summary with links:
  - net: natsemi: fix hw address initialization for jazz and xtensa
    https://git.kernel.org/netdev/net-next/c/23ea630f86c7

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] 3+ messages in thread

end of thread, other threads:[~2021-12-01  2:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-30 14:36 [PATCH] net: natsemi: fix hw address initialization for jazz and xtensa Max Filippov
2021-11-30 15:35 ` Randy Dunlap
2021-12-01  2:50 ` patchwork-bot+netdevbpf

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).