summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/tile
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2014-05-30 09:47:17 +0200
committerDavid S. Miller <davem@davemloft.net>2014-05-30 17:06:23 -0700
commitd581ebf5a1f82a27d7df21bd1d76e517c67b49d5 (patch)
treef9b0c3658f3176528622a86625035dc163530e82 /drivers/net/ethernet/tile
parent08f6dd89d26f8599dd138c25506960e3856fd062 (diff)
net: tile: Use helpers from linux/etherdevice.h to check/set MAC
Use is_zero_ether_addr() to check for the MAC address being all zeros instead of open coding the check. Also use ether_addr_copy() instead of a manual memcpy() to set the netdev->dev_addr. Furthermore, get rid of a redundant assignment of netdev->addr_len. This is already set by ether_setup() which is called in tile_net_setup(). Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Acked-by: Chris Metcalf <cmetcalf@tilera.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/tile')
-rw-r--r--drivers/net/ethernet/tile/tilegx.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c
index 7e1c91d41a87..7d80d2e6a69c 100644
--- a/drivers/net/ethernet/tile/tilegx.c
+++ b/drivers/net/ethernet/tile/tilegx.c
@@ -2192,7 +2192,6 @@ static void tile_net_dev_init(const char *name, const uint8_t *mac)
{
int ret;
int i;
- int nz_addr = 0;
struct net_device *dev;
struct tile_net_priv *priv;
@@ -2223,15 +2222,10 @@ static void tile_net_dev_init(const char *name, const uint8_t *mac)
* be done before the device is opened. If the MAC is all zeroes,
* we use a random address, since we're probably on the simulator.
*/
- for (i = 0; i < 6; i++)
- nz_addr |= mac[i];
-
- if (nz_addr) {
- memcpy(dev->dev_addr, mac, ETH_ALEN);
- dev->addr_len = 6;
- } else {
+ if (!is_zero_ether_addr(mac))
+ ether_addr_copy(dev->dev_addr, mac);
+ else
eth_hw_addr_random(dev);
- }
/* Register the network device. */
ret = register_netdev(dev);