kernel: qca-ssdk: update to 12.4.5.r1
[openwrt/staging/jow.git] / package / kernel / qca-nss-dp / patches / 0006-NSS-DP-fix-of_get_mac_address.patch
1 From cadeb62a42296563141d6954eec58e34ef86778d Mon Sep 17 00:00:00 2001
2 From: Robert Marko <robimarko@gmail.com>
3 Date: Fri, 13 Aug 2021 20:12:08 +0200
4 Subject: [PATCH] NSS-DP: fix of_get_mac_address()
5
6 Recently OpenWrt backported the updated of_get_mac_address()
7 function which returns and error code instead.
8
9 So, patch the SSDK to use it and fix the compilation error.
10
11 Signed-off-by: Robert Marko <robimarko@gmail.com>
12 ---
13 nss_dp_main.c | 13 ++++---------
14 1 file changed, 4 insertions(+), 9 deletions(-)
15
16 --- a/nss_dp_main.c
17 +++ b/nss_dp_main.c
18 @@ -555,9 +555,10 @@ static int32_t nss_dp_of_get_pdata(struc
19 struct net_device *netdev,
20 struct nss_gmac_hal_platform_data *hal_pdata)
21 {
22 - uint8_t *maddr;
23 + u8 maddr[ETH_ALEN];
24 struct nss_dp_dev *dp_priv;
25 struct resource memres_devtree = {0};
26 + int ret;
27
28 dp_priv = netdev_priv(netdev);
29
30 @@ -600,14 +601,8 @@ static int32_t nss_dp_of_get_pdata(struc
31 of_property_read_u32(np, "qcom,forced-speed", &dp_priv->forced_speed);
32 of_property_read_u32(np, "qcom,forced-duplex", &dp_priv->forced_duplex);
33
34 - maddr = (uint8_t *)of_get_mac_address(np);
35 -#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 4, 0))
36 - if (IS_ERR((void *)maddr)) {
37 - maddr = NULL;
38 - }
39 -#endif
40 -
41 - if (maddr && is_valid_ether_addr(maddr)) {
42 + ret = of_get_mac_address(np, maddr);
43 + if (!ret && is_valid_ether_addr(maddr)) {
44 ether_addr_copy(netdev->dev_addr, maddr);
45 } else {
46 random_ether_addr(netdev->dev_addr);