Commit e291422c authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

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.
Acked-by: default avatarLukasz Stelmach <l.stelmach@samsung.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3b1abcf1
......@@ -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");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment