mt76: fix build with kernel 5.15

This commit is contained in:
lean 2022-03-01 23:04:58 +08:00
parent 68da7390fb
commit 20a437026a
2 changed files with 23 additions and 1 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=mt76
PKG_RELEASE=5
PKG_RELEASE=6
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=

View File

@ -0,0 +1,22 @@
--- a/eeprom.c
+++ b/eeprom.c
@@ -91,6 +91,10 @@
{
struct mt76_dev *dev = phy->dev;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
+ struct device_node *np = dev->dev->of_node;
+ of_get_mac_address(np, phy->macaddr);
+#else
#ifdef CONFIG_OF
struct device_node *np = dev->dev->of_node;
const u8 *mac = NULL;
@@ -100,6 +104,7 @@
if (!IS_ERR_OR_NULL(mac))
ether_addr_copy(phy->macaddr, mac);
#endif
+#endif
if (!is_valid_ether_addr(phy->macaddr)) {
eth_random_addr(phy->macaddr);