Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ethernet: tundra: don't write directly to netdev->dev_addr

netdev->dev_addr is const now.

Maintain the questionable offsetting in ndo_set_mac_address.

Compile tested holly_defconfig and mpc7448_hpc2_defconfig.

Fixes: adeef3e32146 ("net: constify netdev->dev_addr")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jakub Kicinski and committed by
David S. Miller
14ba66a6 007c9512

+18 -17
+18 -17
drivers/net/ethernet/tundra/tsi108_eth.c
··· 1091 1091 struct tsi108_prv_data *data = netdev_priv(dev); 1092 1092 u32 word1 = TSI_READ(TSI108_MAC_ADDR1); 1093 1093 u32 word2 = TSI_READ(TSI108_MAC_ADDR2); 1094 + u8 addr[ETH_ALEN]; 1094 1095 1095 1096 /* Note that the octets are reversed from what the manual says, 1096 1097 * producing an even weirder ordering... 1097 1098 */ 1098 1099 if (word2 == 0 && word1 == 0) { 1099 - dev->dev_addr[0] = 0x00; 1100 - dev->dev_addr[1] = 0x06; 1101 - dev->dev_addr[2] = 0xd2; 1102 - dev->dev_addr[3] = 0x00; 1103 - dev->dev_addr[4] = 0x00; 1100 + addr[0] = 0x00; 1101 + addr[1] = 0x06; 1102 + addr[2] = 0xd2; 1103 + addr[3] = 0x00; 1104 + addr[4] = 0x00; 1104 1105 if (0x8 == data->phy) 1105 - dev->dev_addr[5] = 0x01; 1106 + addr[5] = 0x01; 1106 1107 else 1107 - dev->dev_addr[5] = 0x02; 1108 + addr[5] = 0x02; 1109 + eth_hw_addr_set(dev, addr); 1108 1110 1109 1111 word2 = (dev->dev_addr[0] << 16) | (dev->dev_addr[1] << 24); 1110 1112 ··· 1116 1114 TSI_WRITE(TSI108_MAC_ADDR1, word1); 1117 1115 TSI_WRITE(TSI108_MAC_ADDR2, word2); 1118 1116 } else { 1119 - dev->dev_addr[0] = (word2 >> 16) & 0xff; 1120 - dev->dev_addr[1] = (word2 >> 24) & 0xff; 1121 - dev->dev_addr[2] = (word1 >> 0) & 0xff; 1122 - dev->dev_addr[3] = (word1 >> 8) & 0xff; 1123 - dev->dev_addr[4] = (word1 >> 16) & 0xff; 1124 - dev->dev_addr[5] = (word1 >> 24) & 0xff; 1117 + addr[0] = (word2 >> 16) & 0xff; 1118 + addr[1] = (word2 >> 24) & 0xff; 1119 + addr[2] = (word1 >> 0) & 0xff; 1120 + addr[3] = (word1 >> 8) & 0xff; 1121 + addr[4] = (word1 >> 16) & 0xff; 1122 + addr[5] = (word1 >> 24) & 0xff; 1123 + eth_hw_addr_set(dev, addr); 1125 1124 } 1126 1125 1127 1126 if (!is_valid_ether_addr(dev->dev_addr)) { ··· 1139 1136 { 1140 1137 struct tsi108_prv_data *data = netdev_priv(dev); 1141 1138 u32 word1, word2; 1142 - int i; 1143 1139 1144 1140 if (!is_valid_ether_addr(addr)) 1145 1141 return -EADDRNOTAVAIL; 1146 1142 1147 - for (i = 0; i < 6; i++) 1148 - /* +2 is for the offset of the HW addr type */ 1149 - dev->dev_addr[i] = ((unsigned char *)addr)[i + 2]; 1143 + /* +2 is for the offset of the HW addr type */ 1144 + eth_hw_addr_set(dev, ((unsigned char *)addr) + 2); 1150 1145 1151 1146 word2 = (dev->dev_addr[0] << 16) | (dev->dev_addr[1] << 24); 1152 1147