* [PATCH net-next] net: ethernet: improve eth_platform_get_mac_address
@ 2019-05-31 17:14 Heiner Kallweit
2019-06-03 1:12 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2019-05-31 17:14 UTC (permalink / raw)
To: David Miller; +Cc: netdev
pci_device_to_OF_node(to_pci_dev(dev)) is the same as dev->of_node,
so we can simplify the code. In addition add an empty line before
the return statement.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
net/ethernet/eth.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 4b2b22237..b70d54829 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -549,17 +549,10 @@ unsigned char * __weak arch_get_platform_mac_address(void)
int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr)
{
- const unsigned char *addr;
- struct device_node *dp;
+ const unsigned char *addr = NULL;
- if (dev_is_pci(dev))
- dp = pci_device_to_OF_node(to_pci_dev(dev));
- else
- dp = dev->of_node;
-
- addr = NULL;
- if (dp)
- addr = of_get_mac_address(dp);
+ if (dev->of_node)
+ addr = of_get_mac_address(dev->of_node);
if (IS_ERR_OR_NULL(addr))
addr = arch_get_platform_mac_address();
@@ -567,6 +560,7 @@ int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr)
return -ENODEV;
ether_addr_copy(mac_addr, addr);
+
return 0;
}
EXPORT_SYMBOL(eth_platform_get_mac_address);
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: ethernet: improve eth_platform_get_mac_address
2019-05-31 17:14 [PATCH net-next] net: ethernet: improve eth_platform_get_mac_address Heiner Kallweit
@ 2019-06-03 1:12 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-06-03 1:12 UTC (permalink / raw)
To: hkallweit1; +Cc: netdev
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Fri, 31 May 2019 19:14:44 +0200
> pci_device_to_OF_node(to_pci_dev(dev)) is the same as dev->of_node,
> so we can simplify the code. In addition add an empty line before
> the return statement.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-03 1:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31 17:14 [PATCH net-next] net: ethernet: improve eth_platform_get_mac_address Heiner Kallweit
2019-06-03 1:12 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.