mac80211: upgrade to latest compat-wireless, fix ad-hoc interface setup

SVN-Revision: 18023
master
Felix Fietkau 15 years ago
parent 0ba61fe414
commit 4cb436429b
  1. 18
      package/mac80211/Makefile
  2. 17
      package/mac80211/files/lib/wifi/mac80211.sh
  3. 155
      package/mac80211/patches/001-speedup_build.patch
  4. 13
      package/mac80211/patches/002-disable_rfkill.patch
  5. 2
      package/mac80211/patches/005-disable_ssb_build.patch
  6. 4
      package/mac80211/patches/010-b43_config.patch
  7. 8
      package/mac80211/patches/011-move_ar9170_usb_compat_code.patch
  8. 2
      package/mac80211/patches/012-remove_rfkill.patch
  9. 98
      package/mac80211/patches/100-cfg80211_fix_scan_check_again.patch
  10. 2
      package/mac80211/patches/201-ath5k-WAR-for-AR71xx-PCI-bug.patch
  11. 4
      package/mac80211/patches/401-ath9k-dont-register-leds-on-ar9100.patch
  12. 26
      package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch
  13. 4
      package/mac80211/patches/404-ath_regd_optional.patch
  14. 20
      package/mac80211/patches/405-compile_fix.patch

@ -10,12 +10,12 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mac80211
PKG_VERSION:=2009-08-20
PKG_RELEASE:=2
PKG_VERSION:=2009-10-09
PKG_RELEASE:=1
PKG_SOURCE_URL:= \
http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/08 \
http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/09 \
http://wireless.kernel.org/download/compat-wireless-2.6
PKG_MD5SUM:=0b3919adf847a59478cc4fb58e1cb6ec
PKG_MD5SUM:=15c310560765cbc35ed930fb0e815284
PKG_SOURCE:=compat-wireless-$(PKG_VERSION).tar.bz2
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
@ -315,8 +315,10 @@ define KernelPackage/ath9k
TITLE:=Atheros 802.11n wireless cards support
URL:=http://linuxwireless.org/en/users/Drivers/ath9k
DEPENDS+= +kmod-ath
FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.$(LINUX_KMOD_SUFFIX)
AUTOLOAD:=$(call AutoLoad,27,ath9k)
FILES:= \
$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.$(LINUX_KMOD_SUFFIX) \
$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.$(LINUX_KMOD_SUFFIX)
AUTOLOAD:=$(call AutoLoad,27,ath9k_hw ath9k)
endef
define KernelPackage/ath9k/description
@ -450,6 +452,8 @@ define KernelPackage/b43-common
$(call KernelPackage/mac80211/Default)
TITLE:=Generic stuff for Broadcom wireless devices
URL:=http://linuxwireless.org/en/users/Drivers/b43
KCONFIG:= \
CONFIG_HW_RANDOM=y
DEPENDS+= +kmod-mac80211 +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb
endef
@ -486,7 +490,7 @@ BUILDFLAGS:= \
$(if $(CONFIG_PCI),-DCONFIG_SSB_PCIHOST_POSSIBLE -DCONFIG_SSB_PCIHOST) \
$(if $(CONFIG_PCI),-DCONFIG_SSB_SPROM) \
$(if $(CONFIG_LEDS_TRIGGERS), -DCONFIG_MAC80211_LEDS -DCONFIG_LEDS_TRIGGERS -DCONFIG_B43_LEDS -DCONFIG_B43LEGACY_LEDS -DCONFIG_AR9170_LEDS) \
$(if $(CONFIG_HW_RANDOM),-DCONFIG_B43_HWRNG -DCONFIG_B43LEGACY_HWRNG) \
-DCONFIG_B43_HWRNG -DCONFIG_B43LEGACY_HWRNG \
$(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),-DCONFIG_MAC80211_DEBUGFS) \
$(if $(CONFIG_PACKAGE_ATH9K_DEBUG),-DCONFIG_ATH9K_DEBUG) \
-D__CONFIG_MAC80211_RC_DEFAULT=minstrel \

@ -66,7 +66,11 @@ disable_mac80211() (
return 0
)
get_freq() {
local phy="$1"
local channel="$2"
iw "$phy" info | grep -E -m1 "(\* ${channel:-....} MHz${channel:+|\\[$channel\\]})" | grep MHz | awk '{print $2}'
}
enable_mac80211() {
local device="$1"
config_get channel "$device" channel
@ -76,6 +80,9 @@ enable_mac80211() {
config_get phy "$device" phy
local i=0
# convert channel to frequency
local freq="$(get_freq "$phy" "$channel")"
wifi_fixup_hwmode "$device" "g"
for vif in $vifs; do
while [ -d "/sys/class/net/wlan$i" ]; do
@ -134,7 +141,7 @@ enable_mac80211() {
# We attempt to set teh channel for all interfaces, although
# mac80211 may not support it or the driver might not yet
iw dev "$ifname" set channel "$channel"
[ -z "$channel" ] || iw dev "$ifname" set channel "$channel"
local key keystring
@ -213,7 +220,11 @@ enable_mac80211() {
}
fi
;;
sta|mesh|adhoc)
adhoc)
config_get bssid "$vif" bssid
iw dev "$ifname" ibss join "$ssid" ${freq:+$freq fixed-freq} $bssid
;;
sta|mesh)
# Fixup... sometimes you have to scan to get beaconing going
iw dev "$ifname" scan &> /dev/null
case "$enc" in

@ -1,155 +0,0 @@
--- a/config.mk
+++ b/config.mk
@@ -17,15 +17,19 @@ ifeq ($(CONFIG_MAC80211),y)
$(error "ERROR: you have MAC80211 compiled into the kernel, CONFIG_MAC80211=y, as such you cannot replace its mac80211 driver. You need this set to CONFIG_MAC80211=m. If you are using Fedora upgrade your kernel as later version should this set as modular. For further information on Fedora see https://bugzilla.redhat.com/show_bug.cgi?id=470143. If you are using your own kernel recompile it and make mac80211 modular")
endif
+
# We will warn when you don't have MQ support or NET_SCHED enabled.
#
# We could consider just quiting if MQ and NET_SCHED is disabled
# as I suspect all users of this package want 802.11e (WME) and
# 802.11n (HT) support.
-ifeq ($(shell test -e $(KLIB_BUILD)/Makefile && echo yes),yes)
-KERNEL_SUBLEVEL = $(shell $(MAKE) -C $(KLIB_BUILD) kernelversion | sed -n 's/^2\.6\.\([0-9]\+\).*/\1/p')
+ifneq ($(wildcard $(KLIB_BUILD)/Makefile),)
+COMPAT_LATEST_VERSION = 32
+KERNEL_SUBLEVEL := $(shell $(MAKE) -C $(KLIB_BUILD) kernelversion | sed -n 's/^2\.6\.\([0-9]\+\).*/\1/p')
+COMPAT_VERSIONS := $(shell I=$(COMPAT_LATEST_VERSION); while [ "$$I" -gt $(KERNEL_SUBLEVEL) ]; do echo $$I; I=$$(($$I - 1)); done)
+$(foreach ver,$(COMPAT_VERSIONS),$(eval CONFIG_COMPAT_WIRELESS_$(ver)=y))
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -lt 25 && echo yes),yes)
+ifdef CONFIG_COMPAT_WIRELESS_25
$(error "ERROR: You should use compat-wireless-2.6-old for older kernels, this one is for kernels >= 2.6.25")
endif
@@ -34,56 +38,10 @@ $(error "ERROR: your kernel has CONFIG_C
endif
-# Compat wireless compat-2.6.2x.c files gets selected here
-
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 21 && echo yes),yes)
-CONFIG_COMPAT_WIRELESS_22=y
-endif
-
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 22 && echo yes),yes)
-CONFIG_COMPAT_WIRELESS_23=y
-endif
-
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 23 && echo yes),yes)
-CONFIG_COMPAT_WIRELESS_24=y
-endif
-
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 24 && echo yes),yes)
-CONFIG_COMPAT_WIRELESS_25=y
-endif
-
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 25 && echo yes),yes)
-CONFIG_COMPAT_WIRELESS_26=y
-endif
-
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 26 && echo yes),yes)
-CONFIG_COMPAT_WIRELESS_27=y
-endif
-
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 27 && echo yes),yes)
-CONFIG_COMPAT_WIRELESS_28=y
-endif
-
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 28 && echo yes),yes)
-CONFIG_COMPAT_WIRELESS_29=y
-endif
-
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 29 && echo yes),yes)
-CONFIG_COMPAT_WIRELESS_30=y
-endif
-
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 30 && echo yes),yes)
-CONFIG_COMPAT_WIRELESS_31=y
-endif
-
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 31 && echo yes),yes)
-CONFIG_COMPAT_WIRELESS_32=y
-endif
-
# 2.6.27 has FTRACE_DYNAMIC borked, so we will complain if
# you have it enabled, otherwise you will very likely run into
# a kernel panic.
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -eq 27 && echo yes),yes)
+ifeq ($(KERNEL_SUBLEVEL),27)
ifeq ($(CONFIG_DYNAMIC_FTRACE),y)
$(error "ERROR: Your 2.6.27 kernel has CONFIG_DYNAMIC_FTRACE, please upgrade your distribution kernel as newer ones should not have this enabled (and if so report a bug) or remove this warning if you know what you are doing")
endif
@@ -291,7 +249,7 @@ endif
ifneq ($(CONFIG_PCMCIA),)
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 26 && echo yes),yes)
+ifdef CONFIG_COMPAT_WIRELESS_27
CONFIG_LIBERTAS=n
CONFIG_LIBERTAS_CS=n
else
@@ -327,7 +285,7 @@ CONFIG_RTL8187=m
CONFIG_AT76C50X_USB=m
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -ge 28 && echo yes),yes)
+ifndef CONFIG_COMPAT_WIRELESS_28
CONFIG_AR9170_USB=m
CONFIG_AR9170_LEDS=y
endif
@@ -343,7 +301,7 @@ CONFIG_RT73USB=m
NEED_RT2X00_FIRMWARE=y
endif
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 26 && echo yes),yes)
+ifdef CONFIG_COMPAT_WIRELESS_27
CONFIG_LIBERTAS_THINFIRM_USB=n
CONFIG_LIBERTAS_USB=n
NEED_LIBERTAS=n
@@ -360,7 +318,7 @@ ifneq ($(CONFIG_SPI_MASTER),)
CONFIG_WL1251=m
CONFIG_P54_SPI=m
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 26 && echo yes),yes)
+ifdef CONFIG_COMPAT_WIRELESS_27
CONFIG_LIBERTAS_SPI=n
NEED_LIBERTAS=n
else
@@ -372,7 +330,7 @@ endif # end of SPI driver list
ifneq ($(CONFIG_MMC),)
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 26 && echo yes),yes)
+ifdef CONFIG_COMPAT_WIRELESS_27
CONFIG_LIBERTAS_SDIO=n
NEED_LIBERTAS=n
else
@@ -382,7 +340,7 @@ endif
# Activate iwmc3200wifi support only on kernel >= 2.6.29.
# iwmc3200wifi uses new netdev_ops api no supported by old kernel.
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -ge 29 && echo yes),yes)
+ifndef CONFIG_COMPAT_WIRELESS_29
CONFIG_IWM=m
# CONFIG_IWM_DEBUG=y
endif
@@ -425,7 +383,7 @@ CONFIG_SSB=m
CONFIG_SSB_SPROM=y
# CONFIG_SSB_DEBUG=y
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 26 && echo yes),yes)
+ifdef CONFIG_COMPAT_WIRELESS_27
CONFIG_LIBERTAS=n
else
ifeq ($(NEED_LIBERTAS),y)
@@ -437,7 +395,7 @@ endif
# We need the backported rfkill module on kernel < 2.6.31.
# In more recent kernel versions use the in kernel rfkill module.
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 30 && echo yes),yes)
+ifdef CONFIG_COMPAT_WIRELESS_31
CONFIG_RFKILL_BACKPORT=m
CONFIG_RFKILL_BACKPORT_LEDS=y
CONFIG_RFKILL_BACKPORT_INPUT=y

@ -1,14 +1,15 @@
--- a/config.mk
+++ b/config.mk
@@ -127,14 +127,14 @@ ifneq ($(CONFIG_PCI),)
@@ -145,7 +145,7 @@ ifneq ($(CONFIG_PCI),)
CONFIG_ATH5K=m
# CONFIG_ATH5K_DEBUG=y
-CONFIG_ATH5K_RFKILL=y
+# CONFIG_ATH5K_RFKILL=y
CONFIG_ATH9K_HW=m
CONFIG_ATH9K=m
# CONFIG_ATH9K_DEBUG=y
@@ -153,7 +153,7 @@ CONFIG_ATH9K=m
CONFIG_IWLWIFI=m
CONFIG_IWLWIFI_LEDS=y
@ -17,7 +18,7 @@
CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT=y
# CONFIG_IWLWIFI_DEBUG=y
# CONFIG_IWLWIFI_DEBUGFS=y
@@ -154,7 +154,7 @@ CONFIG_B43_PCMCIA=y
@@ -173,7 +173,7 @@ CONFIG_B43_PCMCIA=y
endif
CONFIG_B43_PIO=y
CONFIG_B43_LEDS=y
@ -26,7 +27,7 @@
CONFIG_B43_PHY_LP=y
# CONFIG_B43_DEBUG=y
# CONFIG_B43_FORCE_PIO=y
@@ -164,7 +164,7 @@ CONFIG_B43LEGACY_HWRNG=y
@@ -183,7 +183,7 @@ CONFIG_B43LEGACY_HWRNG=y
CONFIG_B43LEGACY_PCI_AUTOSELECT=y
CONFIG_B43LEGACY_PCICORE_AUTOSELECT=y
CONFIG_B43LEGACY_LEDS=y
@ -35,7 +36,7 @@
# CONFIG_B43LEGACY_DEBUG=y
CONFIG_B43LEGACY_DMA=y
CONFIG_B43LEGACY_PIO=y
@@ -354,7 +354,7 @@ CONFIG_RT2X00_LIB=m
@@ -373,7 +373,7 @@ CONFIG_RT2X00_LIB=m
CONFIG_RT2X00_LIB_HT=y
CONFIG_RT2X00_LIB_FIRMWARE=y
CONFIG_RT2X00_LIB_CRYPTO=y
@ -44,7 +45,7 @@
CONFIG_RT2X00_LIB_LEDS=y
# CONFIG_RT2X00_LIB_DEBUGFS=y
# CONFIG_RT2X00_DEBUG=y
@@ -396,8 +396,8 @@ endif
@@ -415,8 +415,8 @@ endif
# We need the backported rfkill module on kernel < 2.6.31.
# In more recent kernel versions use the in kernel rfkill module.
ifdef CONFIG_COMPAT_WIRELESS_31

@ -6,5 +6,5 @@
obj-m += \
- drivers/ssb/ \
drivers/misc/eeprom/ \
drivers/net/ \
drivers/net/usb/ \
drivers/net/wireless/

@ -1,6 +1,6 @@
--- a/config.mk
+++ b/config.mk
@@ -135,12 +135,12 @@ CONFIG_B43_HWRNG=y
@@ -154,12 +154,12 @@ CONFIG_B43_HWRNG=y
CONFIG_B43_PCI_AUTOSELECT=y
CONFIG_B43_PCICORE_AUTOSELECT=y
ifneq ($(CONFIG_PCMCIA),)
@ -16,7 +16,7 @@
# CONFIG_B43_DEBUG=y
# CONFIG_B43_FORCE_PIO=y
@@ -189,8 +189,8 @@ CONFIG_SSB_PCIHOST_POSSIBLE=y
@@ -208,8 +208,8 @@ CONFIG_SSB_PCIHOST_POSSIBLE=y
CONFIG_SSB_PCIHOST=y
CONFIG_SSB_B43_PCI_BRIDGE=y
ifneq ($(CONFIG_PCMCIA),)

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ar9170/usb.c
+++ b/drivers/net/wireless/ath/ar9170/usb.c
@@ -96,6 +96,225 @@ static struct usb_device_id ar9170_usb_i
@@ -98,6 +98,225 @@ static struct usb_device_id ar9170_usb_i
};
MODULE_DEVICE_TABLE(usb, ar9170_usb_ids);
@ -510,6 +510,6 @@
-extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
-
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) */
#endif /* LINUX_26_29_COMPAT_H */
#define DIV_ROUND_CLOSEST(x, divisor)( \
{ \
typeof(divisor) __divisor = divisor; \

@ -22,7 +22,7 @@
#include <linux/rfkill_backport.h>
--- a/include/linux/rfkill_backport.h
+++ b/include/linux/rfkill_backport.h
@@ -149,7 +149,7 @@ struct rfkill_ops {
@@ -146,7 +146,7 @@ struct rfkill_ops {
int (*set_block)(void *data, bool blocked);
};

@ -1,98 +0,0 @@
Subject: cfg80211: check lost scans later, fix bug
When we lose a scan, cfg80211 tries to clean up after
the driver. However, it currently does this too early,
it does this in GOING_DOWN already instead of DOWN, so
it may happen with mac80211. Besides fixing this, also
make it more robust by leaking the scan request so if
the driver later actually finishes the scan, it won't
crash. Also check in ___cfg80211_scan_done whether a
scan request is still pending and exit if not.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
net/wireless/core.c | 4 +++-
net/wireless/core.h | 2 +-
net/wireless/scan.c | 19 ++++++++++++++++---
3 files changed, 20 insertions(+), 5 deletions(-)
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -664,7 +664,7 @@ static void wdev_cleanup_work(struct wor
if (WARN_ON(rdev->scan_req && rdev->scan_req->dev == wdev->netdev)) {
rdev->scan_req->aborted = true;
- ___cfg80211_scan_done(rdev);
+ ___cfg80211_scan_done(rdev, true);
}
cfg80211_unlock_rdev(rdev);
@@ -755,6 +755,8 @@ static int cfg80211_netdev_notifier_call
default:
break;
}
+ break;
+ case NETDEV_DOWN:
dev_hold(dev);
schedule_work(&wdev->cleanup_work);
break;
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -374,7 +374,7 @@ void cfg80211_sme_scan_done(struct net_d
void cfg80211_sme_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
void cfg80211_sme_disassoc(struct net_device *dev, int idx);
void __cfg80211_scan_done(struct work_struct *wk);
-void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev);
+void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak);
void cfg80211_upload_connect_keys(struct wireless_dev *wdev);
struct ieee80211_channel *
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -18,7 +18,7 @@
#define IEEE80211_SCAN_RESULT_EXPIRE (15 * HZ)
-void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev)
+void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak)
{
struct cfg80211_scan_request *request;
struct net_device *dev;
@@ -28,6 +28,9 @@ void ___cfg80211_scan_done(struct cfg802
request = rdev->scan_req;
+ if (!request)
+ return;
+
dev = request->dev;
/*
@@ -53,7 +56,17 @@ void ___cfg80211_scan_done(struct cfg802
dev_put(dev);
rdev->scan_req = NULL;
- kfree(request);
+
+ /*
+ * OK. If this is invoked with "leak" then we can't
+ * free this ... but we've cleaned it up anyway. The
+ * driver failed to call the scan_done callback, so
+ * all bets are off, it might still be trying to use
+ * the scan request or not ... if it accesses the dev
+ * in there (it shouldn't anyway) then it may crash.
+ */
+ if (!leak)
+ kfree(request);
}
void __cfg80211_scan_done(struct work_struct *wk)
@@ -64,7 +77,7 @@ void __cfg80211_scan_done(struct work_st
scan_done_wk);
cfg80211_lock_rdev(rdev);
- ___cfg80211_scan_done(rdev);
+ ___cfg80211_scan_done(rdev, false);
cfg80211_unlock_rdev(rdev);
}

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -1368,10 +1368,18 @@ int ath5k_hw_reset(struct ath5k_hw *ah,
@@ -1372,10 +1372,18 @@ int ath5k_hw_reset(struct ath5k_hw *ah,
* guess we can tweak it and see how it goes ;-)
*/
if (ah->ah_version != AR5K_AR5210) {

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1054,6 +1054,9 @@ static void ath_unregister_led(struct at
@@ -1135,6 +1135,9 @@ static void ath_unregister_led(struct at
static void ath_deinit_leds(struct ath_softc *sc)
{
@ -10,7 +10,7 @@
ath_unregister_led(&sc->assoc_led);
sc->sc_flags &= ~SC_OP_LED_ASSOCIATED;
ath_unregister_led(&sc->tx_led);
@@ -1072,6 +1075,9 @@ static void ath_init_leds(struct ath_sof
@@ -1153,6 +1156,9 @@ static void ath_init_leds(struct ath_sof
else
sc->sc_ah->led_pin = ATH_LED_PIN_DEF;

@ -1,22 +1,30 @@
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -524,8 +524,18 @@ static int ath9k_hw_init_macaddr(struct
ah->macaddr[2 * i] = eeval >> 8;
ah->macaddr[2 * i + 1] = eeval & 0xff;
@@ -15,6 +15,7 @@
*/
#include <linux/io.h>
+#include <linux/etherdevice.h>
#include <asm/unaligned.h>
#include "hw.h"
@@ -511,8 +512,18 @@ static int ath9k_hw_init_macaddr(struct
common->macaddr[2 * i] = eeval >> 8;
common->macaddr[2 * i + 1] = eeval & 0xff;
}
- if (sum == 0 || sum == 0xffff * 3)
- return -EADDRNOTAVAIL;
+ if (!is_valid_ether_addr(ah->macaddr)) {
+ if (!is_valid_ether_addr(common->macaddr)) {
+ DECLARE_MAC_BUF(macbuf);
+
+ DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
+ ath_print(common, ATH_DBG_EEPROM,
+ "eeprom contains invalid mac address: %s\n",
+ print_mac(macbuf, ah->macaddr));
+ print_mac(macbuf, common->macaddr));
+
+ random_ether_addr(ah->macaddr);
+ DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
+ random_ether_addr(common->macaddr);
+ ath_print(common, ATH_DBG_EEPROM,
+ "random mac address will be used: %s\n",
+ print_mac(macbuf, ah->macaddr));
+ print_mac(macbuf, common->macaddr));
+ }
return 0;

@ -18,7 +18,7 @@
+#endif
--- a/drivers/net/wireless/ath/regd.h
+++ b/drivers/net/wireless/ath/regd.h
@@ -236,6 +236,41 @@ enum CountryCode {
@@ -242,6 +242,41 @@ enum CountryCode {
CTRY_BELGIUM2 = 5002
};
@ -60,7 +60,7 @@
bool ath_is_world_regd(struct ath_regulatory *reg);
int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy,
int (*reg_notifier)(struct wiphy *wiphy,
@@ -247,3 +282,5 @@ int ath_reg_notifier_apply(struct wiphy
@@ -253,3 +288,5 @@ int ath_reg_notifier_apply(struct wiphy
struct ath_regulatory *reg);
#endif

@ -0,0 +1,20 @@
--- a/drivers/net/wireless/ath/ath9k/ahb.c
+++ b/drivers/net/wireless/ath/ath9k/ahb.c
@@ -29,15 +29,13 @@ static void ath_ahb_read_cachesize(struc
static void ath_ahb_cleanup(struct ath_common *common)
{
- struct ath_hw *ah = (struct ath_hw *) common->ah;
- struct ath_softc *sc = ah->ah_sc;
+ struct ath_softc *sc = (struct ath_softc *) common->priv;
iounmap(sc->mem);
}
static bool ath_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)
{
- struct ath_hw *ah = (struct ath_hw *) common->ah;
- struct ath_softc *sc = ah->ah_sc;
+ struct ath_softc *sc = (struct ath_softc *) common->priv;
struct platform_device *pdev = to_platform_device(sc->dev);
struct ath9k_platform_data *pdata;
Loading…
Cancel
Save