From: Mathias Kresin Date: Fri, 4 Nov 2016 06:43:38 +0000 (+0100) Subject: mac80211: rt2x00: improve eeprom_file property handling X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=2516c0572efe2d362f48a54af64400876a799b26;p=openwrt%2Fstaging%2Faparcar.git mac80211: rt2x00: improve eeprom_file property handling Call the rt2x00lib_get_eeprom_file_name only once and from the function where the EEPROM filename is required. Error only out if an EEPROM file is mandatory. Use the REQUIRE_EEPROM_FILE bit to determine if it is mandatory. Do not set the REQUIRE_EEPROM_FILE bit while requesting an EEPROM file. It should be (and is) set before requesting an EEPROM file. Do not redirect users to upstream while using a function of a custom patch. Signed-off-by: Mathias Kresin --- diff --git a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch index 8ae5da3879..0b191e636b 100644 --- a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch +++ b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch @@ -152,7 +152,7 @@ --- /dev/null +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c -@@ -0,0 +1,111 @@ +@@ -0,0 +1,105 @@ +/* + Copyright (C) 2004 - 2009 Ivo van Doorn + Copyright (C) 2004 - 2009 Gertjan van Wingerde @@ -203,13 +203,14 @@ + int retval; + + ee_name = rt2x00lib_get_eeprom_file_name(rt2x00dev); -+ if (!ee_name) { -+ rt2x00_err(rt2x00dev, -+ "Invalid EEPROM filename.\n" -+ "Please file bug report to %s.\n", DRV_PROJECT); ++ if (!ee_name && test_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags)) { ++ rt2x00_err(rt2x00dev, "Required EEPROM name is missing."); + return -EINVAL; + } + ++ if (!ee_name) ++ return 0; ++ + rt2x00_info(rt2x00dev, "Loading EEPROM data from '%s'.\n", ee_name); + + retval = request_firmware(&ee, ee_name, rt2x00dev->dev); @@ -245,16 +246,9 @@ +{ + int retval; + -+ if (!rt2x00lib_get_eeprom_file_name(rt2x00dev)) -+ return 0; -+ -+ set_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags); -+ -+ if (!rt2x00dev->eeprom_file) { -+ retval = rt2x00lib_request_eeprom_file(rt2x00dev); -+ if (retval) -+ return retval; -+ } ++ retval = rt2x00lib_request_eeprom_file(rt2x00dev); ++ if (retval) ++ return retval; + + return 0; +} diff --git a/package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch b/package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch index 5dceff8794..509730436e 100644 --- a/package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch +++ b/package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch @@ -97,5 +97,5 @@ Signed-off-by: John Crispin + return 0; + ee_name = rt2x00lib_get_eeprom_file_name(rt2x00dev); - if (!ee_name) { - rt2x00_err(rt2x00dev, + if (!ee_name && test_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags)) { + rt2x00_err(rt2x00dev, "Required EEPROM name is missing.");