diff options
author | Antoine Ténart <antoine.tenart@free-electrons.com> | 2014-10-03 11:01:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-10-05 21:15:16 -0400 |
commit | 0f6a670116921eae11b81f1760e2fff1148712de (patch) | |
tree | ec4215edfef019a8eae82b9aadc91f3bfe6ca607 | |
parent | 3a67c9ccad926a168d8b7891537a452018368a5b (diff) |
net: spider_net: do not read mac address again after setting it
This patch removes the spider_net_get_mac_address() call at the end of
the spider_net_set_mac() function. The dev->dev_addr is instead updated
with a memcpy() from sa->sa_data.
Since spider_net_get_mac_address() is not used anywhere else, this patch
also removes the function.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/toshiba/spider_net.c | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/drivers/net/ethernet/toshiba/spider_net.c b/drivers/net/ethernet/toshiba/spider_net.c index 3e38f67c6011..713313e15c68 100644 --- a/drivers/net/ethernet/toshiba/spider_net.c +++ b/drivers/net/ethernet/toshiba/spider_net.c | |||
@@ -267,34 +267,6 @@ spider_net_set_promisc(struct spider_net_card *card) | |||
267 | } | 267 | } |
268 | 268 | ||
269 | /** | 269 | /** |
270 | * spider_net_get_mac_address - read mac address from spider card | ||
271 | * @card: device structure | ||
272 | * | ||
273 | * reads MAC address from GMACUNIMACU and GMACUNIMACL registers | ||
274 | */ | ||
275 | static int | ||
276 | spider_net_get_mac_address(struct net_device *netdev) | ||
277 | { | ||
278 | struct spider_net_card *card = netdev_priv(netdev); | ||
279 | u32 macl, macu; | ||
280 | |||
281 | macl = spider_net_read_reg(card, SPIDER_NET_GMACUNIMACL); | ||
282 | macu = spider_net_read_reg(card, SPIDER_NET_GMACUNIMACU); | ||
283 | |||
284 | netdev->dev_addr[0] = (macu >> 24) & 0xff; | ||
285 | netdev->dev_addr[1] = (macu >> 16) & 0xff; | ||
286 | netdev->dev_addr[2] = (macu >> 8) & 0xff; | ||
287 | netdev->dev_addr[3] = macu & 0xff; | ||
288 | netdev->dev_addr[4] = (macl >> 8) & 0xff; | ||
289 | netdev->dev_addr[5] = macl & 0xff; | ||
290 | |||
291 | if (!is_valid_ether_addr(&netdev->dev_addr[0])) | ||
292 | return -EINVAL; | ||
293 | |||
294 | return 0; | ||
295 | } | ||
296 | |||
297 | /** | ||
298 | * spider_net_get_descr_status -- returns the status of a descriptor | 270 | * spider_net_get_descr_status -- returns the status of a descriptor |
299 | * @descr: descriptor to look at | 271 | * @descr: descriptor to look at |
300 | * | 272 | * |
@@ -1345,6 +1317,8 @@ spider_net_set_mac(struct net_device *netdev, void *p) | |||
1345 | if (!is_valid_ether_addr(addr->sa_data)) | 1317 | if (!is_valid_ether_addr(addr->sa_data)) |
1346 | return -EADDRNOTAVAIL; | 1318 | return -EADDRNOTAVAIL; |
1347 | 1319 | ||
1320 | memcpy(netdev->dev_addr, addr->sa_data, ETH_ALEN); | ||
1321 | |||
1348 | /* switch off GMACTPE and GMACRPE */ | 1322 | /* switch off GMACTPE and GMACRPE */ |
1349 | regvalue = spider_net_read_reg(card, SPIDER_NET_GMACOPEMD); | 1323 | regvalue = spider_net_read_reg(card, SPIDER_NET_GMACOPEMD); |
1350 | regvalue &= ~((1 << 5) | (1 << 6)); | 1324 | regvalue &= ~((1 << 5) | (1 << 6)); |
@@ -1364,12 +1338,6 @@ spider_net_set_mac(struct net_device *netdev, void *p) | |||
1364 | 1338 | ||
1365 | spider_net_set_promisc(card); | 1339 | spider_net_set_promisc(card); |
1366 | 1340 | ||
1367 | /* look up, whether we have been successful */ | ||
1368 | if (spider_net_get_mac_address(netdev)) | ||
1369 | return -EADDRNOTAVAIL; | ||
1370 | if (memcmp(netdev->dev_addr,addr->sa_data,netdev->addr_len)) | ||
1371 | return -EADDRNOTAVAIL; | ||
1372 | |||
1373 | return 0; | 1341 | return 0; |
1374 | } | 1342 | } |
1375 | 1343 | ||