netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] i825xx: sni_82596: use eth_hw_addr_set()
@ 2023-03-15 13:41 Thomas Bogendoerfer
  2023-03-15 18:12 ` Michal Kubiak
  2023-03-17  0:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2023-03-15 13:41 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel

Copy scrambled mac address octects into an array then eth_hw_addr_set().

Fixes: adeef3e32146 ("net: constify netdev->dev_addr")
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---
 drivers/net/ethernet/i825xx/sni_82596.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/i825xx/sni_82596.c b/drivers/net/ethernet/i825xx/sni_82596.c
index daec9ce04531..54bb4d9a0d1e 100644
--- a/drivers/net/ethernet/i825xx/sni_82596.c
+++ b/drivers/net/ethernet/i825xx/sni_82596.c
@@ -78,6 +78,7 @@ static int sni_82596_probe(struct platform_device *dev)
 	void __iomem *mpu_addr;
 	void __iomem *ca_addr;
 	u8 __iomem *eth_addr;
+	u8 mac[ETH_ALEN];
 
 	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
 	ca = platform_get_resource(dev, IORESOURCE_MEM, 1);
@@ -109,12 +110,13 @@ static int sni_82596_probe(struct platform_device *dev)
 		goto probe_failed;
 
 	/* someone seems to like messed up stuff */
-	netdevice->dev_addr[0] = readb(eth_addr + 0x0b);
-	netdevice->dev_addr[1] = readb(eth_addr + 0x0a);
-	netdevice->dev_addr[2] = readb(eth_addr + 0x09);
-	netdevice->dev_addr[3] = readb(eth_addr + 0x08);
-	netdevice->dev_addr[4] = readb(eth_addr + 0x07);
-	netdevice->dev_addr[5] = readb(eth_addr + 0x06);
+	mac[0] = readb(eth_addr + 0x0b);
+	mac[1] = readb(eth_addr + 0x0a);
+	mac[2] = readb(eth_addr + 0x09);
+	mac[3] = readb(eth_addr + 0x08);
+	mac[4] = readb(eth_addr + 0x07);
+	mac[5] = readb(eth_addr + 0x06);
+	eth_hw_addr_set(netdevice, mac);
 	iounmap(eth_addr);
 
 	if (netdevice->irq < 0) {
-- 
2.35.3


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

* Re: [PATCH net] i825xx: sni_82596: use eth_hw_addr_set()
  2023-03-15 13:41 [PATCH net] i825xx: sni_82596: use eth_hw_addr_set() Thomas Bogendoerfer
@ 2023-03-15 18:12 ` Michal Kubiak
  2023-03-17  0:36   ` Jakub Kicinski
  2023-03-17  0:40 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Michal Kubiak @ 2023-03-15 18:12 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel

On Wed, Mar 15, 2023 at 02:41:17PM +0100, Thomas Bogendoerfer wrote:
> Copy scrambled mac address octects into an array then eth_hw_addr_set().
> 
> Fixes: adeef3e32146 ("net: constify netdev->dev_addr")
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> ---
>  drivers/net/ethernet/i825xx/sni_82596.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/i825xx/sni_82596.c b/drivers/net/ethernet/i825xx/sni_82596.c
> index daec9ce04531..54bb4d9a0d1e 100644
> --- a/drivers/net/ethernet/i825xx/sni_82596.c
> +++ b/drivers/net/ethernet/i825xx/sni_82596.c
> @@ -78,6 +78,7 @@ static int sni_82596_probe(struct platform_device *dev)
>  	void __iomem *mpu_addr;
>  	void __iomem *ca_addr;
>  	u8 __iomem *eth_addr;
> +	u8 mac[ETH_ALEN];
>  
>  	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
>  	ca = platform_get_resource(dev, IORESOURCE_MEM, 1);
> @@ -109,12 +110,13 @@ static int sni_82596_probe(struct platform_device *dev)
>  		goto probe_failed;
>  
>  	/* someone seems to like messed up stuff */
> -	netdevice->dev_addr[0] = readb(eth_addr + 0x0b);
> -	netdevice->dev_addr[1] = readb(eth_addr + 0x0a);
> -	netdevice->dev_addr[2] = readb(eth_addr + 0x09);
> -	netdevice->dev_addr[3] = readb(eth_addr + 0x08);
> -	netdevice->dev_addr[4] = readb(eth_addr + 0x07);
> -	netdevice->dev_addr[5] = readb(eth_addr + 0x06);
> +	mac[0] = readb(eth_addr + 0x0b);
> +	mac[1] = readb(eth_addr + 0x0a);
> +	mac[2] = readb(eth_addr + 0x09);
> +	mac[3] = readb(eth_addr + 0x08);
> +	mac[4] = readb(eth_addr + 0x07);
> +	mac[5] = readb(eth_addr + 0x06);
> +	eth_hw_addr_set(netdevice, mac);
>  	iounmap(eth_addr);
>  
>  	if (netdevice->irq < 0) {
> -- 
> 2.35.3
> 

The fix looks fine. Good catch!
I would only suggest to add more description why it needed to be
changed.
(The current version of the commit message only contains information what
was done, but it is quite obvious by looking at the code).

Thanks,
Michal

Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>


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

* Re: [PATCH net] i825xx: sni_82596: use eth_hw_addr_set()
  2023-03-15 18:12 ` Michal Kubiak
@ 2023-03-17  0:36   ` Jakub Kicinski
  0 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2023-03-17  0:36 UTC (permalink / raw)
  To: Michal Kubiak
  Cc: Thomas Bogendoerfer, David S. Miller, Eric Dumazet, Paolo Abeni,
	netdev, linux-kernel

On Wed, 15 Mar 2023 19:12:03 +0100 Michal Kubiak wrote:
> The fix looks fine. Good catch!
> I would only suggest to add more description why it needed to be
> changed.
> (The current version of the commit message only contains information what
> was done, but it is quite obvious by looking at the code).

Let me make an exception and add that info myself.. since I broke this
:)

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

* Re: [PATCH net] i825xx: sni_82596: use eth_hw_addr_set()
  2023-03-15 13:41 [PATCH net] i825xx: sni_82596: use eth_hw_addr_set() Thomas Bogendoerfer
  2023-03-15 18:12 ` Michal Kubiak
@ 2023-03-17  0:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-17  0:40 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: davem, edumazet, kuba, pabeni, netdev, linux-kernel

Hello:

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

On Wed, 15 Mar 2023 14:41:17 +0100 you wrote:
> Copy scrambled mac address octects into an array then eth_hw_addr_set().
> 
> Fixes: adeef3e32146 ("net: constify netdev->dev_addr")
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> ---
>  drivers/net/ethernet/i825xx/sni_82596.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)

Here is the summary with links:
  - [net] i825xx: sni_82596: use eth_hw_addr_set()
    https://git.kernel.org/netdev/net/c/f38373345c65

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

end of thread, other threads:[~2023-03-17  0:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-15 13:41 [PATCH net] i825xx: sni_82596: use eth_hw_addr_set() Thomas Bogendoerfer
2023-03-15 18:12 ` Michal Kubiak
2023-03-17  0:36   ` Jakub Kicinski
2023-03-17  0:40 ` 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).