]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/xradio/eth_platform_get_mac_address.patch
Merge remote-tracking branch 'arne_f/kernel-5.15' into next
[ipfire-2.x.git] / src / patches / xradio / eth_platform_get_mac_address.patch
1 diff -Naur xradio-354e8c32e7948d46a63796d0ca266b1f702999b0.org/main.c xradio-354e8c32e7948d46a63796d0ca266b1f702999b0/main.c
2 --- xradio-354e8c32e7948d46a63796d0ca266b1f702999b0.org/main.c 2020-05-02 17:17:06.000000000 +0000
3 +++ xradio-354e8c32e7948d46a63796d0ca266b1f702999b0/main.c 2021-11-07 10:30:26.153851399 +0000
4 @@ -12,7 +12,7 @@
5
6 #include <linux/firmware.h>
7 #include <net/cfg80211.h>
8 -#include <linux/of_net.h>
9 +#include <linux/etherdevice.h>
10 #include <linux/mmc/sdio_func.h>
11
12 #include "xradio.h"
13 @@ -501,9 +501,8 @@
14 u8 b; /* MRK 5.5a */
15 struct ieee80211_hw *dev;
16 struct xradio_common *hw_priv;
17 - unsigned char randomaddr[ETH_ALEN];
18 - const unsigned char *addr = NULL;
19 -
20 + unsigned char addr[ETH_ALEN];
21 + int ret;
22 //init xradio_common
23 dev = xradio_init_common(sizeof(struct xradio_common));
24 if (!dev) {
25 @@ -517,12 +516,12 @@
26
27 // fill in mac addresses
28 if (hw_priv->pdev->of_node) {
29 - addr = of_get_mac_address(hw_priv->pdev->of_node);
30 + ret = eth_platform_get_mac_address(hw_priv->pdev, addr);
31 }
32 - if (!addr) {
33 +
34 + if (ret<0) {
35 dev_warn(hw_priv->pdev, "no mac address provided, using random\n");
36 - eth_random_addr(randomaddr);
37 - addr = randomaddr;
38 + eth_random_addr(addr);
39 }
40 for (b = 0; b < XRWL_MAX_VIFS; b++) { /* MRK 5.5a */
41 memcpy(hw_priv->addresses[b].addr, addr, ETH_ALEN);