Commit 8017c4d8 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller
Browse files

eth: fwnode: change the return type of mac address helpers



fwnode_get_mac_address() and device_get_mac_address()
return a pointer to the buffer that was passed to them
on success or NULL on failure. None of the callers
care about the actual value, only if it's NULL or not.

These semantics differ from of_get_mac_address() which
returns an int so to avoid confusion make the device
helpers return an errno.

Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 433baf07
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ static int xge_get_resources(struct xge_pdata *pdata)
		return -ENOMEM;
	}

	if (!device_get_mac_address(dev, ndev->dev_addr, ETH_ALEN))
	if (device_get_mac_address(dev, ndev->dev_addr, ETH_ALEN))
		eth_hw_addr_random(ndev);

	memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len);
+1 −1
Original line number Diff line number Diff line
@@ -1731,7 +1731,7 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
		xgene_get_port_id_acpi(dev, pdata);
#endif

	if (!device_get_mac_address(dev, ndev->dev_addr, ETH_ALEN))
	if (device_get_mac_address(dev, ndev->dev_addr, ETH_ALEN))
		eth_hw_addr_random(ndev);

	memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len);
+1 −1
Original line number Diff line number Diff line
@@ -4084,7 +4084,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
	if (pd && !IS_ERR_OR_NULL(pd->mac_address))
		eth_hw_addr_set(dev, pd->mac_address);
	else
		if (!device_get_mac_address(&pdev->dev, dev->dev_addr, ETH_ALEN))
		if (device_get_mac_address(&pdev->dev, dev->dev_addr, ETH_ALEN))
			if (has_acpi_companion(&pdev->dev))
				bcmgenet_get_hw_addr(priv, dev->dev_addr);

+3 −3
Original line number Diff line number Diff line
@@ -1387,10 +1387,10 @@ static int acpi_get_mac_address(struct device *dev, struct acpi_device *adev,
				u8 *dst)
{
	u8 mac[ETH_ALEN];
	u8 *addr;
	int ret;

	addr = fwnode_get_mac_address(acpi_fwnode_handle(adev), mac, ETH_ALEN);
	if (!addr) {
	ret = fwnode_get_mac_address(acpi_fwnode_handle(adev), mac, ETH_ALEN);
	if (ret) {
		dev_err(dev, "MAC address invalid: %pM\n", mac);
		return -EINVAL;
	}
+1 −3
Original line number Diff line number Diff line
@@ -182,10 +182,8 @@ static void ftgmac100_initial_mac(struct ftgmac100 *priv)
	u8 mac[ETH_ALEN];
	unsigned int m;
	unsigned int l;
	void *addr;

	addr = device_get_mac_address(priv->dev, mac, ETH_ALEN);
	if (addr) {
	if (!device_get_mac_address(priv->dev, mac, ETH_ALEN)) {
		eth_hw_addr_set(priv->netdev, mac);
		dev_info(priv->dev, "Read MAC address %pM from device tree\n",
			 mac);
Loading