linux/drivers/net/ethernet/ti/davinci_emac.c
/**
 * emac_dev_setmac_addr - Set mac address in the adapter
 * @ndev: The DaVinci EMAC network adapter
 * @addr: MAC address to set in device
 *
 * Called by the system to set the mac address of the adapter (Device)
 *
 * Returns success (0) or appropriate error code (none as of now)
 */
Set mac address in the adapter
@ndev: The DaVinci EMAC network adapter
@addr: MAC address to set in device

Called by the system to set the mac address of the adapter (Device)

Returns success (0) or appropriate error code (none as of now)
Set mac address in the adapter @ndev : The DaVinci EMAC network adapter @addr : MAC address to set in device Called by the system to set the mac address of the adapter ( Device ) Returns success ( 0 ) or appropriate error code ( none as of now )
static int emac_dev_setmac_addr(struct net_device *ndev, void *addr)
{
	struct emac_priv *priv = netdev_priv(ndev);
	struct device *emac_dev = &priv->ndev->dev;
	struct sockaddr *sa = addr;
	if (!is_valid_ether_addr(sa->sa_data))
		return -EADDRNOTAVAIL;
	memcpy(priv->mac_addr, sa->sa_data, ndev->addr_len);
	memcpy(ndev->dev_addr, sa->sa_data, ndev->addr_len);
	if (netif_running(ndev)) {
		emac_setmac(priv, EMAC_DEF_RX_CH, priv->mac_addr);
	}
	if (netif_msg_drv(priv))
		dev_notice(emac_dev, "DaVinci EMAC: emac_dev_setmac_addr %pM\n",
					priv->mac_addr);
	return 0;
}
static int emac_dev_setmac_addr ( struct net_device * ndev , void * addr ) { struct emac_priv * priv = netdev_priv ( ndev ) ; struct device * emac_dev = & priv -> ndev -> dev ; struct sockaddr * sa = addr ; if ( ! is_valid_ether_addr ( sa -> sa_data ) ) return - EADDRNOTAVAIL ; memcpy ( priv -> mac_addr , sa -> sa_data , ndev -> addr_len ) ; memcpy ( ndev -> dev_addr , sa -> sa_data , ndev -> addr_len ) ; if ( netif_running ( ndev ) ) { emac_setmac ( priv , EMAC_DEF_RX_CH , priv -> mac_addr ) ; } if ( netif_msg_drv ( priv ) ) dev_notice ( emac_dev , " \n " , priv -> mac_addr ) ; return 0 ; }
emac_dev_setmac_addr - Set mac address in the adapter
 @ndev: The DaVinci EMAC network adapter
 @addr: MAC address to set in device
emac_dev_setmac_addr - Set mac address in the adapter @ndev : The DaVinci EMAC network adapter @addr : MAC address to set in device
/* Store mac addr in priv and rx channel and set it in EMAC hw */ /* MAC address is configured only after the interface is enabled. */