* [PATCH] net: apple: bmac: Fix build since dev_addr constification
@ 2022-01-14 3:13 ` Michael Ellerman
0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2022-01-14 3:13 UTC (permalink / raw)
To: netdev, kuba, davem; +Cc: linuxppc-dev
Since commit adeef3e32146 ("net: constify netdev->dev_addr") the bmac
driver no longer builds with the following errors (pmac32_defconfig):
linux/drivers/net/ethernet/apple/bmac.c: In function ‘bmac_probe’:
linux/drivers/net/ethernet/apple/bmac.c:1287:20: error: assignment of read-only location ‘*(dev->dev_addr + (sizetype)j)’
1287 | dev->dev_addr[j] = rev ? bitrev8(addr[j]): addr[j];
| ^
Fix it by making the modifications to a local macaddr variable and then
passing that to eth_hw_addr_set().
We don't use the existing addr variable because the bitrev8() would
mutate it, but it is already used unreversed later in the function.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
drivers/net/ethernet/apple/bmac.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c
index 9a650d1c1bdd..4d2ba30c2fbd 100644
--- a/drivers/net/ethernet/apple/bmac.c
+++ b/drivers/net/ethernet/apple/bmac.c
@@ -1237,6 +1237,7 @@ static int bmac_probe(struct macio_dev *mdev, const struct of_device_id *match)
struct bmac_data *bp;
const unsigned char *prop_addr;
unsigned char addr[6];
+ u8 macaddr[6];
struct net_device *dev;
int is_bmac_plus = ((int)match->data) != 0;
@@ -1284,7 +1285,9 @@ static int bmac_probe(struct macio_dev *mdev, const struct of_device_id *match)
rev = addr[0] == 0 && addr[1] == 0xA0;
for (j = 0; j < 6; ++j)
- dev->dev_addr[j] = rev ? bitrev8(addr[j]): addr[j];
+ macaddr[j] = rev ? bitrev8(addr[j]): addr[j];
+
+ eth_hw_addr_set(dev, macaddr);
/* Enable chip without interrupts for now */
bmac_enable_and_reset_chip(dev);
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] net: apple: bmac: Fix build since dev_addr constification
@ 2022-01-14 3:13 ` Michael Ellerman
0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2022-01-14 3:13 UTC (permalink / raw)
To: netdev, kuba, davem; +Cc: linuxppc-dev
Since commit adeef3e32146 ("net: constify netdev->dev_addr") the bmac
driver no longer builds with the following errors (pmac32_defconfig):
linux/drivers/net/ethernet/apple/bmac.c: In function ‘bmac_probe’:
linux/drivers/net/ethernet/apple/bmac.c:1287:20: error: assignment of read-only location ‘*(dev->dev_addr + (sizetype)j)’
1287 | dev->dev_addr[j] = rev ? bitrev8(addr[j]): addr[j];
| ^
Fix it by making the modifications to a local macaddr variable and then
passing that to eth_hw_addr_set().
We don't use the existing addr variable because the bitrev8() would
mutate it, but it is already used unreversed later in the function.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
drivers/net/ethernet/apple/bmac.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c
index 9a650d1c1bdd..4d2ba30c2fbd 100644
--- a/drivers/net/ethernet/apple/bmac.c
+++ b/drivers/net/ethernet/apple/bmac.c
@@ -1237,6 +1237,7 @@ static int bmac_probe(struct macio_dev *mdev, const struct of_device_id *match)
struct bmac_data *bp;
const unsigned char *prop_addr;
unsigned char addr[6];
+ u8 macaddr[6];
struct net_device *dev;
int is_bmac_plus = ((int)match->data) != 0;
@@ -1284,7 +1285,9 @@ static int bmac_probe(struct macio_dev *mdev, const struct of_device_id *match)
rev = addr[0] == 0 && addr[1] == 0xA0;
for (j = 0; j < 6; ++j)
- dev->dev_addr[j] = rev ? bitrev8(addr[j]): addr[j];
+ macaddr[j] = rev ? bitrev8(addr[j]): addr[j];
+
+ eth_hw_addr_set(dev, macaddr);
/* Enable chip without interrupts for now */
bmac_enable_and_reset_chip(dev);
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] net: apple: bmac: Fix build since dev_addr constification
2022-01-14 3:13 ` Michael Ellerman
@ 2022-01-14 4:21 ` Jakub Kicinski
-1 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2022-01-14 4:21 UTC (permalink / raw)
To: Michael Ellerman; +Cc: netdev, davem, linuxppc-dev
On Fri, 14 Jan 2022 14:13:16 +1100 Michael Ellerman wrote:
> Since commit adeef3e32146 ("net: constify netdev->dev_addr") the bmac
> driver no longer builds with the following errors (pmac32_defconfig):
>
> linux/drivers/net/ethernet/apple/bmac.c: In function ‘bmac_probe’:
> linux/drivers/net/ethernet/apple/bmac.c:1287:20: error: assignment of read-only location ‘*(dev->dev_addr + (sizetype)j)’
> 1287 | dev->dev_addr[j] = rev ? bitrev8(addr[j]): addr[j];
> | ^
>
> Fix it by making the modifications to a local macaddr variable and then
> passing that to eth_hw_addr_set().
>
> We don't use the existing addr variable because the bitrev8() would
> mutate it, but it is already used unreversed later in the function.
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Thank you!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] net: apple: bmac: Fix build since dev_addr constification
@ 2022-01-14 4:21 ` Jakub Kicinski
0 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2022-01-14 4:21 UTC (permalink / raw)
To: Michael Ellerman; +Cc: netdev, linuxppc-dev, davem
On Fri, 14 Jan 2022 14:13:16 +1100 Michael Ellerman wrote:
> Since commit adeef3e32146 ("net: constify netdev->dev_addr") the bmac
> driver no longer builds with the following errors (pmac32_defconfig):
>
> linux/drivers/net/ethernet/apple/bmac.c: In function ‘bmac_probe’:
> linux/drivers/net/ethernet/apple/bmac.c:1287:20: error: assignment of read-only location ‘*(dev->dev_addr + (sizetype)j)’
> 1287 | dev->dev_addr[j] = rev ? bitrev8(addr[j]): addr[j];
> | ^
>
> Fix it by making the modifications to a local macaddr variable and then
> passing that to eth_hw_addr_set().
>
> We don't use the existing addr variable because the bitrev8() would
> mutate it, but it is already used unreversed later in the function.
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Thank you!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] net: apple: bmac: Fix build since dev_addr constification
2022-01-14 3:13 ` Michael Ellerman
@ 2022-01-14 11:30 ` patchwork-bot+netdevbpf
-1 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-14 11:30 UTC (permalink / raw)
To: Michael Ellerman; +Cc: netdev, kuba, davem, linuxppc-dev
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:
On Fri, 14 Jan 2022 14:13:16 +1100 you wrote:
> Since commit adeef3e32146 ("net: constify netdev->dev_addr") the bmac
> driver no longer builds with the following errors (pmac32_defconfig):
>
> linux/drivers/net/ethernet/apple/bmac.c: In function ‘bmac_probe’:
> linux/drivers/net/ethernet/apple/bmac.c:1287:20: error: assignment of read-only location ‘*(dev->dev_addr + (sizetype)j)’
> 1287 | dev->dev_addr[j] = rev ? bitrev8(addr[j]): addr[j];
> | ^
>
> [...]
Here is the summary with links:
- net: apple: bmac: Fix build since dev_addr constification
https://git.kernel.org/netdev/net/c/ea938248557a
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] 6+ messages in thread
* Re: [PATCH] net: apple: bmac: Fix build since dev_addr constification
@ 2022-01-14 11:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-14 11:30 UTC (permalink / raw)
To: Michael Ellerman; +Cc: netdev, linuxppc-dev, davem, kuba
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:
On Fri, 14 Jan 2022 14:13:16 +1100 you wrote:
> Since commit adeef3e32146 ("net: constify netdev->dev_addr") the bmac
> driver no longer builds with the following errors (pmac32_defconfig):
>
> linux/drivers/net/ethernet/apple/bmac.c: In function ‘bmac_probe’:
> linux/drivers/net/ethernet/apple/bmac.c:1287:20: error: assignment of read-only location ‘*(dev->dev_addr + (sizetype)j)’
> 1287 | dev->dev_addr[j] = rev ? bitrev8(addr[j]): addr[j];
> | ^
>
> [...]
Here is the summary with links:
- net: apple: bmac: Fix build since dev_addr constification
https://git.kernel.org/netdev/net/c/ea938248557a
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] 6+ messages in thread
end of thread, other threads:[~2022-01-14 11:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-14 3:13 [PATCH] net: apple: bmac: Fix build since dev_addr constification Michael Ellerman
2022-01-14 3:13 ` Michael Ellerman
2022-01-14 4:21 ` Jakub Kicinski
2022-01-14 4:21 ` Jakub Kicinski
2022-01-14 11:30 ` patchwork-bot+netdevbpf
2022-01-14 11:30 ` patchwork-bot+netdevbpf
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.