Re: [PATCH v2 5/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Misc. fixes.

2014-06-09 Thread Dan Carpenter
On Fri, Jun 06, 2014 at 08:02:18PM -0700, Thomas Wood wrote:
> Remove initialization of static value.
> Invert the empty if statement's test to replace the else statement.
> Remove parentheses from a return statement.
> Fix some code indentation.
> 
> Signed-off-by: Thomas Wood 
> ---
> 
> I'm pretty sure that the indentation was caused by a mistake by me earlier on 
> in the patch set, so I'm fixing it now.
> 

No  That's not the right thing.  If you cause the mistake earlier,
then redo the earlier patch.

Also I feel like fixing the indent here makes the patch into a "does too
many things in one go patch."  This patch is on the limit anyway.

regards,
dan carpenter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: comedi: check the return value of kobject_set_name

2014-06-09 Thread Ian Abbott

On 2014-06-07 14:56, Anton Protopopov wrote:

Added a check of the return value of the kobject_set_name function.

Signed-off-by: Anton Protopopov 
---
  drivers/staging/comedi/comedi_fops.c | 9 -
  1 file changed, 8 insertions(+), 1 deletion(-)


Reviewed-by: Ian Abbott 

--
-=( Ian Abbott @ MEV Ltd.E-mail: )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] Staging: speakup: ERROR: Fix macro parenthesis.

2014-06-09 Thread Choi
I made a stupid mistake, and I'm sorry.
https://lkml.org/lkml/2014/6/8/53

2014-06-09 2:58 GMT+09:00 Dan Carpenter :
> It looks like this patch is adding blank lines not parenthesis like the
> subject says.
>
> regards,
> dan carpenter
>
> On Sun, Jun 08, 2014 at 11:12:57PM +0900, Choi Gi-yong wrote:
>> Signed-off-by: Choi Gi-yong 
>> ---
>>  drivers/staging/speakup/speakup_acntpc.c | 5 -
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/speakup/speakup_acntpc.c 
>> b/drivers/staging/speakup/speakup_acntpc.c
>> index 31f952b..f70b698 100644
>> --- a/drivers/staging/speakup/speakup_acntpc.c
>> +++ b/drivers/staging/speakup/speakup_acntpc.c
>> @@ -35,7 +35,7 @@
>>  #include "speakup_acnt.h" /* local header file for Accent values */
>>
>>  #define DRV_VERSION "2.10"
>> -#define PROCSPEECH '\r'
>> +#define PROCSPEECH ('\r')
>>
>>  static int synth_probe(struct spk_synth *synth);
>>  static void accent_release(void);
>> @@ -152,8 +152,10 @@ static inline bool synth_full(void)
>>  static const char *synth_immediate(struct spk_synth *synth, const char *buf)
>>  {
>>   u_char ch;
>> +
>>   while ((ch = *buf)) {
>>   int timeout = SPK_XMITR_TIMEOUT;
>> +
>>   if (ch == '\n')
>>   ch = PROCSPEECH;
>>   if (synth_full())
>> @@ -257,6 +259,7 @@ static int synth_probe(struct spk_synth *synth)
>>  {
>>   unsigned int port_val = 0;
>>   int i = 0;
>> +
>>   pr_info("Probing for %s.\n", synth->long_name);
>>   if (port_forced) {
>>   speakup_info.port_tts = port_forced;
>> --
>> 1.9.1
>>
>> ___
>> devel mailing list
>> de...@linuxdriverproject.org
>> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



-- 

최 기용
Choi Gi-yong
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] gpio: gpiolib: set gpiochip_remove retval to void

2014-06-09 Thread Lars-Peter Clausen

On 06/09/2014 01:18 AM, Ben Dooks wrote:

On Fri, May 30, 2014 at 08:16:59PM +0200, Lars-Peter Clausen wrote:

On 05/30/2014 07:33 PM, David Daney wrote:

On 05/30/2014 04:39 AM, Geert Uytterhoeven wrote:

On Fri, May 30, 2014 at 1:30 PM, abdoulaye berthe 
wrote:

--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1263,10 +1263,9 @@ static void gpiochip_irqchip_remove(struct
gpio_chip *gpiochip);
   *
   * A gpio_chip with any GPIOs still requested may not be removed.
   */
-int gpiochip_remove(struct gpio_chip *chip)
+void gpiochip_remove(struct gpio_chip *chip)
  {
 unsigned long   flags;
-   int status = 0;
 unsignedid;

 acpi_gpiochip_remove(chip);
@@ -1278,24 +1277,15 @@ int gpiochip_remove(struct gpio_chip *chip)
 of_gpiochip_remove(chip);

 for (id = 0; id < chip->ngpio; id++) {
-   if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags)) {
-   status = -EBUSY;
-   break;
-   }
-   }
-   if (status == 0) {
-   for (id = 0; id < chip->ngpio; id++)
-   chip->desc[id].chip = NULL;
-
-   list_del(&chip->list);
+   if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags))
+   panic("gpio: removing gpiochip with gpios still
requested\n");


panic?


NACK to the patch for this reason.  The strongest thing you should do here
is WARN.

That said, I am not sure why we need this whole patch set in the first place.


Well, what currently happens when you remove a device that is a
provider of a gpio_chip which is still in use, is that the kernel
crashes. Probably with a rather cryptic error message. So this patch
doesn't really change the behavior, but makes it more explicit what
is actually wrong. And even if you replace the panic() by a WARN()
it will again just crash slightly later.

This is a design flaw in the GPIO subsystem that needs to be fixed.


Surely then the best way is to error out to the module unload and
stop the driver being unloaded?



You can't error out on module unload, although that's not really relevant 
here. gpiochip_remove() is typically called when the device that registered 
the GPIO chip is unbound. And despite some remove() callbacks having a 
return type of int you can not abort the removal of a device.


- Lars
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 03/76] staging: rtl8723au: rtw_mlme.c: Convert rtw_get_wps_ie23a() to cfg80211_find_vendor_ie()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index b1fa5dc..76e1797 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -587,19 +587,18 @@ static int rtw_is_desired_network(struct rtw_adapter 
*adapter,
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
u32 desired_encmode;
u32 privacy;
-
-   /* u8 wps_ie[512]; */
-   uint wps_ielen;
-
int bselected = true;
 
desired_encmode = psecuritypriv->ndisencryptstatus;
privacy = pnetwork->network.Privacy;
 
if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) {
-   if (rtw_get_wps_ie23a(pnetwork->network.IEs + _FIXED_IE_LENGTH_,
- pnetwork->network.IELength -
- _FIXED_IE_LENGTH_, &wps_ielen))
+   if (cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
+   WLAN_OUI_TYPE_MICROSOFT_WPA,
+   pnetwork->network.IEs +
+   _FIXED_IE_LENGTH_,
+   pnetwork->network.IELength -
+   _FIXED_IE_LENGTH_))
return true;
else
return false;
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 10/76] staging: rtl8723au: Declare rtw_get_wpa{2, }_cipher_suite() static

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ieee80211.c | 12 ++--
 drivers/staging/rtl8723au/include/ieee80211.h  |  2 --
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
index cbb1b85..fa3ca9e 100644
--- a/drivers/staging/rtl8723au/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
@@ -436,7 +436,7 @@ int rtw_generate_ie23a(struct registry_priv *pregistrypriv)
return sz;
 }
 
-int rtw_get_wpa_cipher_suite23a(const u8 *s)
+static int rtw_get_wpa_cipher_suite(const u8 *s)
 {
if (!memcmp(s, WPA_CIPHER_SUITE_NONE23A, WPA_SELECTOR_LEN))
return WPA_CIPHER_NONE;
@@ -452,7 +452,7 @@ int rtw_get_wpa_cipher_suite23a(const u8 *s)
return 0;
 }
 
-int rtw_get_wpa2_cipher_suite23a(const u8 *s)
+static int rtw_get_wpa2_cipher_suite(const u8 *s)
 {
if (!memcmp(s, RSN_CIPHER_SUITE_NONE23A, RSN_SELECTOR_LEN))
return WPA_CIPHER_NONE;
@@ -490,7 +490,7 @@ int rtw_parse_wpa_ie23a(const u8* wpa_ie, int wpa_ie_len, 
int *group_cipher, int
/* group_cipher */
if (left >= WPA_SELECTOR_LEN) {
 
-   *group_cipher = rtw_get_wpa_cipher_suite23a(pos);
+   *group_cipher = rtw_get_wpa_cipher_suite(pos);
 
pos += WPA_SELECTOR_LEN;
left -= WPA_SELECTOR_LEN;
@@ -518,7 +518,7 @@ int rtw_parse_wpa_ie23a(const u8* wpa_ie, int wpa_ie_len, 
int *group_cipher, int
}
 
for (i = 0; i < count; i++) {
-   *pairwise_cipher |= rtw_get_wpa_cipher_suite23a(pos);
+   *pairwise_cipher |= rtw_get_wpa_cipher_suite(pos);
 
pos += WPA_SELECTOR_LEN;
left -= WPA_SELECTOR_LEN;
@@ -567,7 +567,7 @@ int rtw_parse_wpa2_ie23a(const u8* rsn_ie, int rsn_ie_len, 
int *group_cipher,
 
/* group_cipher */
if (left >= RSN_SELECTOR_LEN) {
-   *group_cipher = rtw_get_wpa2_cipher_suite23a(pos);
+   *group_cipher = rtw_get_wpa2_cipher_suite(pos);
 
pos += RSN_SELECTOR_LEN;
left -= RSN_SELECTOR_LEN;
@@ -594,7 +594,7 @@ int rtw_parse_wpa2_ie23a(const u8* rsn_ie, int rsn_ie_len, 
int *group_cipher,
}
 
for (i = 0; i < count; i++) {
-   *pairwise_cipher |= rtw_get_wpa2_cipher_suite23a(pos);
+   *pairwise_cipher |= rtw_get_wpa2_cipher_suite(pos);
 
pos += RSN_SELECTOR_LEN;
left -= RSN_SELECTOR_LEN;
diff --git a/drivers/staging/rtl8723au/include/ieee80211.h 
b/drivers/staging/rtl8723au/include/ieee80211.h
index 3738978..0ef6e79 100644
--- a/drivers/staging/rtl8723au/include/ieee80211.h
+++ b/drivers/staging/rtl8723au/include/ieee80211.h
@@ -425,8 +425,6 @@ int rtw_ies_remove_ie23a(u8 *ies, uint *ies_len, uint 
offset, u8 eid, u8 *oui, u
 
 void rtw_set_supported_rate23a(u8* SupportedRates, uint mode) ;
 
-int rtw_get_wpa_cipher_suite23a(const u8 *s);
-int rtw_get_wpa2_cipher_suite23a(const u8 *s);
 int rtw_parse_wpa_ie23a(const u8* wpa_ie, int wpa_ie_len, int *group_cipher, 
int *pairwise_cipher, int *is_8021x);
 int rtw_parse_wpa2_ie23a(const u8* wpa_ie, int wpa_ie_len, int *group_cipher, 
int *pairwise_cipher, int *is_8021x);
 
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 06/76] staging: rtl8723au: Remove obsolete rtw_get_wps_ie23a()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ieee80211.c | 44 --
 drivers/staging/rtl8723au/include/ieee80211.h  |  1 -
 2 files changed, 45 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
index 7ca2e11..2740639 100644
--- a/drivers/staging/rtl8723au/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
@@ -697,50 +697,6 @@ int rtw_get_sec_ie23a(u8 *in_ie, uint in_len, u8 *rsn_ie, 
u16 *rsn_len,
 }
 
 /**
- * rtw_get_wps_ie23a - Search WPS IE from a series of IEs
- * @in_ie: Address of IEs to search
- * @in_len: Length limit from in_ie
- * @wps_ielen: If not NULL and WPS IE is found, will set to the length of
- * the entire WPS IE
- *
- * Returns: The address of the WPS IE found, or NULL
- */
-u8 *rtw_get_wps_ie23a(u8 *in_ie, uint in_len, uint *wps_ielen)
-{
-   uint cnt;
-   u8 *wpsie_ptr = NULL;
-   u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};
-
-   if (wps_ielen)
-   *wps_ielen = 0;
-
-   if (!in_ie || in_len <= 0)
-   return wpsie_ptr;
-
-   cnt = 0;
-
-   while (cnt < in_len) {
-   eid = in_ie[cnt];
-
-   if (eid == WLAN_EID_VENDOR_SPECIFIC &&
-   !memcmp(&in_ie[cnt+2], wps_oui, 4)) {
-   wpsie_ptr = &in_ie[cnt];
-
-   if (wps_ielen)
-   *wps_ielen = in_ie[cnt + 1] + 2;
-
-   cnt += in_ie[cnt + 1] + 2;
-
-   break;
-   } else {
-   cnt += in_ie[cnt + 1] + 2; /* goto next */
-   }
-   }
-
-   return wpsie_ptr;
-}
-
-/**
  * rtw_get_wps_attr23a - Search a specific WPS attribute from a given WPS IE
  * @wps_ie: Address of WPS IE to search
  * @wps_ielen: Length limit from wps_ie
diff --git a/drivers/staging/rtl8723au/include/ieee80211.h 
b/drivers/staging/rtl8723au/include/ieee80211.h
index 432d255..6f42d2d 100644
--- a/drivers/staging/rtl8723au/include/ieee80211.h
+++ b/drivers/staging/rtl8723au/include/ieee80211.h
@@ -432,7 +432,6 @@ int rtw_parse_wpa2_ie23a(const u8* wpa_ie, int wpa_ie_len, 
int *group_cipher, in
 
 int rtw_get_sec_ie23a(u8 *in_ie,uint in_len,u8 *rsn_ie,u16 *rsn_len,u8 
*wpa_ie,u16 *wpa_len);
 
-u8 *rtw_get_wps_ie23a(u8 *in_ie, uint in_len, uint *wps_ielen);
 const u8 *rtw_get_wps_attr23a(const u8 *wps_ie, uint wps_ielen, u16 
target_attr_id ,u8 *buf_attr, u32 *len_attr);
 const u8 *rtw_get_wps_attr_content23a(const u8 *wps_ie, uint wps_ielen, u16 
target_attr_id ,u8 *buf_content, uint *len_content);
 
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 32/76] staging: rtl8723au: rtw_check_bcn_info23a(): Use ether_addr_equal() to check BSSID

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_wlan_util.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
index 3195b44..a2c249f 100644
--- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
@@ -910,10 +910,9 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
return _FAIL;
}
 
-   if (memcmp(cur_network->network.MacAddress, mgmt->bssid, 6)) {
-   DBG_8723A("Oops: rtw_check_network_encrypt linked but recv "
- "other bssid bcn\n" MAC_FMT MAC_FMT,
- MAC_ARG(mgmt->bssid),
+   if (!ether_addr_equal(cur_network->network.MacAddress, mgmt->bssid)) {
+   DBG_8723A("%s: linked but recv other bssid bcn"
+ MAC_FMT MAC_FMT "\n", __func__, MAC_ARG(mgmt->bssid),
  MAC_ARG(cur_network->network.MacAddress));
return true;
}
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 07/76] staging: rtl8723au: rtw_get_bcn_info23a(): Use cfg80211_* to obtain crypto info

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ieee80211.c | 29 +-
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
index 2740639..484272e 100644
--- a/drivers/staging/rtl8723au/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
@@ -857,8 +857,9 @@ void rtw_get_bcn_info23a(struct wlan_network *pnetwork)
 {
unsigned short cap;
u8 bencrypt = 0;
-   /* u8 wpa_ie[255], rsn_ie[255]; */
-   u16 wpa_len = 0, rsn_len = 0;
+   int pie_len, ie_offset;
+   u8 *pie;
+   const u8 *p;
 
cap = get_unaligned_le16(
rtw_get_capability23a_from_ie(pnetwork->network.IEs));
@@ -868,24 +869,22 @@ void rtw_get_bcn_info23a(struct wlan_network *pnetwork)
} else
pnetwork->BcnInfo.encryp_protocol = ENCRYP_PROTOCOL_OPENSYS;
 
-   rtw_get_sec_ie23a(pnetwork->network.IEs, pnetwork->network.IELength,
-  NULL, &rsn_len, NULL, &wpa_len);
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
 ("rtw_get_bcn_info23a: ssid =%s\n", 
pnetwork->network.Ssid.ssid));
-   RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
-("rtw_get_bcn_info23a: wpa_len =%d rsn_len =%d\n",
- wpa_len, rsn_len));
-   RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
-("rtw_get_bcn_info23a: ssid =%s\n", 
pnetwork->network.Ssid.ssid));
-   RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
-("rtw_get_bcn_info23a: wpa_len =%d rsn_len =%d\n",
- wpa_len, rsn_len));
 
-   if (rsn_len > 0)
+   ie_offset = offsetof(struct ieee80211_mgmt, u.beacon.variable) -
+   offsetof(struct ieee80211_mgmt, u);
+   pie = pnetwork->network.IEs + ie_offset;
+   pie_len = pnetwork->network.IELength - ie_offset;
+
+   p = cfg80211_find_ie(WLAN_EID_RSN, pie, pie_len);
+   if (p && p[1]) {
pnetwork->BcnInfo.encryp_protocol = ENCRYP_PROTOCOL_WPA2;
-   else if (wpa_len > 0)
+   } else if (cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
+  WLAN_OUI_TYPE_MICROSOFT_WPA,
+  pie, pie_len)) {
pnetwork->BcnInfo.encryp_protocol = ENCRYP_PROTOCOL_WPA;
-   else {
+   } else {
if (bencrypt)
pnetwork->BcnInfo.encryp_protocol = ENCRYP_PROTOCOL_WEP;
}
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 20/76] staging: rtl8723au: Reference correct firmwarefiles with MODULE_FIRMWARE()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Add missing firmware references, and request the correct one.

Reported-by: Larry Finger 
Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/os_dep/os_intfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723au/os_dep/os_intfs.c 
b/drivers/staging/rtl8723au/os_dep/os_intfs.c
index 89c51d0..ee3d62c 100644
--- a/drivers/staging/rtl8723au/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723au/os_dep/os_intfs.c
@@ -29,7 +29,9 @@ MODULE_AUTHOR("Realtek Semiconductor Corp.");
 MODULE_AUTHOR("Larry Finger ");
 MODULE_AUTHOR("Jes Sorensen ");
 MODULE_VERSION(DRIVERVERSION);
-MODULE_FIRMWARE("rtlwifi/rtl8821aefw.bin");
+MODULE_FIRMWARE("rtlwifi/rtl8723aufw_A.bin");
+MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B.bin");
+MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B_NoBT.bin");
 
 /* module param defaults */
 static int rtw_chip_version = 0x00;
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 38/76] staging: rtl8723au: Allocate struct wlan_bssid_ex in collect_bss_info()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c| 52 
 drivers/staging/rtl8723au/include/rtw_mlme_ext.h |  3 --
 2 files changed, 25 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index 9b6d918..02180fc 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -61,6 +61,8 @@ static void start_clnt_assoc(struct rtw_adapter *padapter);
 static void start_clnt_auth(struct rtw_adapter *padapter);
 static void start_clnt_join(struct rtw_adapter *padapter);
 static void start_create_ibss(struct rtw_adapter *padapter);
+static struct wlan_bssid_ex *collect_bss_info(struct rtw_adapter *padapter,
+ struct recv_frame *precv_frame);
 
 #ifdef CONFIG_8723AU_AP_MODE
 static int OnAuth23a(struct rtw_adapter *padapter, struct recv_frame 
*precv_frame);
@@ -825,16 +827,11 @@ OnBeacon23a(struct rtw_adapter *padapter, struct 
recv_frame *precv_frame)
if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) {
/* we should update current network before auth,
   or some IE is wrong */
-   pbss = (struct wlan_bssid_ex *)
-   kmalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC);
+   pbss = collect_bss_info(padapter, precv_frame);
if (pbss) {
-   if (collect_bss_info23a(padapter, precv_frame, pbss) ==
-   _SUCCESS) {
-   update_network23a(
-   &pmlmepriv->cur_network.network, pbss,
-   padapter, true);
-   rtw_get_bcn_info23a(&pmlmepriv->cur_network);
-   }
+   update_network23a(&pmlmepriv->cur_network.network, pbss,
+ padapter, true);
+   rtw_get_bcn_info23a(&pmlmepriv->cur_network);
kfree(pbss);
}
 
@@ -4252,9 +4249,8 @@ static void rtw_site_survey(struct rtw_adapter *padapter)
 }
 
 /* collect bss info from Beacon and Probe request/response frames. */
-int collect_bss_info23a(struct rtw_adapter *padapter,
-   struct recv_frame *precv_frame,
-   struct wlan_bssid_ex *bssid)
+static struct wlan_bssid_ex *collect_bss_info(struct rtw_adapter *padapter,
+ struct recv_frame *precv_frame)
 {
int i;
const u8 *p;
@@ -4265,16 +4261,19 @@ int collect_bss_info23a(struct rtw_adapter *padapter,
struct registry_priv *pregistrypriv = &padapter->registrypriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
+   struct wlan_bssid_ex *bssid;
u16 capab_info;
 
length = skb->len - sizeof(struct ieee80211_hdr_3addr);
 
if (length > MAX_IE_SZ) {
/* DBG_8723A("IE too long for survey event\n"); */
-   return _FAIL;
+   return NULL;
}
 
-   memset(bssid, 0, sizeof(struct wlan_bssid_ex));
+   bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC);
+   if (!bssid)
+   return NULL;
 
if (ieee80211_is_beacon(mgmt->frame_control)) {
bssid->reserved = 1;
@@ -4325,13 +4324,13 @@ int collect_bss_info23a(struct rtw_adapter *padapter,
 
if (!p) {
DBG_8723A("marc: cannot find SSID for survey event\n");
-   return _FAIL;
+   goto fail;
}
 
if (p[1] > IEEE80211_MAX_SSID_LEN) {
DBG_8723A("%s()-%d: IE too long (%d) for survey "
  "event\n", __func__, __LINE__, p[1]);
-   return _FAIL;
+   goto fail;
}
memcpy(bssid->Ssid.ssid, p + 2, p[1]);
bssid->Ssid.ssid_len = p[1];
@@ -4346,7 +4345,7 @@ int collect_bss_info23a(struct rtw_adapter *padapter,
if (p[1] > NDIS_802_11_LENGTH_RATES_EX) {
DBG_8723A("%s()-%d: IE too long (%d) for survey "
  "event\n", __func__, __LINE__, p[1]);
-   return _FAIL;
+   goto fail;
}
memcpy(bssid->SupportedRates, p + 2, p[1]);
i = p[1];
@@ -4358,13 +4357,13 @@ int collect_bss_info23a(struct rtw_adapter *padapter,
if (p[1] > (NDIS_802_11_LENGTH_RATES_EX-i)) {
DBG_8723A("%s()-%d: IE too long (%d) for survey "
  "event\n", __func__, __LINE__, p[1]);
-   return _FAIL;
+   goto fail;
}
memcpy(bssid->SupportedRates + i, p + 2, p[1]);

[PATCH 05/76] staging: rtl8723au: rtw_ap.c: Convert from rtw_get_wps_ie23a() to cfg80211_find_vendor_ie()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Some of this is hackish, but so was the original code. This needs to
be cleaned up eventually.

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ap.c | 25 -
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c 
b/drivers/staging/rtl8723au/core/rtw_ap.c
index 6c9a933..d67a5f1 100644
--- a/drivers/staging/rtl8723au/core/rtw_ap.c
+++ b/drivers/staging/rtl8723au/core/rtw_ap.c
@@ -663,9 +663,11 @@ static void start_bss_network(struct rtw_adapter 
*padapter, u8 *pbuf)
/* check if there is wps ie, */
/* if there is wpsie in beacon, the hostapd will update beacon twice 
when stating hostapd, */
/* and at first time the security ie (RSN/WPA IE) will not include in 
beacon. */
-   if (NULL == rtw_get_wps_ie23a(pnetwork->IEs + _FIXED_IE_LENGTH_,
- pnetwork->IELength - _FIXED_IE_LENGTH_,
- NULL))
+   if (NULL == cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
+   WLAN_OUI_TYPE_MICROSOFT_WPS,
+   pnetwork->IEs + _FIXED_IE_LENGTH_,
+   pnetwork->IELength -
+   _FIXED_IE_LENGTH_))
pmlmeext->bstart_bss = true;
 
/* todo: update wmm, ht cap */
@@ -1231,7 +1233,8 @@ static void update_bcn_wmm_ie(struct rtw_adapter 
*padapter)
 
 static void update_bcn_wps_ie(struct rtw_adapter *padapter)
 {
-   u8 *pwps_ie = NULL, *pwps_ie_src, *premainder_ie, *pbackup_remainder_ie 
= NULL;
+   const u8 *pwps_ie, *premainder_ie;
+   u8 *pwps_ie_src, *pbackup_remainder_ie = NULL;
uint wps_ielen = 0, wps_offset, remainder_ielen;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -1246,12 +1249,15 @@ static void update_bcn_wps_ie(struct rtw_adapter 
*padapter)
if (pwps_ie_src == NULL)
return;
 
-   pwps_ie = rtw_get_wps_ie23a(ie + _FIXED_IE_LENGTH_,
-   ielen - _FIXED_IE_LENGTH_, &wps_ielen);
+   pwps_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
+ WLAN_OUI_TYPE_MICROSOFT_WPS,
+ ie + _FIXED_IE_LENGTH_,
+ ielen - _FIXED_IE_LENGTH_);
 
-   if (pwps_ie == NULL || wps_ielen == 0)
+   if (pwps_ie == NULL || pwps_ie[1] == 0)
return;
 
+   wps_ielen = pwps_ie[1];
wps_offset = (uint)(pwps_ie-ie);
 
premainder_ie = pwps_ie + wps_ielen;
@@ -1268,11 +1274,12 @@ static void update_bcn_wps_ie(struct rtw_adapter 
*padapter)
wps_ielen = (uint)pwps_ie_src[1];/* to get ie data len */
if ((wps_offset+wps_ielen+2+remainder_ielen)<= MAX_IE_SZ)
{
-   memcpy(pwps_ie, pwps_ie_src, wps_ielen+2);
+   memcpy(ie + wps_offset, pwps_ie_src, wps_ielen + 2);
pwps_ie += (wps_ielen+2);
 
if (pbackup_remainder_ie)
-   memcpy(pwps_ie, pbackup_remainder_ie, remainder_ielen);
+   memcpy(ie + wps_offset + wps_ielen + 2,
+  pbackup_remainder_ie, remainder_ielen);
 
/* update IELength */
pnetwork->IELength = wps_offset + (wps_ielen+2) + 
remainder_ielen;
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 17/76] staging: rtl8723au: issue_auth(): Convert to using struct ieee80211_mgmt

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

This reduces the dependency of rtw_set_fixed_ie23a() which is
scheduled to go away.

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 101 +++---
 1 file changed, 44 insertions(+), 57 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index 9b8566c..616bb7c 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -3036,9 +3036,10 @@ static void issue_auth(struct rtw_adapter *padapter, 
struct sta_info *psta,
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
unsigned char *pframe;
-   struct ieee80211_hdr *pwlanhdr;
+   struct ieee80211_mgmt *mgmt;
unsigned int val32;
unsigned short val16;
+   u16 auth_algo;
int use_shared_key = 0;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -3055,23 +3056,20 @@ static void issue_auth(struct rtw_adapter *padapter, 
struct sta_info *psta,
memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
 
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-   pwlanhdr = (struct ieee80211_hdr *)pframe;
+   mgmt = (struct ieee80211_mgmt *)pframe;
 
-   pwlanhdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
- IEEE80211_STYPE_AUTH);
-   pwlanhdr->seq_ctrl =
-   cpu_to_le16(IEEE80211_SN_TO_SEQ(pmlmeext->mgnt_seq));
+   mgmt->frame_control =
+   cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH);
+   mgmt->seq_ctrl = cpu_to_le16(IEEE80211_SN_TO_SEQ(pmlmeext->mgnt_seq));
pmlmeext->mgnt_seq++;
 
-   pframe += sizeof(struct ieee80211_hdr_3addr);
-   pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr);
+   pattrib->pktlen = offsetof(struct ieee80211_mgmt, u.auth.variable);
 
if (psta) { /*  for AP mode */
 #ifdef CONFIG_8723AU_AP_MODE
-
-   ether_addr_copy(pwlanhdr->addr1, psta->hwaddr);
-   ether_addr_copy(pwlanhdr->addr2, myid(&padapter->eeprompriv));
-   ether_addr_copy(pwlanhdr->addr3, myid(&padapter->eeprompriv));
+   ether_addr_copy(mgmt->da, psta->hwaddr);
+   ether_addr_copy(mgmt->sa, myid(&padapter->eeprompriv));
+   ether_addr_copy(mgmt->bssid, myid(&padapter->eeprompriv));
 
/*  setting auth algo number */
val16 = (u16)psta->authalg;
@@ -3079,29 +3077,19 @@ static void issue_auth(struct rtw_adapter *padapter, 
struct sta_info *psta,
if (status != WLAN_STATUS_SUCCESS)
val16 = 0;
 
-   if (val16) {
-   val16 = cpu_to_le16(val16);
+   if (val16)
use_shared_key = 1;
-   }
 
-   pframe = rtw_set_fixed_ie23a(pframe, _AUTH_ALGM_NUM_,
-(unsigned char *)&val16,
-&pattrib->pktlen);
+   mgmt->u.auth.auth_alg = cpu_to_le16(val16);
 
/*  setting auth seq number */
-   val16 = (u16)psta->auth_seq;
-   val16 = cpu_to_le16(val16);
-   pframe = rtw_set_fixed_ie23a(pframe, _AUTH_SEQ_NUM_,
-(unsigned char *)&val16,
-&pattrib->pktlen);
+   mgmt->u.auth.auth_transaction =
+   cpu_to_le16((u16)psta->auth_seq);
 
/*  setting status code... */
-   val16 = status;
-   val16 = cpu_to_le16(val16);
-   pframe = rtw_set_fixed_ie23a(pframe, _STATUS_CODE_,
-(unsigned char *)&val16,
-&pattrib->pktlen);
+   mgmt->u.auth.status_code = cpu_to_le16(status);
 
+   pframe = mgmt->u.auth.variable;
/*  added challenging text... */
if ((psta->auth_seq == 2) &&
(psta->state & WIFI_FW_AUTH_STATE) && (use_shared_key == 1))
@@ -3109,19 +3097,21 @@ static void issue_auth(struct rtw_adapter *padapter, 
struct sta_info *psta,
   psta->chg_txt, &pattrib->pktlen);
 #endif
} else {
-   ether_addr_copy(pwlanhdr->addr1,
-   get_my_bssid23a(&pmlmeinfo->network));
-   ether_addr_copy(pwlanhdr->addr2, myid(&padapter->eeprompriv));
-   ether_addr_copy(pwlanhdr->addr3,
+   struct ieee80211_mgmt *iv_mgmt;
+
+   ether_addr_copy(mgmt->da, get_my_bssid23a(&pmlmeinfo->network));
+   ether_addr_copy(mgmt->sa, myid(&padapter->eeprompriv));
+   ether_addr_copy(mgmt->bssid,

[PATCH 26/76] staging: rtl8723au: ioctl_cfg80211.c: Use struct ieee80211_mgmt to build mgmt frame

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 30 ---
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index e0846f7..218933a 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -2437,17 +2437,15 @@ void rtw_cfg80211_indicate_sta_disassoc(struct 
rtw_adapter *padapter,
 {
s32 freq;
int channel;
-   u8 *pmgmt_frame;
uint frame_len;
-   struct ieee80211_hdr *pwlanhdr;
-   u8 mgmt_buf[128];
+   struct ieee80211_mgmt mgmt;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct net_device *ndev = padapter->pnetdev;
 
DBG_8723A("%s(padapter =%p,%s)\n", __func__, padapter, ndev->name);
 
-   memset(mgmt_buf, 0, 128);
+   memset(&mgmt, 0, sizeof(struct ieee80211_mgmt));
 
 #if defined(RTW_USE_CFG80211_STA_EVENT)
cfg80211_del_sta(ndev, da, GFP_ATOMIC);
@@ -2460,29 +2458,21 @@ void rtw_cfg80211_indicate_sta_disassoc(struct 
rtw_adapter *padapter,
freq = ieee80211_channel_to_frequency(channel,
  IEEE80211_BAND_5GHZ);
 
-   pmgmt_frame = mgmt_buf;
-   pwlanhdr = (struct ieee80211_hdr *)pmgmt_frame;
-
-   pwlanhdr->frame_control =
+   mgmt.frame_control =
cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH);
 
-   ether_addr_copy(pwlanhdr->addr1, myid(&padapter->eeprompriv));
-   ether_addr_copy(pwlanhdr->addr2, da);
-   ether_addr_copy(pwlanhdr->addr3, get_my_bssid23a(&pmlmeinfo->network));
+   ether_addr_copy(mgmt.da, myid(&padapter->eeprompriv));
+   ether_addr_copy(mgmt.sa, da);
+   ether_addr_copy(mgmt.bssid, get_my_bssid23a(&pmlmeinfo->network));
 
-   pwlanhdr->seq_ctrl =
-   cpu_to_le16(IEEE80211_SN_TO_SEQ(pmlmeext->mgnt_seq));
+   mgmt.seq_ctrl = cpu_to_le16(IEEE80211_SN_TO_SEQ(pmlmeext->mgnt_seq));
pmlmeext->mgnt_seq++;
 
-   pmgmt_frame += sizeof(struct ieee80211_hdr_3addr);
-   frame_len = sizeof(struct ieee80211_hdr_3addr);
+   mgmt.u.disassoc.reason_code = cpu_to_le16(reason);
 
-   reason = cpu_to_le16(reason);
-   pmgmt_frame = rtw_set_fixed_ie23a(pmgmt_frame,
-  WLAN_REASON_PREV_AUTH_NOT_VALID,
-  (unsigned char *)&reason, &frame_len);
+   frame_len = sizeof(struct ieee80211_hdr_3addr) + 2;
 
-   cfg80211_rx_mgmt(padapter->rtw_wdev, freq, 0, mgmt_buf, frame_len,
+   cfg80211_rx_mgmt(padapter->rtw_wdev, freq, 0, (u8 *)&mgmt, frame_len,
 0, GFP_ATOMIC);
 #endif /* defined(RTW_USE_CFG80211_STA_EVENT) */
 }
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 30/76] staging: rtl8723au: Remove unused #defines WEP_KEY_LEN and MGMT_QUEUE_NUM

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/include/ieee80211.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/rtl8723au/include/ieee80211.h 
b/drivers/staging/rtl8723au/include/ieee80211.h
index cb3f4fa..7d22825 100644
--- a/drivers/staging/rtl8723au/include/ieee80211.h
+++ b/drivers/staging/rtl8723au/include/ieee80211.h
@@ -27,8 +27,6 @@
 #endif
 
 
-#define MGMT_QUEUE_NUM 5
-
 #ifdef CONFIG_8723AU_AP_MODE
 
 /* STA flags */
@@ -305,7 +303,6 @@ struct ieee80211_snap_hdr {
 #define IEEE80211_OFDM_SHIFT_MASK_A 4
 
 #define WEP_KEYS 4
-#define WEP_KEY_LEN 13
 
 
 /* MAX_RATES_LENGTH needs to be 12.  The spec says 8, and many APs
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 15/76] staging: rtl8723au: Be consistent in how htpriv.ht_option is checked

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ap.c| 6 +++---
 drivers/staging/rtl8723au/core/rtw_mlme.c  | 2 +-
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c  | 6 +++---
 drivers/staging/rtl8723au/core/rtw_wlan_util.c | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c 
b/drivers/staging/rtl8723au/core/rtw_ap.c
index d67a5f1..a52662e 100644
--- a/drivers/staging/rtl8723au/core/rtw_ap.c
+++ b/drivers/staging/rtl8723au/core/rtw_ap.c
@@ -1391,7 +1391,7 @@ static int rtw_ht_operation_update(struct rtw_adapter 
*padapter)
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv;
 
-   if (pmlmepriv->htpriv.ht_option == true)
+   if (pmlmepriv->htpriv.ht_option)
return 0;
 
/* if (!iface->conf->ieee80211n || iface->conf->ht_op_mode_fixed) */
@@ -1627,7 +1627,7 @@ void bss_cap_update_on_sta_join23a(struct rtw_adapter 
*padapter, struct sta_info
psta->no_ht_set = 1;
pmlmepriv->num_sta_no_ht++;
}
-   if (pmlmepriv->htpriv.ht_option == true) {
+   if (pmlmepriv->htpriv.ht_option) {
DBG_8723A("%s STA " MAC_FMT
   " - no HT, num of non-HT stations %d\n",
   __func__, MAC_ARG(psta->hwaddr),
@@ -1865,7 +1865,7 @@ void sta_info_update23a(struct rtw_adapter *padapter, 
struct sta_info *psta)
psta->htpriv.ht_option = false;
}
 
-   if (pmlmepriv->htpriv.ht_option == false)
+   if (!pmlmepriv->htpriv.ht_option)
psta->htpriv.ht_option = false;
 
update_sta_info23a_apmode23a(padapter, psta);
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index d48b986..31c414a 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -2409,7 +2409,7 @@ void rtw_issue_addbareq_cmd23a(struct rtw_adapter 
*padapter,
 
phtpriv = &psta->htpriv;
 
-   if (phtpriv->ht_option == true && phtpriv->ampdu_enable == true) {
+   if (phtpriv->ht_option && phtpriv->ampdu_enable == true) {
issued = (phtpriv->agg_enable_bitmap>>priority)&0x1;
issued |= (phtpriv->candidate_tid_bitmap>>priority)&0x1;
 
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index e32df75..ae8d38f 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -1666,7 +1666,7 @@ OnAssocReq23a(struct rtw_adapter *padapter, struct 
recv_frame *precv_frame)
} else
pstat->flags &= ~WLAN_STA_HT;
 
-   if (pmlmepriv->htpriv.ht_option == false && pstat->flags & WLAN_STA_HT){
+   if (!pmlmepriv->htpriv.ht_option && pstat->flags & WLAN_STA_HT){
status = WLAN_STATUS_UNSPECIFIED_FAILURE;
goto OnAssocReq23aFail;
}
@@ -3479,7 +3479,7 @@ static void issue_assocreq(struct rtw_adapter *padapter)
   &pattrib->pktlen);
 
/* HT caps */
-   if (padapter->mlmepriv.htpriv.ht_option == true) {
+   if (padapter->mlmepriv.htpriv.ht_option) {
p = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, pie, pie_len);
 
if (p && !is_ap_in_tkip23a(padapter)) {
@@ -5848,7 +5848,7 @@ static void addba_timer_hdl(unsigned long data)
 
phtpriv = &psta->htpriv;
 
-   if (phtpriv->ht_option == true && phtpriv->ampdu_enable == true) {
+   if (phtpriv->ht_option && phtpriv->ampdu_enable == true) {
if (phtpriv->candidate_tid_bitmap)
phtpriv->candidate_tid_bitmap = 0x0;
}
diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
index b9ca088..3195b44 100644
--- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
@@ -727,7 +727,7 @@ void HT_caps_handler23a(struct rtw_adapter *padapter, const 
u8 *p)
if (!p)
return;
 
-   if (phtpriv->ht_option == false)
+   if (!phtpriv->ht_option)
return;
 
pmlmeinfo->HT_caps_enable = 1;
@@ -784,7 +784,7 @@ void HT_info_handler23a(struct rtw_adapter *padapter, const 
u8 *p)
if (!p)
return;
 
-   if (phtpriv->ht_option == false)
+   if (!phtpriv->ht_option)
return;
 
if (p[1] != sizeof(struct ieee80211_ht_operation))
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 00/76] staging-next: rtl8723au: More fixes for 3.16

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Greg,

Thanks for pushing my other changes to Linus. This set goes on top of
the set I sent you on 2014/05/31 and the fix from 2014/06/03. If you
prefer I go back and submit it all as one large set, let me know.

This set contains a number of fixes, including getting rid of some 'on
the wire' noise that isn't in the spec, plus removes a bunch of
functionality which is handled by the 802.11 stack, and shouldn't be
done within the driver.

I hope there is still a change to get it all in through the 3.16 merge
window?

Thanks,
Jes


Jes Sorensen (76):
  staging: rtl8723au: rtw_get_wps_ie23a(): Remove unused dest pointer
wps_ie
  staging: rtl8723au: rtw_mlme_ext.c: Convert rtw_get_wps_ie23a() to
cfg80211_find_vendor_ie()
  staging: rtl8723au: rtw_mlme.c: Convert rtw_get_wps_ie23a() to
cfg80211_find_vendor_ie()
  staging: rtl8723au: ioctl_cfg80211.c: Convert rtw_get_wps_ie23a() to
cfg80211_find_vendor_ie()
  staging: rtl8723au: rtw_ap.c: Convert from rtw_get_wps_ie23a() to
cfg80211_find_vendor_ie()
  staging: rtl8723au: Remove obsolete rtw_get_wps_ie23a()
  staging: rtl8723au: rtw_get_bcn_info23a(): Use cfg80211_* to obtain
crypto info
  staging: rtl8723au: rtw_wlan_util.c: Use cfg80211_* to determine
crypto
  staging: rtl8723au: Remove obsolete rtw_get_sec_ie23a()
  staging: rtl8723au: Declare rtw_get_wpa{2,}_cipher_suite() static
  staging: rtl8723au: Make WMM_param_handler23a() and
HT_caps_handler23a() take a const u8 *
  staging: rtl8723au: OnAssocRsp23a(): Use cfg80211_* to parse IEs
  staging: rtl8723au: Remove WMM_ defines
  staging: rtl8723au: Make struct ht_priv.ht_option a bool
  staging: rtl8723au: Be consistent in how htpriv.ht_option is checked
  staging: rtl8723au: Make struct htpriv.ampdu_enable a bool
  staging: rtl8723au: issue_auth(): Convert to using struct
ieee80211_mgmt
  staging: rtl8723au: issue_assocrsp(): Use struct ieee80211_mgmt
instead of rtw_set_fixed_ie23a()
  staging: rtl8723au: Request correct firmware file for A-cut parts
  staging: rtl8723au: Reference correct firmwarefiles with
MODULE_FIRMWARE()
  staging: rtl8723au: _issue_deauth(): Use struct ieee80211_mgmt to
build frame
  staging: rtl8723au: issue_action_spct_ch_switch23a(): Use struct
ieee80211_mgmt
  staging: rtl8723au: issue_action_BSSCoexistPacket(): Use struct
ieee80211_mgmt
  staging: rtl8723au: Do not xmit BSS Coexistence management action
frames
  staging: rtl8723au: Let cfg80211 handle public action management
frames
  staging: rtl8723au: ioctl_cfg80211.c: Use struct ieee80211_mgmt to
build mgmt frame
  staging: rtl8723au: issue_action_BA23a(): Use struct ieee80211_mgmt to
build action frames
  staging: rtl8723au: Remove obsolete rtw_set_fixed_ie23a()
  staging: rtl8723au: Remove duplicate defines of
IEEE80211_HT_PARAM_CHA_SEC_*
  staging: rtl8723au: Remove unused #defines WEP_KEY_LEN and
MGMT_QUEUE_NUM
  staging: rtl8723au: Remove some unused 80211 header parsing macros
  staging: rtl8723au: rtw_check_bcn_info23a(): Use ether_addr_equal() to
check BSSID
  staging: rtl8723au: rtw_check_bcn_info23a(): Don't make a local copy
of beacon just to parse it
  staging: rtl8723au: rtw_check_bcn_info23a(): Don't search for WPA/WPA2
info twice
  staging: rtl8723au: Declare rtw_update_scanned_network() static
  staging: rtl8723au: rtw_survey_event_cb23a(): Use the correct types
for the received arguments
  staging: rtl8723au: Do not embed struct wlan_bssid_ex in struct
survey_event
  staging: rtl8723au: Allocate struct wlan_bssid_ex in
collect_bss_info()
  staging: rtl8723au: collect_bss_info(): Don't memset() what we just
kzalloc()'d
  staging: rtl8723au: free_scanqueue(): Use _rtw_free_network23a()
  staging: rtl8723au: rtw_stadel_event_callback23a(): Remove superfluous
memset()
  staging: rtl8723au: OnAuth23a(): Use ether_addr_copy()
  staging: rtl8723au: Get rid of IW_ESSID_MAX_SIZE
  staging: rtl8723au: Make rtw_is_same_ibss23a() return bool
  staging: rtl8723au: cfg80211_rtw_connect(): Check correct return value
from rtw_set_802_11_ssid23a()
  staging: rtl8723au: Fold rtw_set_802_11_authentication_mode23a() into
cfg80211_rtw_connect()
  staging: rtl8723au: Move rtw_set_802_11_ssid23a() to ioctl_cfg80211.c
  staging: rtl8723au: cfg80211_rtw_connect(): Clean up various bits
  staging: rtl8723au: cfg80211_rtw_connect(): Remove obfuscating
pointers
  staging: rtl8723au: cfg80211_rtw_connect(): Simplify ssid preparation
  staging: rtl8723au: Pass a struct wlan_network to rtw_set_ssid()
  staging: rtl8723au: rtw_set_ssid(): This is never called with
_FW_UNDER_LINKING
  staging: rtl8723au: rtw_cfg80211_add_wep(): Use WLAN_KEY_LEN_*
  staging: rtl8723au: rtw_do_join23a(): Use correct error return values
  staging: rtl8723au: Minor debug message fixup
  staging: rtl8723au: Don't prepend debug console messages with 'ERROR '
  staging: rtl8723au: Introduce rtw_select_candidate_from_qu

[PATCH 40/76] staging: rtl8723au: free_scanqueue(): Use _rtw_free_network23a()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Use _rtw_free_network23() so elements are freed in one place.

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 71ff753..7c99c37 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -831,9 +831,9 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv)
phead = get_list_head(scan_queue);
 
list_for_each_safe(plist, ptemp, phead) {
-   list_del_init(plist);
pnetwork = container_of(plist, struct wlan_network, list);
-   kfree(pnetwork);
+   pnetwork->fixed = false;
+   _rtw_free_network23a(pmlmepriv, pnetwork);
 }
 
spin_unlock_bh(&scan_queue->lock);
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 13/76] staging: rtl8723au: Remove WMM_ defines

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Only one is used, and only describes the size of an array defined in a
local function. Use sizeof() in the local function to deobfuscate it.

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c | 7 ---
 drivers/staging/rtl8723au/include/wifi.h  | 7 ---
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 76e1797..a3174c0 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -2197,7 +2197,7 @@ unsigned int rtw_restructure_ht_ie23a(struct rtw_adapter 
*padapter, u8 *in_ie,
unsigned char *pframe;
const u8 *p;
struct ieee80211_ht_cap ht_capie;
-   unsigned char WMM_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00};
+   u8 WMM_IE[7] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00};
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct ht_priv *phtpriv = &pmlmepriv->htpriv;
 
@@ -2210,8 +2210,9 @@ unsigned int rtw_restructure_ht_ie23a(struct rtw_adapter 
*padapter, u8 *in_ie,
if (pmlmepriv->qos_option == 0) {
out_len = *pout_len;
pframe = rtw_set_ie23a(out_ie + out_len,
-   WLAN_EID_VENDOR_SPECIFIC,
-   _WMM_IE_Length_, WMM_IE, pout_len);
+  WLAN_EID_VENDOR_SPECIFIC,
+  sizeof(WMM_IE), WMM_IE,
+  pout_len);
 
pmlmepriv->qos_option = 1;
}
diff --git a/drivers/staging/rtl8723au/include/wifi.h 
b/drivers/staging/rtl8723au/include/wifi.h
index 4ab28e5..07ea4c6 100644
--- a/drivers/staging/rtl8723au/include/wifi.h
+++ b/drivers/staging/rtl8723au/include/wifi.h
@@ -53,13 +53,6 @@
 #define _TIMESTAMP_8
 
 /*-
-   Below is the definition for WMM
---*/
-#define _WMM_IE_Length_7  /*  for WMM STA */
-#define _WMM_Para_Element_Length_  24
-
-
-/*-
Below is the definition for 802.11n
 
--*/
 
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 09/76] staging: rtl8723au: Remove obsolete rtw_get_sec_ie23a()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ieee80211.c | 75 --
 drivers/staging/rtl8723au/include/ieee80211.h  |  2 -
 2 files changed, 77 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
index 484272e..cbb1b85 100644
--- a/drivers/staging/rtl8723au/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
@@ -621,81 +621,6 @@ int rtw_parse_wpa2_ie23a(const u8* rsn_ie, int rsn_ie_len, 
int *group_cipher,
return ret;
 }
 
-int rtw_get_sec_ie23a(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len,
-  u8 *wpa_ie, u16 *wpa_len)
-{
-   u8 authmode, sec_idx, i;
-   uint cnt;
-
-
-   /* Search required WPA or WPA2 IE and copy to sec_ie[ ] */
-
-   cnt = (_TIMESTAMP_ + _BEACON_ITERVAL_ + _CAPABILITY_);
-
-   sec_idx = 0;
-
-   while(cnt < in_len) {
-   authmode = in_ie[cnt];
-
-   if ((authmode == WLAN_EID_VENDOR_SPECIFIC) &&
-   !memcmp(&in_ie[cnt+2], RTW_WPA_OUI23A_TYPE, 4)) {
-   RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
-("\n rtw_get_wpa_ie23a: sec_idx =%d "
- "in_ie[cnt+1]+2 =%d\n",
- sec_idx, in_ie[cnt + 1] + 2));
-
-   if (wpa_ie) {
-   memcpy(wpa_ie, &in_ie[cnt], in_ie[cnt+1]+2);
-
-   for (i = 0; i < (in_ie[cnt + 1] + 2); i = i + 
8) {
-   RT_TRACE(_module_rtl871x_mlme_c_,
-_drv_info_,
-("\n %2x,%2x,%2x,%2x,%2x,%2x,"
- "%2x,%2x\n", wpa_ie[i],
- wpa_ie[i + 1], wpa_ie[i + 2],
- wpa_ie[i + 3], wpa_ie[i + 4],
- wpa_ie[i + 5], wpa_ie[i + 6],
- wpa_ie[i + 7]));
-   }
-   }
-
-   *wpa_len = in_ie[cnt + 1] + 2;
-   cnt += in_ie[cnt + 1] + 2;  /* get next */
-   } else {
-   if (authmode == _WPA2_IE_ID_) {
-   RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
-("\n get_rsn_ie: sec_idx =%d in_ie"
- "[cnt+1]+2 =%d\n", sec_idx,
- in_ie[cnt + 1] + 2));
-
-   if (rsn_ie) {
-   memcpy(rsn_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
-
-   for (i = 0; i < (in_ie[cnt + 1] + 2); i = i + 
8) {
-   RT_TRACE(_module_rtl871x_mlme_c_,
-_drv_info_,
-("\n %2x,%2x,%2x,%2x,%2x,%2x,"
- "%2x,%2x\n", rsn_ie[i],
- rsn_ie[i + 1], rsn_ie[i + 2],
- rsn_ie[i + 3], rsn_ie[i + 4],
- rsn_ie[i + 5], rsn_ie[i + 6],
- rsn_ie[i + 7]));
-   }
-   }
-
-   *rsn_len = in_ie[cnt + 1] + 2;
-   cnt += in_ie[cnt + 1] + 2;  /* get next */
-   } else {
-   cnt += in_ie[cnt + 1] + 2;   /* get next */
-   }
-   }
-   }
-
-
-
-   return *rsn_len + *wpa_len;
-}
-
 /**
  * rtw_get_wps_attr23a - Search a specific WPS attribute from a given WPS IE
  * @wps_ie: Address of WPS IE to search
diff --git a/drivers/staging/rtl8723au/include/ieee80211.h 
b/drivers/staging/rtl8723au/include/ieee80211.h
index 6f42d2d..3738978 100644
--- a/drivers/staging/rtl8723au/include/ieee80211.h
+++ b/drivers/staging/rtl8723au/include/ieee80211.h
@@ -430,8 +430,6 @@ int rtw_get_wpa2_cipher_suite23a(const u8 *s);
 int rtw_parse_wpa_ie23a(const u8* wpa_ie, int wpa_ie_len, int *group_cipher, 
int *pairwise_cipher, int *is_8021x);
 int rtw_parse_wpa2_ie23a(const u8* wpa_ie, int wpa_ie_len, int *group_cipher, 
int *pairwise_cipher, int *is_8021x);
 
-int rtw_get_sec_ie23a(u8 *in_ie,uint in_len,u8 *rsn_ie,u16 *rsn_len,u8 
*wpa_ie,u16 *wpa_len);
-
 const u8 *rtw_get_wps_attr23a(const u8 *wps_ie, uint wps_ielen, u16 
target_attr_id ,u8 *buf_attr, u32 *len_attr);
 const u8 *rtw_get_wps_attr_content23a(const u8 *wps_ie, u

[PATCH 36/76] staging: rtl8723au: rtw_survey_event_cb23a(): Use the correct types for the received arguments

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 44a5249..639dfca 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -638,8 +638,9 @@ void rtw_survey_event_cb23a(struct rtw_adapter *adapter, 
const u8 *pbuf)
u32 len;
struct wlan_bssid_ex *pnetwork;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
+   struct survey_event *survey = (struct survey_event *)pbuf;
 
-   pnetwork = (struct wlan_bssid_ex *)pbuf;
+   pnetwork = &survey->bss;
 
RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,
 ("rtw_survey_event_cb23a, ssid=%s\n", pnetwork->Ssid.ssid));
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 12/76] staging: rtl8723au: OnAssocRsp23a(): Use cfg80211_* to parse IEs

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 66 +++
 1 file changed, 37 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index 1c22d1b..e32df75 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -1805,11 +1805,12 @@ OnAssocRsp23a(struct rtw_adapter *padapter, struct 
recv_frame *precv_frame)
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct sk_buff *skb = precv_frame->pkt;
struct ieee80211_mgmt *pmgmt = (struct ieee80211_mgmt *) skb->data;
-   int res, i;
+   int res;
unsigned short status;
-   u8 *p;
+   const u8 *p, *pie;
u8 *pframe = skb->data;
int pkt_len = skb->len;
+   int pielen;
 
DBG_8723A("%s\n", __func__);
 
@@ -1843,38 +1844,45 @@ OnAssocRsp23a(struct rtw_adapter *padapter, struct 
recv_frame *precv_frame)
/* AID */
res = pmlmeinfo->aid = le16_to_cpu(pmgmt->u.assoc_resp.aid) & 0x3fff;
 
-   /* following are moved to join event callback function */
-   /* to handle HT, WMM, rate adaptive, update MAC reg */
-   /* for not to handle the synchronous IO in the tasklet */
-   for (i = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable);
-i < pkt_len;) {
-   p = pframe + i;
-
-   switch (p[0])
-   {
-   case WLAN_EID_VENDOR_SPECIFIC:
-   if (!memcmp(p + 2, WMM_PARA_OUI23A, 6))/* WMM */
-   WMM_param_handler23a(padapter, p);
-   break;
-
-   case WLAN_EID_HT_CAPABILITY:/* HT caps */
-   HT_caps_handler23a(padapter, p);
+   pie = pframe + offsetof(struct ieee80211_mgmt, u.assoc_resp.variable);
+   pielen = pkt_len -
+   offsetof(struct ieee80211_mgmt, u.assoc_resp.variable);
+
+   p = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY,
+pmgmt->u.assoc_resp.variable, pielen);
+   if (p && p[1])
+   HT_caps_handler23a(padapter, p);
+
+   p = cfg80211_find_ie(WLAN_EID_HT_OPERATION,
+pmgmt->u.assoc_resp.variable, pielen);
+   if (p && p[1])
+   HT_info_handler23a(padapter, p);
+
+   p = cfg80211_find_ie(WLAN_EID_ERP_INFO,
+pmgmt->u.assoc_resp.variable, pielen);
+   if (p && p[1])
+   ERP_IE_handler23a(padapter, p);
+
+   pie = pframe + offsetof(struct ieee80211_mgmt, u.assoc_resp.variable);
+   while (true) {
+   p = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
+   WLAN_OUI_TYPE_MICROSOFT_WMM,
+   pie, pframe + pkt_len - pie);
+   if (!p)
break;
 
-   case WLAN_EID_HT_OPERATION: /* HT info */
-   HT_info_handler23a(padapter, p);
+   pie = p + p[1] + 2;
+   /* if this IE is too short, try the next */
+   if (p[1] <= 4)
+   continue;
+   /* if this IE is WMM params, we found what we wanted */
+   if (p[6] == 1)
break;
-
-   case WLAN_EID_ERP_INFO:
-   ERP_IE_handler23a(padapter, p);
-
-   default:
-   break;
-   }
-
-   i += (p[1] + 2);
}
 
+   if (p && p[1])
+   WMM_param_handler23a(padapter, p);
+
pmlmeinfo->state &= ~WIFI_FW_ASSOC_STATE;
pmlmeinfo->state |= WIFI_FW_ASSOC_SUCCESS;
 
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 14/76] staging: rtl8723au: Make struct ht_priv.ht_option a bool

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Match the return type of rtw_restructure_ht_ie23a() accordingly

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c| 4 ++--
 drivers/staging/rtl8723au/include/rtw_ht.h   | 2 +-
 drivers/staging/rtl8723au/include/rtw_mlme.h | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index a3174c0..d48b986 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -2189,8 +2189,8 @@ void rtw_joinbss_reset23a(struct rtw_adapter *padapter)
 }
 
 /* the fucntion is >= passive_level */
-unsigned int rtw_restructure_ht_ie23a(struct rtw_adapter *padapter, u8 *in_ie,
- u8 *out_ie, uint in_len, uint *pout_len)
+bool rtw_restructure_ht_ie23a(struct rtw_adapter *padapter, u8 *in_ie,
+ u8 *out_ie, uint in_len, uint *pout_len)
 {
u32 out_len;
int max_rx_ampdu_factor;
diff --git a/drivers/staging/rtl8723au/include/rtw_ht.h 
b/drivers/staging/rtl8723au/include/rtw_ht.h
index 86ce86b..f086376 100644
--- a/drivers/staging/rtl8723au/include/rtw_ht.h
+++ b/drivers/staging/rtl8723au/include/rtw_ht.h
@@ -21,7 +21,7 @@
 
 struct ht_priv
 {
-   u32 ht_option;
+   boolht_option;
u32 ampdu_enable;/* for enable Tx A-MPDU */
/* u8   baddbareq_issued[16]; */
u32 tx_amsdu_enable;/* for enable Tx A-MSDU */
diff --git a/drivers/staging/rtl8723au/include/rtw_mlme.h 
b/drivers/staging/rtl8723au/include/rtw_mlme.h
index 4d327ba..a11b5bd 100644
--- a/drivers/staging/rtl8723au/include/rtw_mlme.h
+++ b/drivers/staging/rtl8723au/include/rtw_mlme.h
@@ -356,8 +356,8 @@ __le16 *rtw_get_beacon_interval23a_from_ie(u8 *ie);
 
 void rtw_joinbss_reset23a(struct rtw_adapter *padapter);
 
-unsigned int rtw_restructure_ht_ie23a(struct rtw_adapter *padapter, u8 *in_ie,
-  u8 *out_ie, uint in_len, uint *pout_len);
+bool rtw_restructure_ht_ie23a(struct rtw_adapter *padapter, u8 *in_ie,
+ u8 *out_ie, uint in_len, uint *pout_len);
 void rtw_update_ht_cap23a(struct rtw_adapter *padapter,
   u8 *pie, uint ie_len);
 void rtw_issue_addbareq_cmd23a(struct rtw_adapter *padapter,
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 11/76] staging: rtl8723au: Make WMM_param_handler23a() and HT_caps_handler23a() take a const u8 *

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_wlan_util.c   | 4 ++--
 drivers/staging/rtl8723au/include/rtw_mlme_ext.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
index 043ba40..b9ca088 100644
--- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
@@ -504,7 +504,7 @@ void flush_all_cam_entry23a(struct rtw_adapter *padapter)
memset(pmlmeinfo->FW_sta_info, 0, sizeof(pmlmeinfo->FW_sta_info));
 }
 
-int WMM_param_handler23a(struct rtw_adapter *padapter, u8 *p)
+int WMM_param_handler23a(struct rtw_adapter *padapter, const u8 *p)
 {
/* struct registry_priv *pregpriv = &padapter->registrypriv; */
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -712,7 +712,7 @@ static void bwmode_update_check(struct rtw_adapter 
*padapter, const u8 *p)
}
 }
 
-void HT_caps_handler23a(struct rtw_adapter *padapter, u8 *p)
+void HT_caps_handler23a(struct rtw_adapter *padapter, const u8 *p)
 {
unsigned int i;
u8 rf_type;
diff --git a/drivers/staging/rtl8723au/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8723au/include/rtw_mlme_ext.h
index b8a108b..eb61012 100644
--- a/drivers/staging/rtl8723au/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723au/include/rtw_mlme_ext.h
@@ -510,10 +510,10 @@ bool is_IBSS_empty23a(struct rtw_adapter *padapter);
 
 unsigned char check_assoc_AP23a(u8 *pframe, uint len);
 
-int WMM_param_handler23a(struct rtw_adapter *padapter, u8 *p);
+int WMM_param_handler23a(struct rtw_adapter *padapter, const u8 *p);
 void WMMOnAssocRsp23a(struct rtw_adapter *padapter);
 
-void HT_caps_handler23a(struct rtw_adapter *padapter, u8 *p);
+void HT_caps_handler23a(struct rtw_adapter *padapter, const u8 *p);
 void HT_info_handler23a(struct rtw_adapter *padapter, const u8 *p);
 void HTOnAssocRsp23a(struct rtw_adapter *padapter);
 
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 02/76] staging: rtl8723au: rtw_mlme_ext.c: Convert rtw_get_wps_ie23a() to cfg80211_find_vendor_ie()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ieee80211.c | 15 +-
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c  | 40 +++---
 drivers/staging/rtl8723au/include/ieee80211.h  |  4 +--
 3 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
index f05d6e0..7ca2e11 100644
--- a/drivers/staging/rtl8723au/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
@@ -752,11 +752,11 @@ u8 *rtw_get_wps_ie23a(u8 *in_ie, uint in_len, uint 
*wps_ielen)
  *
  * Returns: the address of the specific WPS attribute found, or NULL
  */
-u8 *rtw_get_wps_attr23a(u8 *wps_ie, uint wps_ielen, u16 target_attr_id,
-u8 *buf_attr, u32 *len_attr)
+const u8 *rtw_get_wps_attr23a(const u8 *wps_ie, uint wps_ielen,
+ u16 target_attr_id, u8 *buf_attr, u32 *len_attr)
 {
-   u8 *attr_ptr = NULL;
-   u8 * target_attr_ptr = NULL;
+   const u8 *attr_ptr = NULL;
+   const u8 *target_attr_ptr = NULL;
u8 wps_oui[4] = {0x00, 0x50, 0xF2, 0x04};
 
if (len_attr)
@@ -808,10 +808,11 @@ u8 *rtw_get_wps_attr23a(u8 *wps_ie, uint wps_ielen, u16 
target_attr_id,
  *
  * Returns: the address of the specific WPS attribute content found, or NULL
  */
-u8 *rtw_get_wps_attr_content23a(u8 *wps_ie, uint wps_ielen, u16 target_attr_id,
-   u8 *buf_content, uint *len_content)
+const u8 *rtw_get_wps_attr_content23a(const u8 *wps_ie, uint wps_ielen,
+ u16 target_attr_id, u8 *buf_content,
+ uint *len_content)
 {
-   u8 *attr_ptr;
+   const u8 *attr_ptr;
u32 attr_len;
 
if (len_content)
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index 9b401fb..1c22d1b 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -2497,8 +2497,7 @@ void issue_beacon23a(struct rtw_adapter *padapter, int 
timeout_ms)
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct wlan_bssid_ex *cur_network = &pmlmeinfo->network;
u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-   u8 *wps_ie;
-   u32 wps_ielen;
+   const u8 *wps_ie;
u8 sr = 0;
int len_diff;
 
@@ -2535,6 +2534,8 @@ void issue_beacon23a(struct rtw_adapter *padapter, int 
timeout_ms)
pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr);
 
if ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) {
+   u8 *iebuf;
+   int buflen;
/* DBG_8723A("ie len =%d\n", cur_network->IELength); */
memcpy(pframe, cur_network->IEs, cur_network->IELength);
len_diff = update_hidden_ssid(pframe + _BEACON_IE_OFFSET_,
@@ -2544,13 +2545,17 @@ void issue_beacon23a(struct rtw_adapter *padapter, int 
timeout_ms)
pframe += (cur_network->IELength+len_diff);
pattrib->pktlen += (cur_network->IELength+len_diff);
 
-   wps_ie = rtw_get_wps_ie23a(pmgntframe->buf_addr + TXDESC_OFFSET+
-  sizeof (struct ieee80211_hdr_3addr) +
-  _BEACON_IE_OFFSET_, pattrib->pktlen -
-  sizeof (struct ieee80211_hdr_3addr) -
-  _BEACON_IE_OFFSET_, &wps_ielen);
-   if (wps_ie && wps_ielen > 0) {
-   rtw_get_wps_attr_content23a(wps_ie, wps_ielen,
+   iebuf = pmgntframe->buf_addr + TXDESC_OFFSET +
+   sizeof (struct ieee80211_hdr_3addr) +
+   _BEACON_IE_OFFSET_;
+   buflen = pattrib->pktlen - sizeof (struct ieee80211_hdr_3addr) -
+   _BEACON_IE_OFFSET_;
+   wps_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
+WLAN_OUI_TYPE_MICROSOFT_WPS,
+iebuf, buflen);
+
+   if (wps_ie && wps_ie[1] > 0) {
+   rtw_get_wps_attr_content23a(wps_ie, wps_ie[1],
WPS_ATTR_SELECTED_REGISTRAR,
(u8*)&sr, NULL);
}
@@ -2656,7 +2661,7 @@ static void issue_probersp(struct rtw_adapter *padapter, 
unsigned char *da,
unsigned char *mac, *bssid;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
 #ifdef CONFIG_8723AU_AP_MODE
-   u8 *pwps_ie;
+   const u8 *pwps_ie;
uint wps_ielen;
u8 *ssid_ie;
int ssid_ielen;
@@ -2710,16 +2715,19 @@ static void issue_probersp(struct rtw_adapter 
*padapter, unsigned char *da,
 
 #ifdef CONFIG_8723AU_AP_MODE
if ((pmlmeinfo

[PATCH 04/76] staging: rtl8723au: ioctl_cfg80211.c: Convert rtw_get_wps_ie23a() to cfg80211_find_vendor_ie()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Given that the IE len is stored in a u8, there is no point having a
512 buffer to store it, nor check if the size exceeds this size.

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/include/ieee80211.h |  2 +-
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 48 +++
 2 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/rtl8723au/include/ieee80211.h 
b/drivers/staging/rtl8723au/include/ieee80211.h
index 426decb..432d255 100644
--- a/drivers/staging/rtl8723au/include/ieee80211.h
+++ b/drivers/staging/rtl8723au/include/ieee80211.h
@@ -317,7 +317,7 @@ struct ieee80211_snap_hdr {
 #define MAX_CHANNEL_NUMBER 161
 
 #define MAX_WPA_IE_LEN 256
-#define MAX_WPS_IE_LEN 512
+#define MAX_WPS_IE_LEN 256
 #define MAX_P2P_IE_LEN 256
 #define MAX_WFD_IE_LEN 128
 
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 4c5b1e1..7d5e2bd 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -1479,16 +1479,17 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct 
rtw_adapter *padapter,
   char *buf, int len)
 {
int ret = 0;
-   uint wps_ielen = 0;
-   u8 *wps_ie;
+   const u8 *wps_ie;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 
DBG_8723A("%s, ielen =%d\n", __func__, len);
 
if (len > 0) {
-   wps_ie = rtw_get_wps_ie23a(buf, len, &wps_ielen);
+   wps_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
+WLAN_OUI_TYPE_MICROSOFT_WPS,
+buf, len);
if (wps_ie) {
-   DBG_8723A("probe_req_wps_ielen =%d\n", wps_ielen);
+   DBG_8723A("probe_req_wps_ielen =%d\n", wps_ie[1]);
 
if (pmlmepriv->wps_probe_req_ie) {
pmlmepriv->wps_probe_req_ie_len = 0;
@@ -1496,15 +1497,14 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct 
rtw_adapter *padapter,
pmlmepriv->wps_probe_req_ie = NULL;
}
 
-   pmlmepriv->wps_probe_req_ie = kmemdup(wps_ie,
- wps_ielen,
+   pmlmepriv->wps_probe_req_ie = kmemdup(wps_ie, wps_ie[1],
  GFP_KERNEL);
if (pmlmepriv->wps_probe_req_ie == NULL) {
DBG_8723A("%s()-%d: kmalloc() ERROR!\n",
  __func__, __LINE__);
return -EINVAL;
}
-   pmlmepriv->wps_probe_req_ie_len = wps_ielen;
+   pmlmepriv->wps_probe_req_ie_len = wps_ie[1];
}
}
 
@@ -1751,6 +1751,7 @@ static int rtw_cfg80211_set_key_mgt(struct security_priv 
*psecuritypriv,
 static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter *padapter, const u8 *pie,
   size_t ielen)
 {
+   const u8 *wps_ie;
u8 *buf = NULL;
int group_cipher = 0, pairwise_cipher = 0;
int ret = 0;
@@ -1882,22 +1883,17 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter 
*padapter, const u8 *pie,
break;
}
 
-   {   /* handle wps_ie */
-   uint wps_ielen;
-   u8 *wps_ie;
-
-   wps_ie = rtw_get_wps_ie23a(buf, ielen, &wps_ielen);
-   if (wps_ie && wps_ielen > 0) {
-   DBG_8723A("got wps_ie, wps_ielen:%u\n", wps_ielen);
-   padapter->securitypriv.wps_ie_len =
-   wps_ielen <
-   MAX_WPS_IE_LEN ? wps_ielen : MAX_WPS_IE_LEN;
-   memcpy(padapter->securitypriv.wps_ie, wps_ie,
-  padapter->securitypriv.wps_ie_len);
-   set_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS);
-   } else {
-   _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS);
-   }
+   wps_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
+WLAN_OUI_TYPE_MICROSOFT_WPS,
+buf, ielen);
+   if (wps_ie && wps_ie[1] > 0) {
+   DBG_8723A("got wps_ie, wps_ielen:%u\n", wps_ie[1]);
+   padapter->securitypriv.wps_ie_len = wps_ie[1];
+   memcpy(padapter->securitypriv.wps_ie, wps_ie,
+  padapter->securitypriv.wps_ie_len);
+   set_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS);
+   } else {
+   _clr_fwstate_(&padapter->mlmepriv, WIF

[PATCH 37/76] staging: rtl8723au: Do not embed struct wlan_bssid_ex in struct survey_event

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Instead allocate it separately and reference it from survey_event.
This will allow for us to pass it on later without having to copy it.

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c | 5 -
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 9 +++--
 drivers/staging/rtl8723au/include/rtw_event.h | 2 +-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 639dfca..71ff753 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -640,7 +640,7 @@ void rtw_survey_event_cb23a(struct rtw_adapter *adapter, 
const u8 *pbuf)
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
struct survey_event *survey = (struct survey_event *)pbuf;
 
-   pnetwork = &survey->bss;
+   pnetwork = survey->bss;
 
RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,
 ("rtw_survey_event_cb23a, ssid=%s\n", pnetwork->Ssid.ssid));
@@ -691,6 +691,9 @@ exit:
 
spin_unlock_bh(&pmlmepriv->lock);
 
+   kfree(survey->bss);
+   survey->bss = NULL;
+
return;
 }
 
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index 693a1a4..9b6d918 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -4898,14 +4898,19 @@ void report_survey_event23a(struct rtw_adapter 
*padapter,
pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
 
psurvey_evt = (struct survey_event*)(pevtcmd + sizeof(struct 
C2HEvent_Header));
+   psurvey_evt->bss = kzalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC);
+   if (!psurvey_evt->bss) {
+   kfree(pcmd_obj);
+   kfree(pevtcmd);
+   }
 
-   if (collect_bss_info23a(padapter, precv_frame, &psurvey_evt->bss) == 
_FAIL) {
+   if (collect_bss_info23a(padapter, precv_frame, psurvey_evt->bss) == 
_FAIL) {
kfree(pcmd_obj);
kfree(pevtcmd);
return;
}
 
-   process_80211d(padapter, &psurvey_evt->bss);
+   process_80211d(padapter, psurvey_evt->bss);
 
rtw_enqueue_cmd23a(pcmdpriv, pcmd_obj);
 
diff --git a/drivers/staging/rtl8723au/include/rtw_event.h 
b/drivers/staging/rtl8723au/include/rtw_event.h
index 807cc83..4557aec 100644
--- a/drivers/staging/rtl8723au/include/rtw_event.h
+++ b/drivers/staging/rtl8723au/include/rtw_event.h
@@ -22,7 +22,7 @@
 Used to report a bss has been scanned
 */
 struct survey_event {
-   struct wlan_bssid_ex bss;
+   struct wlan_bssid_ex *bss;
 };
 
 /*
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 23/76] staging: rtl8723au: issue_action_BSSCoexistPacket(): Use struct ieee80211_mgmt

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

This gets rid of the rtw_set_fixed_ie23a() usage here. Note that this
abuses ieee80211_mgmt.u.action.u.chan_switch for now, since the
correct defines are currently missing, and this one matches.

Need to fix up the definitions in ieee80211.h and afterwards fix it up
here.

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 35 ++-
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index b397029..eedac9a 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -4177,11 +4177,10 @@ out:
 static void issue_action_BSSCoexistPacket(struct rtw_adapter *padapter)
 {
struct list_head *plist, *phead, *ptmp;
-   unsigned char category, action;
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
u8 *pframe;
-   struct ieee80211_hdr *pwlanhdr;
+   struct ieee80211_mgmt *mgmt;
struct wlan_network *pnetwork;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -4201,9 +4200,6 @@ static void issue_action_BSSCoexistPacket(struct 
rtw_adapter *padapter)
 
DBG_8723A("%s\n", __func__);
 
-   category = WLAN_CATEGORY_PUBLIC;
-   action = ACT_PUBLIC_BSSCOEXIST;
-
pmgntframe = alloc_mgtxmitframe23a(pxmitpriv);
if (!pmgntframe)
return;
@@ -4215,24 +4211,29 @@ static void issue_action_BSSCoexistPacket(struct 
rtw_adapter *padapter)
memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
 
pframe = (u8 *)pmgntframe->buf_addr + TXDESC_OFFSET;
-   pwlanhdr = (struct ieee80211_hdr *)pframe;
+   mgmt = (struct ieee80211_mgmt *)pframe;
 
-   pwlanhdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
- IEEE80211_STYPE_ACTION);
+   mgmt->frame_control =
+   cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION);
 
-   ether_addr_copy(pwlanhdr->addr1, get_my_bssid23a(&pmlmeinfo->network));
-   ether_addr_copy(pwlanhdr->addr2, myid(&padapter->eeprompriv));
-   ether_addr_copy(pwlanhdr->addr3, get_my_bssid23a(&pmlmeinfo->network));
+   ether_addr_copy(mgmt->da, get_my_bssid23a(&pmlmeinfo->network));
+   ether_addr_copy(mgmt->sa, myid(&padapter->eeprompriv));
+   ether_addr_copy(mgmt->bssid, get_my_bssid23a(&pmlmeinfo->network));
 
-   pwlanhdr->seq_ctrl =
-   cpu_to_le16(IEEE80211_SN_TO_SEQ(pmlmeext->mgnt_seq));
+   mgmt->seq_ctrl = cpu_to_le16(IEEE80211_SN_TO_SEQ(pmlmeext->mgnt_seq));
pmlmeext->mgnt_seq++;
 
-   pframe += sizeof(struct ieee80211_hdr_3addr);
-   pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr);
+   mgmt->u.action.category = WLAN_CATEGORY_PUBLIC;
+   /*
+* This is cheating, but as there is currently no coexist_action
+* defined in struct struct ieee80211_mgmt, abuse chan_switch
+* for now, since it matches.
+*/
+   mgmt->u.action.u.chan_switch.action_code = ACT_PUBLIC_BSSCOEXIST;
 
-   pframe = rtw_set_fixed_ie23a(pframe, 1, &category, &pattrib->pktlen);
-   pframe = rtw_set_fixed_ie23a(pframe, 1, &action, &pattrib->pktlen);
+   pframe = mgmt->u.action.u.chan_switch.variable;
+   pattrib->pktlen = offsetof(struct ieee80211_mgmt,
+  u.action.u.chan_switch.variable);
 
if (pmlmepriv->num_FortyMHzIntolerant > 0) {
u8 iedata = BIT(2);/* 20 MHz BSS Width Request */
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 27/76] staging: rtl8723au: issue_action_BA23a(): Use struct ieee80211_mgmt to build action frames

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 149 +-
 1 file changed, 74 insertions(+), 75 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index 80a822c..ff0800e 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -3892,17 +3892,15 @@ void issue_action_BA23a(struct rtw_adapter *padapter,
const unsigned char *raddr,
unsigned char action, unsigned short status)
 {
-   u8 category = WLAN_CATEGORY_BACK;
u16 start_seq;
u16 BA_para_set;
-   u16 reason_code;
u16 BA_timeout_value;
u16 BA_starting_seqctrl;
+   u16 BA_para;
int max_rx_ampdu_factor;
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
-   u8 *pframe;
-   struct ieee80211_hdr *pwlanhdr;
+   struct ieee80211_mgmt *mgmt;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
@@ -3911,8 +3909,7 @@ void issue_action_BA23a(struct rtw_adapter *padapter,
struct registry_priv *pregpriv = &padapter->registrypriv;
u8 tendaAPMac[] = {0xC8, 0x3A, 0x35};
 
-   DBG_8723A("%s, category =%d, action =%d, status =%d\n",
- __func__, category, action, status);
+   DBG_8723A("%s, action =%d, status =%d\n", __func__, action, status);
 
pmgntframe = alloc_mgtxmitframe23a(pxmitpriv);
if (!pmgntframe)
@@ -3924,40 +3921,36 @@ void issue_action_BA23a(struct rtw_adapter *padapter,
 
memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
 
-   pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-   pwlanhdr = (struct ieee80211_hdr *)pframe;
+   mgmt = (struct ieee80211_mgmt *)(pmgntframe->buf_addr + TXDESC_OFFSET);
 
-   pwlanhdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
- IEEE80211_STYPE_ACTION);
+   mgmt->frame_control =
+   cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION);
 
-   /* memcpy(pwlanhdr->addr1, get_my_bssid23a(&pmlmeinfo->network), 
ETH_ALEN); */
-   ether_addr_copy(pwlanhdr->addr1, raddr);
-   ether_addr_copy(pwlanhdr->addr2, myid(&padapter->eeprompriv));
-   ether_addr_copy(pwlanhdr->addr3, get_my_bssid23a(&pmlmeinfo->network));
+   ether_addr_copy(mgmt->da, raddr);
+   ether_addr_copy(mgmt->sa, myid(&padapter->eeprompriv));
+   ether_addr_copy(mgmt->bssid, get_my_bssid23a(&pmlmeinfo->network));
 
-   pwlanhdr->seq_ctrl =
-   cpu_to_le16(IEEE80211_SN_TO_SEQ(pmlmeext->mgnt_seq));
+   mgmt->seq_ctrl = cpu_to_le16(IEEE80211_SN_TO_SEQ(pmlmeext->mgnt_seq));
pmlmeext->mgnt_seq++;
 
-   pframe += sizeof(struct ieee80211_hdr_3addr);
-   pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr);
+   mgmt->u.action.category = WLAN_CATEGORY_BACK;
 
-   pframe = rtw_set_fixed_ie23a(pframe, 1, &category, &pattrib->pktlen);
-   pframe = rtw_set_fixed_ie23a(pframe, 1, &action, &pattrib->pktlen);
+   pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr) + 1;
 
status = cpu_to_le16(status);
 
-   if (category != 3)
-   goto out;
+   switch (action) {
+   case WLAN_ACTION_ADDBA_REQ:
+   pattrib->pktlen += sizeof(mgmt->u.action.u.addba_req);
+
+   mgmt->u.action.u.addba_req.action_code = action;
 
-   switch (action)
-   {
-   case 0: /* ADDBA req */
do {
pmlmeinfo->dialogToken++;
} while (pmlmeinfo->dialogToken == 0);
-   pframe = rtw_set_fixed_ie23a(pframe, 1, &pmlmeinfo->dialogToken,
-&pattrib->pktlen);
+
+   mgmt->u.action.u.addba_req.dialog_token =
+   pmlmeinfo->dialogToken;
 
if (rtl8723a_BT_coexist(padapter) &&
rtl8723a_BT_using_antenna_1(padapter) &&
@@ -3978,51 +3971,60 @@ void issue_action_BA23a(struct rtw_adapter *padapter,
/* immediate ack & 64 buffer size */
BA_para_set = (0x1002 | ((status & 0xf) << 2));
}
-   BA_para_set = cpu_to_le16(BA_para_set);
-   pframe = rtw_set_fixed_ie23a(pframe, 2,
-(unsigned char *)&BA_para_set,
-&pattrib->pktlen);
+
+   put_unaligned_le16(BA_para_set,
+  &mgmt->u.action.u.addba_req.capab);
 
BA_timeout_value = 5000;/*  5ms */
BA_timeout_value = cpu_to_le16(BA_timeout_value);
-   pframe = rtw_set_fixed_ie23a(pframe, 2,

[PATCH 08/76] staging: rtl8723au: rtw_wlan_util.c: Use cfg80211_* to determine crypto

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_wlan_util.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
index 82904d0..043ba40 100644
--- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
@@ -887,7 +887,6 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
struct ieee80211_ht_operation *pht_info;
struct wlan_bssid_ex *bssid;
unsigned short val16;
-   u16 wpa_len = 0, rsn_len = 0;
u8 encryp_protocol;
int group_cipher = 0, pairwise_cipher = 0, is_8021x = 0, r;
u32 bcn_channel;
@@ -1009,14 +1008,14 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
goto _mismatch;
}
 
-   rtw_get_sec_ie23a(bssid->IEs, bssid->IELength, NULL, &rsn_len, NULL,
- &wpa_len);
-
-   if (rsn_len > 0)
+   p = cfg80211_find_ie(WLAN_EID_RSN, pie, pie_len);
+   if (p && p[1]) {
encryp_protocol = ENCRYP_PROTOCOL_WPA2;
-   else if (wpa_len > 0)
+   } else if (cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
+  WLAN_OUI_TYPE_MICROSOFT_WPA,
+  pie, pie_len)) {
encryp_protocol = ENCRYP_PROTOCOL_WPA;
-   else {
+   } else {
if (bssid->Privacy)
encryp_protocol = ENCRYP_PROTOCOL_WEP;
else
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 19/76] staging: rtl8723au: Request correct firmware file for A-cut parts

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

The filename requested by the driver didn't match what we had sitting
in /lib/firmware/

Reported-by: Ben Hutchings 
Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c 
b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
index 0acacab..46f5abc 100644
--- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
+++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
@@ -298,7 +298,7 @@ int rtl8723a_FirmwareDownload(struct rtw_adapter *padapter)
RT_TRACE(_module_hal_init_c_, _drv_info_, ("+%s\n", __func__));
 
if (IS_8723A_A_CUT(pHalData->VersionID)) {
-   fw_name = "rtlwifi/rtl8723aufw.bin";
+   fw_name = "rtlwifi/rtl8723aufw_A.bin";
RT_TRACE(_module_hal_init_c_, _drv_info_,
 ("rtl8723a_FirmwareDownload: R8723FwImageArray_UMC "
  "for RTL8723A A CUT\n"));
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 42/76] staging: rtl8723au: OnAuth23a(): Use ether_addr_copy()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index 14193b4..bed7eb7 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -1087,7 +1087,7 @@ auth_fail:
pstat = &stat;
memset((char *)pstat, '\0', sizeof(stat));
pstat->auth_seq = 2;
-   memcpy(pstat->hwaddr, sa, 6);
+   ether_addr_copy(pstat->hwaddr, sa);
 
issue_auth(padapter, pstat, (unsigned short)status);
 
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 25/76] staging: rtl8723au: Let cfg80211 handle public action management frames

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

The driver shouldn't be dealing with public action management frames.
Let these go directly to the cfg80211 layer which can defer them to
userland if needed.

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ieee80211.c |  26 
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c  | 132 +++--
 drivers/staging/rtl8723au/include/ieee80211.h  |  23 +---
 drivers/staging/rtl8723au/include/ioctl_cfg80211.h |   3 -
 drivers/staging/rtl8723au/include/wifi.h   |   1 -
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c  |  43 +--
 6 files changed, 18 insertions(+), 210 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
index fa3ca9e..9f6dd77 100644
--- a/drivers/staging/rtl8723au/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
@@ -894,29 +894,3 @@ u16 rtw_mcs_rate23a(u8 rf_type, u8 bw_40MHz, u8 
short_GI_20, u8 short_GI_40,
}
return max_rate;
 }
-
-static const char *_action_public_str23a[] = {
-   "ACT_PUB_BSSCOEXIST",
-   "ACT_PUB_DSE_ENABLE",
-   "ACT_PUB_DSE_DEENABLE",
-   "ACT_PUB_DSE_REG_LOCATION",
-   "ACT_PUB_EXT_CHL_SWITCH",
-   "ACT_PUB_DSE_MSR_REQ",
-   "ACT_PUB_DSE_MSR_RPRT",
-   "ACT_PUB_MP",
-   "ACT_PUB_DSE_PWR_CONSTRAINT",
-   "ACT_PUB_VENDOR",
-   "ACT_PUB_GAS_INITIAL_REQ",
-   "ACT_PUB_GAS_INITIAL_RSP",
-   "ACT_PUB_GAS_COMEBACK_REQ",
-   "ACT_PUB_GAS_COMEBACK_RSP",
-   "ACT_PUB_TDLS_DISCOVERY_RSP",
-   "ACT_PUB_LOCATION_TRACK",
-   "ACT_PUB_RSVD",
-};
-
-const char *action_public_str23a(u8 action)
-{
-   action = (action >= ACT_PUBLIC_MAX) ? ACT_PUBLIC_MAX : action;
-   return _action_public_str23a[action];
-}
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index 051ea49..80a822c 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -2135,136 +2135,32 @@ static int OnAction23a_back23a(struct rtw_adapter 
*padapter,
return _SUCCESS;
 }
 
-static int rtw_action_public_decache(struct recv_frame *recv_frame, s32 token)
-{
-   struct rtw_adapter *adapter = recv_frame->adapter;
-   struct mlme_ext_priv *mlmeext = &adapter->mlmeextpriv;
-   struct sk_buff *skb = recv_frame->pkt;
-   struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
-   u16 seq_ctrl;
-
-   seq_ctrl = ((recv_frame->attrib.seq_num&0x) << 4) |
-   (recv_frame->attrib.frag_num & 0xf);
-
-   if (ieee80211_has_retry(hdr->frame_control)) {
-   if (token >= 0) {
-   if ((seq_ctrl == mlmeext->action_public_rxseq) &&
-   (token == mlmeext->action_public_dialog_token)) {
-   DBG_8723A("%s(%s): seq_ctrl = 0x%x, "
- "rxseq = 0x%x, token:%d\n", __func__,
- adapter->pnetdev->name, seq_ctrl,
- mlmeext->action_public_rxseq, token);
-   return _FAIL;
-   }
-   } else {
-   if (seq_ctrl == mlmeext->action_public_rxseq) {
-   DBG_8723A("%s(%s): seq_ctrl = 0x%x, "
- "rxseq = 0x%x\n", __func__,
- adapter->pnetdev->name, seq_ctrl,
- mlmeext->action_public_rxseq);
-   return _FAIL;
-   }
-   }
-   }
-
-   mlmeext->action_public_rxseq = seq_ctrl;
-
-   if (token >= 0)
-   mlmeext->action_public_dialog_token = token;
-
-   return _SUCCESS;
-}
-
-static int on_action_public23a_p2p(struct recv_frame *precv_frame)
-{
-   struct sk_buff *skb = precv_frame->pkt;
-   u8 *pframe = skb->data;
-   u8 *frame_body;
-   u8 dialogToken = 0;
-
-   frame_body = (unsigned char *)
-   (pframe + sizeof(struct ieee80211_hdr_3addr));
-
-   dialogToken = frame_body[7];
-
-   if (rtw_action_public_decache(precv_frame, dialogToken) == _FAIL)
-   return _FAIL;
-
-   return _SUCCESS;
-}
-
-static int on_action_public23a_vendor(struct recv_frame *precv_frame)
-{
-   unsigned int ret = _FAIL;
-   struct sk_buff *skb = precv_frame->pkt;
-   u8 *pframe = skb->data;
-   u8 *frame_body = pframe + sizeof(struct ieee80211_hdr_3addr);
-
-   if (!memcmp(frame_body + 2, P2P_OUI23A, 4)) {
-   ret = on_action_public23a_p2p(precv_frame);
-   }
-
-   return ret;
-}
-
-static unsigned int
-on_action_public23a_default(struct recv_frame *precv_frame, u8 action)
-{
-   unsigned int ret = _FAIL;
-   struct sk_buff *skb = precv_frame->pkt;
-   u8

[PATCH 24/76] staging: rtl8723au: Do not xmit BSS Coexistence management action frames

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

The driver should not be issuing BSS Coexistence management action
frames when scanning. This isn't required by the spec, and if needed,
these should come from wpa_s instead.

Recommended by Johannes Berg.

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 138 --
 1 file changed, 138 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index eedac9a..051ea49 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -4174,140 +4174,6 @@ out:
dump_mgntframe23a(padapter, pmgntframe);
 }
 
-static void issue_action_BSSCoexistPacket(struct rtw_adapter *padapter)
-{
-   struct list_head *plist, *phead, *ptmp;
-   struct xmit_frame *pmgntframe;
-   struct pkt_attrib *pattrib;
-   u8 *pframe;
-   struct ieee80211_mgmt *mgmt;
-   struct wlan_network *pnetwork;
-   struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
-   struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-   struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-   struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
-   struct rtw_queue *queue = &pmlmepriv->scanned_queue;
-   u8 InfoContent[16] = {0};
-   u8 ICS[8][15];
-   int i;
-
-   if (pmlmepriv->num_FortyMHzIntolerant == 0 ||
-   pmlmepriv->num_sta_no_ht == 0)
-   return;
-
-   if (pmlmeinfo->bwmode_updated)
-   return;
-
-   DBG_8723A("%s\n", __func__);
-
-   pmgntframe = alloc_mgtxmitframe23a(pxmitpriv);
-   if (!pmgntframe)
-   return;
-
-   /* update attribute */
-   pattrib = &pmgntframe->attrib;
-   update_mgntframe_attrib23a(padapter, pattrib);
-
-   memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
-
-   pframe = (u8 *)pmgntframe->buf_addr + TXDESC_OFFSET;
-   mgmt = (struct ieee80211_mgmt *)pframe;
-
-   mgmt->frame_control =
-   cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION);
-
-   ether_addr_copy(mgmt->da, get_my_bssid23a(&pmlmeinfo->network));
-   ether_addr_copy(mgmt->sa, myid(&padapter->eeprompriv));
-   ether_addr_copy(mgmt->bssid, get_my_bssid23a(&pmlmeinfo->network));
-
-   mgmt->seq_ctrl = cpu_to_le16(IEEE80211_SN_TO_SEQ(pmlmeext->mgnt_seq));
-   pmlmeext->mgnt_seq++;
-
-   mgmt->u.action.category = WLAN_CATEGORY_PUBLIC;
-   /*
-* This is cheating, but as there is currently no coexist_action
-* defined in struct struct ieee80211_mgmt, abuse chan_switch
-* for now, since it matches.
-*/
-   mgmt->u.action.u.chan_switch.action_code = ACT_PUBLIC_BSSCOEXIST;
-
-   pframe = mgmt->u.action.u.chan_switch.variable;
-   pattrib->pktlen = offsetof(struct ieee80211_mgmt,
-  u.action.u.chan_switch.variable);
-
-   if (pmlmepriv->num_FortyMHzIntolerant > 0) {
-   u8 iedata = BIT(2);/* 20 MHz BSS Width Request */
-
-   pframe = rtw_set_ie23a(pframe, WLAN_EID_BSS_COEX_2040, 1,
-  &iedata, &pattrib->pktlen);
-   }
-
-   if (pmlmepriv->num_sta_no_ht <= 0)
-   goto out;
-
-   memset(ICS, 0, sizeof(ICS));
-
-   spin_lock_bh(&pmlmepriv->scanned_queue.lock);
-
-   phead = get_list_head(queue);
-   plist = phead->next;
-
-   list_for_each_safe(plist, ptmp, phead) {
-   const u8 *p;
-   struct wlan_bssid_ex *pbss_network;
-
-   pnetwork = container_of(plist, struct wlan_network, list);
-
-   pbss_network = &pnetwork->network;
-
-   p = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY,
-pbss_network->IEs + _FIXED_IE_LENGTH_,
-pbss_network->IELength -_FIXED_IE_LENGTH_);
-   if (!p || !p[1]) { /* non-HT */
-   if (pbss_network->DSConfig <= 0 ||
-   pbss_network->DSConfig > 14)
-   continue;
-
-   ICS[0][pbss_network->DSConfig] = 1;
-
-   if (ICS[0][0] == 0)
-   ICS[0][0] = 1;
-   }
-
-   }
-
-   spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
-
-   for (i = 0; i < 8;i++) {
-   if (ICS[i][0] == 1) {
-   int j, k = 0;
-
-   InfoContent[k] = i;
-   /* SET_BSS_INTOLERANT_ELE_REG_CLASS(InfoContent, i); */
-   k++;
-
-   for (j = 1; j <= 14; j++) {
-   if (ICS[i][j] == 1) {
-   if (k < 16) {
-   /* channel number */
-   InfoContent[k] = j;
-  

[PATCH 43/76] staging: rtl8723au: Get rid of IW_ESSID_MAX_SIZE

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 3 ++-
 drivers/staging/rtl8723au/include/ieee80211.h | 2 --
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index bed7eb7..59047ad 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -5945,7 +5945,8 @@ int sitesurvey_cmd_hdl23a(struct rtw_adapter *padapter, 
const u8 *pbuf)
for (i = 0; i < RTW_SSID_SCAN_AMOUNT; i++) {
if (pparm->ssid[i].ssid_len) {
memcpy(pmlmeext->sitesurvey_res.ssid[i].ssid,
-  pparm->ssid[i].ssid, IW_ESSID_MAX_SIZE);
+  pparm->ssid[i].ssid,
+  IEEE80211_MAX_SSID_LEN);
pmlmeext->sitesurvey_res.ssid[i].ssid_len =
pparm->ssid[i].ssid_len;
} else {
diff --git a/drivers/staging/rtl8723au/include/ieee80211.h 
b/drivers/staging/rtl8723au/include/ieee80211.h
index c2c57c7..43f002d 100644
--- a/drivers/staging/rtl8723au/include/ieee80211.h
+++ b/drivers/staging/rtl8723au/include/ieee80211.h
@@ -309,8 +309,6 @@ struct ieee80211_snap_hdr {
 #define MAX_P2P_IE_LEN 256
 #define MAX_WFD_IE_LEN 128
 
-#define IW_ESSID_MAX_SIZE  32
-
 /*
 join_res:
 -1: authentication fail
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 218933a..d4eb2a9 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -2020,7 +2020,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
goto exit;
}
 
-   if (sme->ssid_len > IW_ESSID_MAX_SIZE) {
+   if (sme->ssid_len > IEEE80211_MAX_SSID_LEN) {
ret = -E2BIG;
goto exit;
}
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 22/76] staging: rtl8723au: issue_action_spct_ch_switch23a(): Use struct ieee80211_mgmt

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 32 +++
 1 file changed, 13 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index d109256..b397029 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -3946,10 +3946,9 @@ void issue_action_spct_ch_switch23a(struct rtw_adapter 
*padapter,
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
unsigned char *pframe;
-   struct ieee80211_hdr *pwlanhdr;
+   struct ieee80211_mgmt *mgmt;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-   u8 category, action;
 
DBG_8723A("%s(%s): ra ="MAC_FMT", ch:%u, offset:%u\n", __func__,
  padapter->pnetdev->name, MAC_ARG(ra), new_ch, ch_offset);
@@ -3964,29 +3963,24 @@ void issue_action_spct_ch_switch23a(struct rtw_adapter 
*padapter,
 
memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
 
-   pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-   pwlanhdr = (struct ieee80211_hdr *)pframe;
+   mgmt = (struct ieee80211_mgmt *)(pmgntframe->buf_addr + TXDESC_OFFSET);
 
-   pwlanhdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
- IEEE80211_STYPE_ACTION);
+   mgmt->frame_control =
+   cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION);
 
-   ether_addr_copy(pwlanhdr->addr1, ra); /* RA */
-   ether_addr_copy(pwlanhdr->addr2, myid(&padapter->eeprompriv)); /* TA */
-   ether_addr_copy(pwlanhdr->addr3, ra); /* DA = RA */
+   ether_addr_copy(mgmt->da, ra); /* RA */
+   ether_addr_copy(mgmt->sa, myid(&padapter->eeprompriv)); /* TA */
+   ether_addr_copy(mgmt->bssid, ra); /* DA = RA */
 
-   pwlanhdr->seq_ctrl =
-   cpu_to_le16(IEEE80211_SN_TO_SEQ(pmlmeext->mgnt_seq));
+   mgmt->seq_ctrl = cpu_to_le16(IEEE80211_SN_TO_SEQ(pmlmeext->mgnt_seq));
pmlmeext->mgnt_seq++;
 
-   pframe += sizeof(struct ieee80211_hdr_3addr);
-   pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr);
-
-   /* category, action */
-   category = WLAN_CATEGORY_SPECTRUM_MGMT;
-   action = WLAN_ACTION_SPCT_CHL_SWITCH;
+   mgmt->u.action.category = WLAN_CATEGORY_SPECTRUM_MGMT;
+   mgmt->u.action.u.chan_switch.action_code = WLAN_ACTION_SPCT_CHL_SWITCH;
 
-   pframe = rtw_set_fixed_ie23a(pframe, 1, &category, &pattrib->pktlen);
-   pframe = rtw_set_fixed_ie23a(pframe, 1, &action, &pattrib->pktlen);
+   pframe = mgmt->u.action.u.chan_switch.variable;
+   pattrib->pktlen = offsetof(struct ieee80211_mgmt,
+  u.action.u.chan_switch.variable);
 
pframe = rtw_set_ie23a_ch_switch (pframe, &pattrib->pktlen, 0,
  new_ch, 0);
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 39/76] staging: rtl8723au: collect_bss_info(): Don't memset() what we just kzalloc()'d

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index 02180fc..14193b4 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -4335,8 +4335,6 @@ static struct wlan_bssid_ex *collect_bss_info(struct 
rtw_adapter *padapter,
memcpy(bssid->Ssid.ssid, p + 2, p[1]);
bssid->Ssid.ssid_len = p[1];
 
-   memset(bssid->SupportedRates, 0, NDIS_802_11_LENGTH_RATES_EX);
-
/* checking rate info... */
i = 0;
p = cfg80211_find_ie(WLAN_EID_SUPP_RATES, bssid->IEs + ie_offset,
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 21/76] staging: rtl8723au: _issue_deauth(): Use struct ieee80211_mgmt to build frame

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 27 ++-
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index e5df86a..d109256 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -3840,8 +3840,7 @@ static int _issue_deauth(struct rtw_adapter *padapter, 
unsigned char *da,
 {
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
-   unsigned char *pframe;
-   struct ieee80211_hdr *pwlanhdr;
+   struct ieee80211_mgmt *mgmt;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
@@ -3860,27 +3859,21 @@ static int _issue_deauth(struct rtw_adapter *padapter, 
unsigned char *da,
 
memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
 
-   pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-   pwlanhdr = (struct ieee80211_hdr *)pframe;
+   mgmt = (struct ieee80211_mgmt *)(pmgntframe->buf_addr + TXDESC_OFFSET);
 
-   pwlanhdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
- IEEE80211_STYPE_DEAUTH);
+   mgmt->frame_control =
+   cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH);
 
-   ether_addr_copy(pwlanhdr->addr1, da);
-   ether_addr_copy(pwlanhdr->addr2, myid(&padapter->eeprompriv));
-   ether_addr_copy(pwlanhdr->addr3, get_my_bssid23a(&pmlmeinfo->network));
+   ether_addr_copy(mgmt->da, da);
+   ether_addr_copy(mgmt->sa, myid(&padapter->eeprompriv));
+   ether_addr_copy(mgmt->bssid, get_my_bssid23a(&pmlmeinfo->network));
 
-   pwlanhdr->seq_ctrl =
-   cpu_to_le16(IEEE80211_SN_TO_SEQ(pmlmeext->mgnt_seq));
+   mgmt->seq_ctrl = cpu_to_le16(IEEE80211_SN_TO_SEQ(pmlmeext->mgnt_seq));
pmlmeext->mgnt_seq++;
 
-   pframe += sizeof(struct ieee80211_hdr_3addr);
-   pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr);
+   pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr) + 2;
 
-   reason = cpu_to_le16(reason);
-   pframe = rtw_set_fixed_ie23a(pframe, WLAN_REASON_PREV_AUTH_NOT_VALID,
-(unsigned char *)&reason,
-&pattrib->pktlen);
+   mgmt->u.deauth.reason_code = cpu_to_le16(reason);
 
pattrib->last_txcmdsz = pattrib->pktlen;
 
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 29/76] staging: rtl8723au: Remove duplicate defines of IEEE80211_HT_PARAM_CHA_SEC_*

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ieee80211.c | 10 --
 drivers/staging/rtl8723au/include/ieee80211.h  |  5 -
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
index 922b45e..9d0662c 100644
--- a/drivers/staging/rtl8723au/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
@@ -153,14 +153,12 @@ inline u8 *rtw_set_ie23a_ch_switch (u8 *buf, u32 
*buf_len, u8 ch_switch_mode,
 
 inline u8 hal_ch_offset_to_secondary_ch_offset23a(u8 ch_offset)
 {
-   if (ch_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE)
-   return SCN;
-   else if (ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER)
-   return SCB;
+   if (ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER)
+   return IEEE80211_HT_PARAM_CHA_SEC_BELOW;
else if (ch_offset == HAL_PRIME_CHNL_OFFSET_UPPER)
-   return SCA;
+   return IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
 
-   return SCN;
+   return IEEE80211_HT_PARAM_CHA_SEC_NONE;
 }
 
 inline u8 *rtw_set_ie23a_secondary_ch_offset(u8 *buf, u32 *buf_len,
diff --git a/drivers/staging/rtl8723au/include/ieee80211.h 
b/drivers/staging/rtl8723au/include/ieee80211.h
index 9e03d41..cb3f4fa 100644
--- a/drivers/staging/rtl8723au/include/ieee80211.h
+++ b/drivers/staging/rtl8723au/include/ieee80211.h
@@ -390,11 +390,6 @@ struct rtw_ieee80211_channel {
 
 u8 *rtw_set_ie23a(u8 *pbuf, int index, uint len, const u8 *source, uint 
*frlen);
 
-enum secondary_ch_offset {
-   SCN = 0, /* no secondary channel */
-   SCA = 1, /* secondary channel above */
-   SCB = 3,  /* secondary channel below */
-};
 u8 hal_ch_offset_to_secondary_ch_offset23a(u8 ch_offset);
 u8 *rtw_set_ie23a_ch_switch(u8 *buf, u32 *buf_len, u8 ch_switch_mode, u8 
new_ch, u8 ch_switch_cnt);
 u8 *rtw_set_ie23a_secondary_ch_offset(u8 *buf, u32 *buf_len, u8 
secondary_ch_offset);
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 31/76] staging: rtl8723au: Remove some unused 80211 header parsing macros

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/include/ieee80211.h | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/staging/rtl8723au/include/ieee80211.h 
b/drivers/staging/rtl8723au/include/ieee80211.h
index 7d22825..c2c57c7 100644
--- a/drivers/staging/rtl8723au/include/ieee80211.h
+++ b/drivers/staging/rtl8723au/include/ieee80211.h
@@ -219,20 +219,10 @@ struct ieee80211_snap_hdr {
 
 #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
 
-#define WLAN_FC_GET_TYPE(fc)   (fc & IEEE80211_FCTL_FTYPE)
-#define WLAN_FC_GET_STYPE(fc)  (fc & IEEE80211_FCTL_STYPE)
-
-#define WLAN_QC_GET_TID(qc)(qc & 0x0f)
-
-#define WLAN_GET_SEQ_FRAG(seq) (seq & RTW_IEEE80211_SCTL_FRAG)
-#define WLAN_GET_SEQ_SEQ(seq)  (seq & RTW_IEEE80211_SCTL_SEQ)
-
-
 #define WLAN_REASON_JOIN_WRONG_CHANNEL   65534
 #define WLAN_REASON_EXPIRATION_CHK 65535
 
 
-
 #define IEEE80211_STATMASK_SIGNAL (1<<0)
 #define IEEE80211_STATMASK_RSSI (1<<1)
 #define IEEE80211_STATMASK_NOISE (1<<2)
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 28/76] staging: rtl8723au: Remove obsolete rtw_set_fixed_ie23a()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ieee80211.c | 8 
 drivers/staging/rtl8723au/include/ieee80211.h  | 1 -
 2 files changed, 9 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
index 9f6dd77..922b45e 100644
--- a/drivers/staging/rtl8723au/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
@@ -124,14 +124,6 @@ int rtw_check_network_type23a(unsigned char *rate, int 
ratelen, int channel)
}
 }
 
-u8 *rtw_set_fixed_ie23a(unsigned char *pbuf, unsigned int len,
-unsigned char *source, unsigned int *frlen)
-{
-   memcpy((void *)pbuf, (void *)source, len);
-   *frlen = *frlen + len;
-   return pbuf + len;
-}
-
 /*  rtw_set_ie23a will update frame length */
 u8 *rtw_set_ie23a(u8 *pbuf, int index, uint len, const u8 *source, uint *frlen)
 {
diff --git a/drivers/staging/rtl8723au/include/ieee80211.h 
b/drivers/staging/rtl8723au/include/ieee80211.h
index f6e982e..9e03d41 100644
--- a/drivers/staging/rtl8723au/include/ieee80211.h
+++ b/drivers/staging/rtl8723au/include/ieee80211.h
@@ -388,7 +388,6 @@ struct rtw_ieee80211_channel {
/*, (channel)->orig_mag*/ \
/*, (channel)->orig_mpwr*/ \
 
-u8 *rtw_set_fixed_ie23a(unsigned char *pbuf, unsigned int len, unsigned char 
*source, unsigned int *frlen);
 u8 *rtw_set_ie23a(u8 *pbuf, int index, uint len, const u8 *source, uint 
*frlen);
 
 enum secondary_ch_offset {
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 18/76] staging: rtl8723au: issue_assocrsp(): Use struct ieee80211_mgmt instead of rtw_set_fixed_ie23a()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 33 +++
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index 616bb7c..e5df86a 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -3182,7 +3182,7 @@ static void issue_assocrsp(struct rtw_adapter *padapter, 
unsigned short status,
   struct sta_info *pstat, u16 pkt_type)
 {
struct xmit_frame *pmgntframe;
-   struct ieee80211_hdr *pwlanhdr;
+   struct ieee80211_mgmt *mgmt;
struct pkt_attrib *pattrib;
unsigned char *pframe;
unsigned short val;
@@ -3207,37 +3207,30 @@ static void issue_assocrsp(struct rtw_adapter 
*padapter, unsigned short status,
memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
 
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-   pwlanhdr = (struct ieee80211_hdr *)pframe;
+   mgmt = (struct ieee80211_mgmt *)pframe;
 
-   pwlanhdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | pkt_type);
+   mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | pkt_type);
 
-   ether_addr_copy(pwlanhdr->addr1, pstat->hwaddr);
-   ether_addr_copy(pwlanhdr->addr2, myid(&padapter->eeprompriv));
-   ether_addr_copy(pwlanhdr->addr3, get_my_bssid23a(&pmlmeinfo->network));
+   ether_addr_copy(mgmt->da, pstat->hwaddr);
+   ether_addr_copy(mgmt->sa, myid(&padapter->eeprompriv));
+   ether_addr_copy(mgmt->bssid, get_my_bssid23a(&pmlmeinfo->network));
 
-   pwlanhdr->seq_ctrl =
-   cpu_to_le16(IEEE80211_SN_TO_SEQ(pmlmeext->mgnt_seq));
+   mgmt->seq_ctrl = cpu_to_le16(IEEE80211_SN_TO_SEQ(pmlmeext->mgnt_seq));
 
pmlmeext->mgnt_seq++;
 
pattrib->hdrlen = sizeof(struct ieee80211_hdr_3addr);
-   pattrib->pktlen += pattrib->hdrlen;
-   pframe += pattrib->hdrlen;
+   pattrib->pktlen =
+   offsetof(struct ieee80211_mgmt, u.assoc_resp.variable);
 
/* capability */
val = *(unsigned short *)rtw_get_capability23a_from_ie(ie);
 
-   pframe = rtw_set_fixed_ie23a(pframe, _CAPABILITY_,
-(unsigned char *)&val, &pattrib->pktlen);
+   mgmt->u.assoc_resp.capab_info = val;
+   mgmt->u.assoc_resp.status_code = cpu_to_le16(status);
+   mgmt->u.assoc_resp.aid = cpu_to_le16(pstat->aid | BIT(14) | BIT(15));
 
-   status = cpu_to_le16(status);
-   pframe = rtw_set_fixed_ie23a(pframe, _STATUS_CODE_,
-(unsigned char *)&status,
-&pattrib->pktlen);
-
-   val = cpu_to_le16(pstat->aid | BIT(14) | BIT(15));
-   pframe = rtw_set_fixed_ie23a(pframe, _ASOC_ID_, (unsigned char *)&val,
-&pattrib->pktlen);
+   pframe = mgmt->u.assoc_resp.variable;
 
if (pstat->bssratelen <= 8) {
pframe = rtw_set_ie23a(pframe, WLAN_EID_SUPP_RATES,
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/76] staging: rtl8723au: rtw_get_wps_ie23a(): Remove unused dest pointer wps_ie

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ap.c   | 7 +--
 drivers/staging/rtl8723au/core/rtw_ieee80211.c| 7 +--
 drivers/staging/rtl8723au/core/rtw_mlme.c | 2 +-
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 6 ++
 drivers/staging/rtl8723au/include/ieee80211.h | 2 +-
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 9 -
 6 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c 
b/drivers/staging/rtl8723au/core/rtw_ap.c
index a5bbcdc..6c9a933 100644
--- a/drivers/staging/rtl8723au/core/rtw_ap.c
+++ b/drivers/staging/rtl8723au/core/rtw_ap.c
@@ -663,7 +663,9 @@ static void start_bss_network(struct rtw_adapter *padapter, 
u8 *pbuf)
/* check if there is wps ie, */
/* if there is wpsie in beacon, the hostapd will update beacon twice 
when stating hostapd, */
/* and at first time the security ie (RSN/WPA IE) will not include in 
beacon. */
-   if (NULL == rtw_get_wps_ie23a(pnetwork->IEs+_FIXED_IE_LENGTH_, 
pnetwork->IELength-_FIXED_IE_LENGTH_, NULL, NULL))
+   if (NULL == rtw_get_wps_ie23a(pnetwork->IEs + _FIXED_IE_LENGTH_,
+ pnetwork->IELength - _FIXED_IE_LENGTH_,
+ NULL))
pmlmeext->bstart_bss = true;
 
/* todo: update wmm, ht cap */
@@ -1244,7 +1246,8 @@ static void update_bcn_wps_ie(struct rtw_adapter 
*padapter)
if (pwps_ie_src == NULL)
return;
 
-   pwps_ie = rtw_get_wps_ie23a(ie+_FIXED_IE_LENGTH_, 
ielen-_FIXED_IE_LENGTH_, NULL, &wps_ielen);
+   pwps_ie = rtw_get_wps_ie23a(ie + _FIXED_IE_LENGTH_,
+   ielen - _FIXED_IE_LENGTH_, &wps_ielen);
 
if (pwps_ie == NULL || wps_ielen == 0)
return;
diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c 
b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
index dd9446a..f05d6e0 100644
--- a/drivers/staging/rtl8723au/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
@@ -700,14 +700,12 @@ int rtw_get_sec_ie23a(u8 *in_ie, uint in_len, u8 *rsn_ie, 
u16 *rsn_len,
  * rtw_get_wps_ie23a - Search WPS IE from a series of IEs
  * @in_ie: Address of IEs to search
  * @in_len: Length limit from in_ie
- * @wps_ie: If not NULL and WPS IE is found, WPS IE will be copied to the
- *  buf starting from wps_ie
  * @wps_ielen: If not NULL and WPS IE is found, will set to the length of
  * the entire WPS IE
  *
  * Returns: The address of the WPS IE found, or NULL
  */
-u8 *rtw_get_wps_ie23a(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen)
+u8 *rtw_get_wps_ie23a(u8 *in_ie, uint in_len, uint *wps_ielen)
 {
uint cnt;
u8 *wpsie_ptr = NULL;
@@ -728,9 +726,6 @@ u8 *rtw_get_wps_ie23a(u8 *in_ie, uint in_len, u8 *wps_ie, 
uint *wps_ielen)
!memcmp(&in_ie[cnt+2], wps_oui, 4)) {
wpsie_ptr = &in_ie[cnt];
 
-   if (wps_ie)
-   memcpy(wps_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
-
if (wps_ielen)
*wps_ielen = in_ie[cnt + 1] + 2;
 
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 7a354ae..b1fa5dc 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -599,7 +599,7 @@ static int rtw_is_desired_network(struct rtw_adapter 
*adapter,
if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) {
if (rtw_get_wps_ie23a(pnetwork->network.IEs + _FIXED_IE_LENGTH_,
  pnetwork->network.IELength -
- _FIXED_IE_LENGTH_, NULL, &wps_ielen))
+ _FIXED_IE_LENGTH_, &wps_ielen))
return true;
else
return false;
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index 1e1f845..9b401fb 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -2548,8 +2548,7 @@ void issue_beacon23a(struct rtw_adapter *padapter, int 
timeout_ms)
   sizeof (struct ieee80211_hdr_3addr) +
   _BEACON_IE_OFFSET_, pattrib->pktlen -
   sizeof (struct ieee80211_hdr_3addr) -
-  _BEACON_IE_OFFSET_, NULL,
-  &wps_ielen);
+  _BEACON_IE_OFFSET_, &wps_ielen);
if (wps_ie && wps_ielen > 0) {
rtw_get_wps_attr_content23a(wps_ie, wps_ielen,
WPS_ATTR_SELECTED_REGISTRAR,
@@ -2714,8 

[PATCH 41/76] staging: rtl8723au: rtw_stadel_event_callback23a(): Remove superfluous memset()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 7c99c37..bcc6893 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -1506,8 +1506,6 @@ void rtw_stadel_event_callback23a(struct rtw_adapter 
*adapter, const u8 *pbuf)
memcpy(pdev_network, &tgt_network->network,
   get_wlan_bssid_ex_sz(&tgt_network->network));
 
-   memset(&pdev_network->Ssid, 0,
-  sizeof(struct cfg80211_ssid));
memcpy(&pdev_network->Ssid, &pmlmepriv->assoc_ssid,
   sizeof(struct cfg80211_ssid));
 
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 54/76] staging: rtl8723au: rtw_do_join23a(): Use correct error return values

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Don't mix true/fail with _SUCCESS/_FAIL as return value

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ioctl_set.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
index 7b0d3db..28cfea5 100644
--- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
@@ -109,7 +109,7 @@ int rtw_do_join23a(struct rtw_adapter *padapter)
 _drv_err_,
 ("***Error =>do_goin: 
rtw_creat"
  "ebss_cmd status FAIL***\n"));
-   ret =  false;
+   ret = _FAIL;
goto exit;
}
 
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 55/76] staging: rtl8723au: Minor debug message fixup

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 2a0c43a..31cf1ac 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -1771,7 +1771,7 @@ int rtw_select_and_join_from_scanned_queue23a(struct 
mlme_priv *pmlmepriv)
pnetwork = container_of(plist, struct wlan_network, list);
if (!pnetwork) {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
-("%s return _FAIL:(pnetwork == NULL)\n",
+("%s: return _FAIL:(pnetwork == NULL)\n",
  __func__));
ret = _FAIL;
goto exit;
@@ -1793,8 +1793,7 @@ int rtw_select_and_join_from_scanned_queue23a(struct 
mlme_priv *pmlmepriv)
 
/*  check for situation of  _FW_LINKED */
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
-   DBG_8723A("%s: _FW_LINKED while ask_for_joinbss!!!\n",
- __func__);
+   DBG_8723A("%s: _FW_LINKED while ask_for_joinbss!\n", __func__);
 
rtw_disassoc_cmd23a(adapter, 0, true);
rtw_indicate_disconnect23a(adapter);
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 68/76] staging: rtl8723au: Move rtw_do_join23a() to rtw_mlme.c and declare it static

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ioctl_set.c| 33 
 drivers/staging/rtl8723au/core/rtw_mlme.c | 38 +--
 drivers/staging/rtl8723au/include/rtw_ioctl_set.h |  1 -
 3 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
index 4f6d7f5..77835fc 100644
--- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
@@ -22,39 +22,6 @@
 #include 
 #include 
 
-int rtw_do_join23a(struct rtw_adapter *padapter)
-{
-   struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-   int ret;
-
-   pmlmepriv->cur_network.join_res = -2;
-
-   set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
-
-   pmlmepriv->to_join = true;
-
-   ret = rtw_select_and_join_from_scanned_queue23a(pmlmepriv);
-   if (ret == _SUCCESS) {
-   pmlmepriv->to_join = false;
-   } else {
-   if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
-   /* switch to ADHOC_MASTER */
-   ret = rtw_do_join_adhoc(padapter);
-   if (ret != _SUCCESS)
-   goto exit;
-   } else {
-   /*  can't associate ; reset under-linking */
-   _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
-
-   ret = _FAIL;
-   pmlmepriv->to_join = false;
-   }
-   }
-
-exit:
-   return ret;
-}
-
 int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter,
  struct cfg80211_ssid *pssid,
  int ssid_max_num)
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 1557088..bdebde7 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -29,6 +29,7 @@
 
 static struct wlan_network *
 rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv);
+static int rtw_do_join(struct rtw_adapter *padapter);
 
 static void rtw_init_mlme_timer(struct rtw_adapter *padapter)
 {
@@ -280,7 +281,7 @@ static void _rtw_roaming(struct rtw_adapter *padapter,
pmlmepriv->assoc_by_bssid = false;
 
while (1) {
-   do_join_r = rtw_do_join23a(padapter);
+   do_join_r = rtw_do_join(padapter);
if (do_join_r == _SUCCESS)
break;
else {
@@ -1489,7 +1490,7 @@ void rtw23a_join_to_handler (unsigned long data)
if (adapter->mlmepriv.to_roaming != 0) {
/* try another */
DBG_8723A("%s try another roaming\n", __func__);
-   do_join_r = rtw_do_join23a(adapter);
+   do_join_r = rtw_do_join(adapter);
if (do_join_r != _SUCCESS) {
DBG_8723A("%s roaming do_join return "
  "%d\n", __func__ , do_join_r);
@@ -1688,6 +1689,39 @@ pmlmepriv->lock
 
 */
 
+static int rtw_do_join(struct rtw_adapter *padapter)
+{
+   struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+   int ret;
+
+   pmlmepriv->cur_network.join_res = -2;
+
+   set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
+
+   pmlmepriv->to_join = true;
+
+   ret = rtw_select_and_join_from_scanned_queue23a(pmlmepriv);
+   if (ret == _SUCCESS) {
+   pmlmepriv->to_join = false;
+   } else {
+   if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
+   /* switch to ADHOC_MASTER */
+   ret = rtw_do_join_adhoc(padapter);
+   if (ret != _SUCCESS)
+   goto exit;
+   } else {
+   /*  can't associate ; reset under-linking */
+   _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
+
+   ret = _FAIL;
+   pmlmepriv->to_join = false;
+   }
+   }
+
+exit:
+   return ret;
+}
+
 static struct wlan_network *
 rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv)
 {
diff --git a/drivers/staging/rtl8723au/include/rtw_ioctl_set.h 
b/drivers/staging/rtl8723au/include/rtw_ioctl_set.h
index 14a36f5..e84a422 100644
--- a/drivers/staging/rtl8723au/include/rtw_ioctl_set.h
+++ b/drivers/staging/rtl8723au/include/rtw_ioctl_set.h
@@ -23,6 +23,5 @@ int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter 
*padapter,
 
 u16 rtw_get_cur_max_rate23a(struct rtw_adapter *adapter);
 s32 FillH2CCmd(struct rtw_adapter *padapter, u8 ElementID, u32 CmdLen, u8 
*pCmdBuffer);
-int rtw_do_join23a(struct rtw_adapter *padapter)

[PATCH 67/76] staging: rtl8723au: rtw_do_join23a(): Don't start scanning if network isn't found

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Don't start running network scans if trying to connect to a network
not in our cache. Let the 802.11 stack do it's job instead.

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ioctl_set.c | 85 --
 1 file changed, 13 insertions(+), 72 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
index a994893e..4f6d7f5 100644
--- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
@@ -24,17 +24,8 @@
 
 int rtw_do_join23a(struct rtw_adapter *padapter)
 {
-   struct list_head *plist, *phead;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-   struct rtw_queue *queue = &pmlmepriv->scanned_queue;
-   int ret = _SUCCESS;
-
-   spin_lock_bh(&pmlmepriv->scanned_queue.lock);
-   phead = get_list_head(queue);
-   plist = phead->next;
-
-   RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
-("%s: phead = %p; plist = %p\n\n\n", __func__, phead, plist));
+   int ret;
 
pmlmepriv->cur_network.join_res = -2;
 
@@ -42,75 +33,25 @@ int rtw_do_join23a(struct rtw_adapter *padapter)
 
pmlmepriv->to_join = true;
 
-   if (list_empty(&queue->queue)) {
-   spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
-   _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
-
-   /* when set_ssid/set_bssid for rtw_do_join23a(), but
-  scanning queue is empty */
-   /* we try to issue sitesurvey firstly */
-
-   if (pmlmepriv->LinkDetectInfo.bBusyTraffic == false ||
-   padapter->mlmepriv.to_roaming > 0) {
-   RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
-("%s: site survey if scanned_queue is empty\n",
-__func__));
-   /*  submit site_survey23a_cmd */
-   ret = rtw_sitesurvey_cmd23a(padapter,
-&pmlmepriv->assoc_ssid, 1,
-NULL, 0);
-   if (ret != _SUCCESS) {
-   pmlmepriv->to_join = false;
-   RT_TRACE(_module_rtl871x_ioctl_set_c_, 
_drv_err_,
-("%s: site survey return error\n",
-__func__));
-   }
+   ret = rtw_select_and_join_from_scanned_queue23a(pmlmepriv);
+   if (ret == _SUCCESS) {
+   pmlmepriv->to_join = false;
+   } else {
+   if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
+   /* switch to ADHOC_MASTER */
+   ret = rtw_do_join_adhoc(padapter);
+   if (ret != _SUCCESS)
+   goto exit;
} else {
-   pmlmepriv->to_join = false;
-   ret = _FAIL;
-   }
+   /*  can't associate ; reset under-linking */
+   _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
 
-   goto exit;
-   } else {
-   int select_ret;
-   spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
-   select_ret = 
rtw_select_and_join_from_scanned_queue23a(pmlmepriv);
-   if (select_ret == _SUCCESS) {
+   ret = _FAIL;
pmlmepriv->to_join = false;
-   } else {
-   if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
-   /* switch to ADHOC_MASTER */
-   ret = rtw_do_join_adhoc(padapter);
-   if (ret != _SUCCESS)
-   goto exit;
-   } else {
-   /*  can't associate ; reset under-linking */
-   _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
-
-   /* when set_ssid/set_bssid for rtw_do_join23a(),
-  but there are no desired bss in scanning
-  queue */
-   /* we try to issue sitesurvey firstly */
-   if (pmlmepriv->LinkDetectInfo.bBusyTraffic ==
-   false || padapter->mlmepriv.to_roaming > 0){
-   /* DBG_8723A("rtw_do_join23a() when   
no "
-  "desired bss in scanning queue\n");
-   */
-   ret = rtw_sitesurvey_cmd23a(padapter, 
&pmlmepriv->assoc_ssid, 1, NULL, 0);
-   if (ret != _SUCCESS) {
-   pmlmep

[PATCH 72/76] staging: rtl8723au: rtw_set_802_11_bssid23a_list_scan(): Use __func__ to print function name

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ioctl_set.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
index b58cd9e..30287af 100644
--- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
@@ -30,8 +30,7 @@ int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter 
*padapter,
int res = _SUCCESS;
 
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
-("+rtw_set_802_11_bssid23a_list_scan(), fw_state =%x\n",
- get_fwstate(pmlmepriv)));
+("+%s: fw_state =%x\n", __func__, get_fwstate(pmlmepriv)));
 
if (!padapter) {
res = _FAIL;
@@ -40,8 +39,7 @@ int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter 
*padapter,
if (padapter->hw_init_completed == false) {
res = _FAIL;
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
-("\n === rtw_set_802_11_bssid23a_list_scan:"
- "hw_init_completed == false ===\n"));
+("%s: hw_init_completed == false ===\n", __func__));
goto exit;
}
 
@@ -49,8 +47,8 @@ int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter 
*padapter,
(pmlmepriv->LinkDetectInfo.bBusyTraffic == true)) {
/*  Scan or linking is in progress, do nothing. */
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
-("rtw_set_802_11_bssid23a_list_scan fail since 
fw_state "
- "= %x\n", get_fwstate(pmlmepriv)));
+("%s fail since fw_state = %x\n", __func__,
+ get_fwstate(pmlmepriv)));
 
if (check_fwstate(pmlmepriv,
  (_FW_UNDER_SURVEY|_FW_UNDER_LINKING))) {
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] gpio: gpiolib: set gpiochip_remove retval to void

2014-06-09 Thread Andrzej Hajda
On 06/09/2014 01:29 PM, Lars-Peter Clausen wrote:
> On 06/09/2014 01:18 AM, Ben Dooks wrote:
>> On Fri, May 30, 2014 at 08:16:59PM +0200, Lars-Peter Clausen wrote:
>>> On 05/30/2014 07:33 PM, David Daney wrote:
 On 05/30/2014 04:39 AM, Geert Uytterhoeven wrote:
> On Fri, May 30, 2014 at 1:30 PM, abdoulaye berthe 
> wrote:
>> --- a/drivers/gpio/gpiolib.c
>> +++ b/drivers/gpio/gpiolib.c
>> @@ -1263,10 +1263,9 @@ static void gpiochip_irqchip_remove(struct
>> gpio_chip *gpiochip);
>>*
>>* A gpio_chip with any GPIOs still requested may not be removed.
>>*/
>> -int gpiochip_remove(struct gpio_chip *chip)
>> +void gpiochip_remove(struct gpio_chip *chip)
>>   {
>>  unsigned long   flags;
>> -   int status = 0;
>>  unsignedid;
>>
>>  acpi_gpiochip_remove(chip);
>> @@ -1278,24 +1277,15 @@ int gpiochip_remove(struct gpio_chip *chip)
>>  of_gpiochip_remove(chip);
>>
>>  for (id = 0; id < chip->ngpio; id++) {
>> -   if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags)) {
>> -   status = -EBUSY;
>> -   break;
>> -   }
>> -   }
>> -   if (status == 0) {
>> -   for (id = 0; id < chip->ngpio; id++)
>> -   chip->desc[id].chip = NULL;
>> -
>> -   list_del(&chip->list);
>> +   if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags))
>> +   panic("gpio: removing gpiochip with gpios still
>> requested\n");
>
> panic?

 NACK to the patch for this reason.  The strongest thing you should do here
 is WARN.

 That said, I am not sure why we need this whole patch set in the first 
 place.
>>>
>>> Well, what currently happens when you remove a device that is a
>>> provider of a gpio_chip which is still in use, is that the kernel
>>> crashes. Probably with a rather cryptic error message. So this patch
>>> doesn't really change the behavior, but makes it more explicit what
>>> is actually wrong. And even if you replace the panic() by a WARN()
>>> it will again just crash slightly later.
>>>
>>> This is a design flaw in the GPIO subsystem that needs to be fixed.
>>
>> Surely then the best way is to error out to the module unload and
>> stop the driver being unloaded?
>>
> 
> You can't error out on module unload, although that's not really relevant 
> here. gpiochip_remove() is typically called when the device that registered 
> the GPIO chip is unbound. And despite some remove() callbacks having a 
> return type of int you can not abort the removal of a device.

It is a design flaw in many subsystems having providers and consumers,
not only GPIO. The same situation is with clock providers, regulators,
phys, drm_panels, ..., at least it was such last time I have tested it.

The problem is that many frameworks assumes that lifetime of provider is
always bigger than lifetime of its consumers, and this is wrong
assumption - usually it is not possible to prevent unbinding driver from
device, so if the device is a provider there is no way to inform
consumers about his removal.

Some solution for such problems is to use some kind of availability
callbacks for requesting resources (gpios, clocks, regulators,...)
instead of simple 'getters' (clk_get, gpiod_get). Callbacks should
guarantee that the resource is always valid between callback reporting
its availability and callback reporting its removal. Such approach seems
to be complicated at the first sight but it should allow to make the
code safe and as a bonus it will allow to avoid deferred probing.
Btw I have send already RFC for such framework [1].

[1]: https://lkml.org/lkml/2014/4/30/345

Regards
Andrzej


> 
> - Lars
> 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 56/76] staging: rtl8723au: Don't prepend debug console messages with 'ERROR '

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/include/rtw_debug.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723au/include/rtw_debug.h 
b/drivers/staging/rtl8723au/include/rtw_debug.h
index a69d6e2..b6b0173 100644
--- a/drivers/staging/rtl8723au/include/rtw_debug.h
+++ b/drivers/staging/rtl8723au/include/rtw_debug.h
@@ -146,7 +146,7 @@
 #define DBG_8723A_LEVEL(_level, fmt, arg...)   \
do {\
if (_level <= GlobalDebugLevel23A)  
\
-   pr_info(DRIVER_PREFIX"ERROR " fmt, ##arg);\
+   pr_info(DRIVER_PREFIX fmt, ##arg);\
} while (0)
 
 #define DBG_8723A(...) \
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 50/76] staging: rtl8723au: cfg80211_rtw_connect(): Simplify ssid preparation

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Since we just matched sme->{ssid,ssid_len} to
pnetwork->network.Ssid.{ssid,ssid_len} we can simplify the copy and
move it to just before the call to rtw_set_ssid().

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index c959adb..ea03d4f 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -2188,10 +2188,6 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
 sme->bssid)) {
DBG_8723A("matched by bssid\n");
 
-   memcpy(ssid.ssid, pnetwork->network.Ssid.ssid,
-  pnetwork->network.Ssid.ssid_len);
-   ssid.ssid_len = pnetwork->network.Ssid.ssid_len;
-
matched = true;
break;
}
@@ -2201,9 +2197,6 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
pnetwork->network.Ssid.ssid_len == sme->ssid_len) {
DBG_8723A("matched by ssid\n");
 
-   memcpy(ssid.ssid, sme->ssid, sme->ssid_len);
-   ssid.ssid_len = sme->ssid_len;
-
matched = true;
break;
}
@@ -2322,6 +2315,10 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
/* rtw_set_802_11_encryption_mode(padapter,
   padapter->securitypriv.ndisencryptstatus); */
 
+   memcpy(ssid.ssid, pnetwork->network.Ssid.ssid,
+  pnetwork->network.Ssid.ssid_len);
+   ssid.ssid_len = pnetwork->network.Ssid.ssid_len;
+
if (rtw_set_ssid(padapter, &ssid) != _SUCCESS) {
ret = -EBUSY;
goto exit;
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 48/76] staging: rtl8723au: cfg80211_rtw_connect(): Clean up various bits

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 53 +--
 1 file changed, 20 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 397bf00..1de7e9e 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -2117,11 +2117,9 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
int ret = 0;
struct list_head *phead, *plist, *ptmp;
struct wlan_network *pnetwork = NULL;
-   struct cfg80211_ssid ndis_ssid;
+   struct cfg80211_ssid ssid;
u8 *dst_ssid;
-   u8 *src_ssid;
u8 *dst_bssid;
-   const u8 *src_bssid;
/* u8 matched_by_bssid = false; */
/* u8 matched_by_ssid = false; */
u8 matched = false;
@@ -2144,21 +2142,13 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
goto exit;
}
 
-   if (!sme->ssid || !sme->ssid_len) {
+   if (!sme->ssid || !sme->ssid_len ||
+   sme->ssid_len > IEEE80211_MAX_SSID_LEN) {
ret = -EINVAL;
goto exit;
}
 
-   if (sme->ssid_len > IEEE80211_MAX_SSID_LEN) {
-   ret = -E2BIG;
-   goto exit;
-   }
-
-   memset(&ndis_ssid, 0, sizeof(struct cfg80211_ssid));
-   ndis_ssid.ssid_len = sme->ssid_len;
-   memcpy(ndis_ssid.ssid, sme->ssid, sme->ssid_len);
-
-   DBG_8723A("ssid =%s, len =%zu\n", ndis_ssid.ssid, sme->ssid_len);
+   DBG_8723A("ssid =%s, len =%zu\n", sme->ssid, sme->ssid_len);
 
if (sme->bssid)
DBG_8723A("bssid =" MAC_FMT "\n", MAC_ARG(sme->bssid));
@@ -2173,6 +2163,8 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
rtw_scan_abort23a(padapter);
}
 
+   memset(ssid.ssid, 0, sizeof(struct cfg80211_ssid));
+
spin_lock_bh(&queue->lock);
 
phead = get_list_head(queue);
@@ -2197,28 +2189,24 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
}
 
if (sme->bssid) {
-   src_bssid = sme->bssid;
-
-   if (ether_addr_equal(dst_bssid, src_bssid)) {
+   if (ether_addr_equal(dst_bssid, sme->bssid)) {
DBG_8723A("matched by bssid\n");
 
-   ndis_ssid.ssid_len =
-   pnetwork->network.Ssid.ssid_len;
-   memcpy(ndis_ssid.ssid,
-  pnetwork->network.Ssid.ssid,
+   memcpy(ssid.ssid, pnetwork->network.Ssid.ssid,
   pnetwork->network.Ssid.ssid_len);
+   ssid.ssid_len = pnetwork->network.Ssid.ssid_len;
 
matched = true;
break;
}
-
} else if (sme->ssid && sme->ssid_len) {
-   src_ssid = ndis_ssid.ssid;
-
-   if ((!memcmp(dst_ssid, src_ssid, ndis_ssid.ssid_len)) &&
-   (pnetwork->network.Ssid.ssid_len ==
-ndis_ssid.ssid_len)) {
+   if (!memcmp(dst_ssid, sme->ssid, sme->ssid_len) &&
+   pnetwork->network.Ssid.ssid_len == sme->ssid_len) {
DBG_8723A("matched by ssid\n");
+
+   memcpy(ssid.ssid, sme->ssid, sme->ssid_len);
+   ssid.ssid_len = sme->ssid_len;
+
matched = true;
break;
}
@@ -2227,7 +2215,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
 
spin_unlock_bh(&queue->lock);
 
-   if (!matched || (pnetwork == NULL)) {
+   if (!matched || !pnetwork) {
ret = -ENOENT;
DBG_8723A("connect, matched == false, goto exit\n");
goto exit;
@@ -2245,9 +2233,8 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen;
 
-   ret =
-   rtw_cfg80211_set_wpa_version(psecuritypriv,
-sme->crypto.wpa_versions);
+   ret = rtw_cfg80211_set_wpa_version(psecuritypriv,
+  sme->crypto.wpa_versions);
if (ret < 0)
goto exit;
 
@@ -2318,7 +2305,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
ret = rtw_cfg80211_set_cipher(psecuritypriv,
 

[PATCH 52/76] staging: rtl8723au: rtw_set_ssid(): This is never called with _FW_UNDER_LINKING

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 2cb2c7e..3819368 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -2004,8 +2004,6 @@ static int rtw_set_ssid(struct rtw_adapter *padapter,
DBG_8723A("Set SSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv));
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
goto handle_tkip_countermeasure;
-   else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
-   goto release_mlme_lock;
 
if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) {
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 76/76] staging: rtl8723au: rtw_cfg80211_set_wpa_ie(): Avoid pointless memcpy

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

There is no point copying a buffer, just to scan it and then free it
again.

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 21 +++--
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 1d7c822..3dfdf02 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -1806,7 +1806,6 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter 
*padapter, const u8 *pie,
   size_t ielen)
 {
const u8 *wps_ie;
-   u8 *buf = NULL;
int group_cipher = 0, pairwise_cipher = 0;
int ret = 0;
const u8 *pwpa, *pwpa2;
@@ -1822,19 +1821,14 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter 
*padapter, const u8 *pie,
ret = -EINVAL;
goto exit;
}
-   buf = kmemdup(pie, ielen, GFP_KERNEL);
-   if (buf == NULL) {
-   ret = -ENOMEM;
-   goto exit;
-   }
 
/* dump */
DBG_8723A("set wpa_ie(length:%zu):\n", ielen);
for (i = 0; i < ielen; i = i + 8)
-   DBG_8723A("0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 
0x%.2x\n",
- buf[i], buf[i + 1],
- buf[i + 2], buf[i + 3], buf[i + 4],
- buf[i + 5], buf[i + 6], buf[i + 7]);
+   DBG_8723A("0x%.2x 0x%.2x 0x%.2x 0x%.2x "
+ "0x%.2x 0x%.2x 0x%.2x 0x%.2x\n",
+ pie[i], pie[i + 1], pie[i + 2], pie[i + 3],
+ pie[i + 4], pie[i + 5], pie[i + 6], pie[i + 7]);
if (ielen < RSN_HEADER_LEN) {
RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_,
 ("Ie len too short %d\n", (int)ielen));
@@ -1844,7 +1838,7 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter 
*padapter, const u8 *pie,
 
pwpa = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
   WLAN_OUI_TYPE_MICROSOFT_WPA,
-  buf, ielen);
+  pie, ielen);
if (pwpa && pwpa[1] > 0) {
if (rtw_parse_wpa_ie23a(pwpa, pwpa[1] + 2, &group_cipher,
&pairwise_cipher, NULL) == _SUCCESS) {
@@ -1859,7 +1853,7 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter 
*padapter, const u8 *pie,
}
}
 
-   pwpa2 = cfg80211_find_ie(WLAN_EID_RSN, buf, ielen);
+   pwpa2 = cfg80211_find_ie(WLAN_EID_RSN, pie, ielen);
if (pwpa2 && pwpa2[1] > 0) {
if (rtw_parse_wpa2_ie23a (pwpa2, pwpa2[1] + 2, &group_cipher,
  &pairwise_cipher, NULL) == _SUCCESS) {
@@ -1939,7 +1933,7 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter 
*padapter, const u8 *pie,
 
wps_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
 WLAN_OUI_TYPE_MICROSOFT_WPS,
-buf, ielen);
+pie, ielen);
if (wps_ie && wps_ie[1] > 0) {
DBG_8723A("got wps_ie, wps_ielen:%u\n", wps_ie[1]);
padapter->securitypriv.wps_ie_len = wps_ie[1];
@@ -1967,7 +1961,6 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter 
*padapter, const u8 *pie,
  padapter->securitypriv.ndisauthtype));
 
 exit:
-   kfree(buf);
if (ret)
_clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS);
return ret;
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 60/76] staging: rtl8723au: rtw_surveydone_event_callback23a(): Remove superfluous memset()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 4a146fb..77a0a4a 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -751,8 +751,6 @@ rtw_surveydone_event_callback23a(struct rtw_adapter 
*adapter, const u8 *pbuf)
 ("switching to adhoc "
  "master\n"));
 
-   memset(&pdev_network->Ssid, 0,
-  sizeof(struct cfg80211_ssid));
memcpy(&pdev_network->Ssid,
   &pmlmepriv->assoc_ssid,
   sizeof(struct cfg80211_ssid));
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-09 Thread Fabio Estevam
Russell,

On Fri, Jun 6, 2014 at 10:56 AM, Russell King
 wrote:
> The initial state at boot is assumed to be disconnected, and we hope
> to receive an interrupt to update the status.  Let's be more explicit
> about the current state - reading the PHY status register tells us
> the current level of the hotplug signal, which we can report back in
> the _detect() method.
>
> Signed-off-by: Russell King 

I have applied this patch against 3.15 and I still have the following
issue on a mx6qsabresd:

If I boot the kernel with the HDMI cable connected, no HDMI image
comes up. In order to get HDMI working I need to remove and then
reconnect the cable.

Still haven't had a chance to debug this though.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 2/2] gpio: gpiolib: set gpiochip_remove retval to void

2014-06-09 Thread David Laight
From: Of Andrzej Hajda
...
> > You can't error out on module unload, although that's not really relevant
> > here. gpiochip_remove() is typically called when the device that registered
> > the GPIO chip is unbound. And despite some remove() callbacks having a
> > return type of int you can not abort the removal of a device.
> 
> It is a design flaw in many subsystems having providers and consumers,
> not only GPIO. The same situation is with clock providers, regulators,
> phys, drm_panels, ..., at least it was such last time I have tested it.
> 
> The problem is that many frameworks assumes that lifetime of provider is
> always bigger than lifetime of its consumers, and this is wrong
> assumption - usually it is not possible to prevent unbinding driver from
> device, so if the device is a provider there is no way to inform
> consumers about his removal.
> 
> Some solution for such problems is to use some kind of availability
> callbacks for requesting resources (gpios, clocks, regulators,...)
> instead of simple 'getters' (clk_get, gpiod_get). Callbacks should
> guarantee that the resource is always valid between callback reporting
> its availability and callback reporting its removal. Such approach seems
> to be complicated at the first sight but it should allow to make the
> code safe and as a bonus it will allow to avoid deferred probing.
> Btw I have send already RFC for such framework [1].

Callbacks for delete are generally a locking nightmare.
A two-way handshake is also usually needed to avoid problems
with concurrent disconnect requests.

David



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 58/76] staging: rtl8723au: Introduce rtw_do_join_network()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ioctl_set.c |  2 --
 drivers/staging/rtl8723au/core/rtw_mlme.c  | 46 --
 drivers/staging/rtl8723au/include/rtw_mlme.h   |  2 ++
 3 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
index 28cfea5..d2ed9d1 100644
--- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
@@ -79,8 +79,6 @@ int rtw_do_join23a(struct rtw_adapter *padapter)
select_ret = 
rtw_select_and_join_from_scanned_queue23a(pmlmepriv);
if (select_ret == _SUCCESS) {
pmlmepriv->to_join = false;
-   mod_timer(&pmlmepriv->assoc_timer,
- jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
} else {
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
struct wlan_bssid_ex *pdev_network;
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 9248f48..4a146fb 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -739,8 +739,6 @@ rtw_surveydone_event_callback23a(struct rtw_adapter 
*adapter, const u8 *pbuf)
 
if (rtw_select_and_join_from_scanned_queue23a(
pmlmepriv) == _SUCCESS) {
-   mod_timer(&pmlmepriv->assoc_timer,
- jiffies + 
msecs_to_jiffies(MAX_JOIN_TIMEOUT));
} else {
pdev_network = 
&adapter->registrypriv.dev_network;
pibss = 
adapter->registrypriv.dev_network.MacAddress;
@@ -782,14 +780,10 @@ rtw_surveydone_event_callback23a(struct rtw_adapter 
*adapter, const u8 *pbuf)
pmlmepriv->to_join = false;
ret = rtw_select_and_join_from_scanned_queue23a(
pmlmepriv);
-   if (ret == _SUCCESS) {
-   unsigned long e;
-   e = msecs_to_jiffies(MAX_JOIN_TIMEOUT);
-   mod_timer(&pmlmepriv->assoc_timer, jiffies + e);
-   } else if (ret == 2) {/* there is no need to wait */
+   if (ret == 2) {/* there is no need to wait */
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
rtw_indicate_connect23a(adapter);
-   } else {
+   } else if (ret != _SUCCESS) {
DBG_8723A("try_to_join, but select scanning "
  "queue fail, to_roaming:%d\n",
  adapter->mlmepriv.to_roaming);
@@ -1784,6 +1778,31 @@ exit:
return candidate;
 }
 
+
+int rtw_do_join_network(struct rtw_adapter *adapter,
+   struct wlan_network *candidate)
+{
+   int ret;
+
+   /*  check for situation of  _FW_LINKED */
+   if (check_fwstate(&adapter->mlmepriv, _FW_LINKED)) {
+   DBG_8723A("%s: _FW_LINKED while ask_for_joinbss!\n", __func__);
+
+   rtw_disassoc_cmd23a(adapter, 0, true);
+   rtw_indicate_disconnect23a(adapter);
+   rtw_free_assoc_resources23a(adapter, 0);
+   }
+   set_fwstate(&adapter->mlmepriv, _FW_UNDER_LINKING);
+
+   ret = rtw_joinbss_cmd23a(adapter, candidate);
+
+   if (ret == _SUCCESS)
+   mod_timer(&adapter->mlmepriv.assoc_timer,
+ jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
+
+   return ret;
+}
+
 int rtw_select_and_join_from_scanned_queue23a(struct mlme_priv *pmlmepriv)
 {
struct rtw_adapter *adapter;
@@ -1804,16 +1823,7 @@ int rtw_select_and_join_from_scanned_queue23a(struct 
mlme_priv *pmlmepriv)
  candidate->network.DSConfig);
}
 
-   /*  check for situation of  _FW_LINKED */
-   if (check_fwstate(pmlmepriv, _FW_LINKED)) {
-   DBG_8723A("%s: _FW_LINKED while ask_for_joinbss!\n", __func__);
-
-   rtw_disassoc_cmd23a(adapter, 0, true);
-   rtw_indicate_disconnect23a(adapter);
-   rtw_free_assoc_resources23a(adapter, 0);
-   }
-   set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
-   ret = rtw_joinbss_cmd23a(adapter, candidate);
+   ret = rtw_do_join_network(adapter, candidate);
 
 exit:
return ret;
diff --git a/drivers/staging/rtl8723au/include/rtw_mlme.h 
b/drivers/staging/rtl8723au/include/rtw_mlme.h
index c8e82bf..e48518f 100644
--- a/drivers/staging/rtl8723au/include/rtw_mlme.h
+++ b/drivers/st

[PATCH 66/76] staging: rtl8723au: rtw_set_ssid(): Use rtw_do_join_network()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

We already have the wlan_network we wish to join, hence it's pointless
to go back to the scanned_queue and pull it out of there, before
running the join logic.

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 25 +++
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 45061c2..7f4a52c 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -2099,11 +2099,28 @@ handle_tkip_countermeasure:
 
pmlmepriv->assoc_by_bssid = false;
 
-   if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
-   pmlmepriv->to_join = true;
-   else
-   status = rtw_do_join23a(padapter);
+   pmlmepriv->to_join = true;
+
+   if (!check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) {
+   pmlmepriv->cur_network.join_res = -2;
 
+   status = rtw_do_join_network(padapter, newnetwork);
+   if (status == _SUCCESS) {
+   pmlmepriv->to_join = false;
+   } else {
+   if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
+   /* switch to ADHOC_MASTER */
+   status = rtw_do_join_adhoc(padapter);
+   if (status != _SUCCESS)
+   goto release_mlme_lock;
+   } else {
+   /* can't associate ; reset under-linking */
+   _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
+   status = _FAIL;
+   pmlmepriv->to_join = false;
+   }
+   }
+   }
 release_mlme_lock:
spin_unlock_bh(&pmlmepriv->lock);
 
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 73/76] staging: rtl8723au: Don't run regular scans in the driver, the stack handles that

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/Makefile|  1 -
 drivers/staging/rtl8723au/core/rtw_ioctl_set.c| 78 ---
 drivers/staging/rtl8723au/core/rtw_mlme.c | 21 --
 drivers/staging/rtl8723au/include/rtw_ioctl_set.h |  4 --
 4 files changed, 104 deletions(-)
 delete mode 100644 drivers/staging/rtl8723au/core/rtw_ioctl_set.c

diff --git a/drivers/staging/rtl8723au/Makefile 
b/drivers/staging/rtl8723au/Makefile
index a6316af..6f76c7b 100644
--- a/drivers/staging/rtl8723au/Makefile
+++ b/drivers/staging/rtl8723au/Makefile
@@ -1,7 +1,6 @@
 r8723au-y :=   \
core/rtw_cmd.o  \
core/rtw_efuse.o\
-   core/rtw_ioctl_set.o\
core/rtw_ieee80211.o\
core/rtw_led.o  \
core/rtw_mlme.o \
diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
deleted file mode 100644
index 30287af..000
--- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- *
- * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- 
**/
-#define _RTW_IOCTL_SET_C_
-
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-
-int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter,
- struct cfg80211_ssid *pssid,
- int ssid_max_num)
-{
-   struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-   int res = _SUCCESS;
-
-   RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
-("+%s: fw_state =%x\n", __func__, get_fwstate(pmlmepriv)));
-
-   if (!padapter) {
-   res = _FAIL;
-   goto exit;
-   }
-   if (padapter->hw_init_completed == false) {
-   res = _FAIL;
-   RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
-("%s: hw_init_completed == false ===\n", __func__));
-   goto exit;
-   }
-
-   if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING) ||
-   (pmlmepriv->LinkDetectInfo.bBusyTraffic == true)) {
-   /*  Scan or linking is in progress, do nothing. */
-   RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
-("%s fail since fw_state = %x\n", __func__,
- get_fwstate(pmlmepriv)));
-
-   if (check_fwstate(pmlmepriv,
- (_FW_UNDER_SURVEY|_FW_UNDER_LINKING))) {
-   RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
-("\n###_FW_UNDER_SURVEY|_FW_UNDER_LINKING\n"));
-   } else {
-   RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
-("\n###pmlmepriv->sitesurveyctrl.traffic_"
- "busy == true\n"));
-   }
-   } else {
-   if (rtw_is_scan_deny(padapter)) {
-   DBG_8723A("%s(%s): scan deny\n",
- __func__, padapter->pnetdev->name);
-   return _SUCCESS;
-   }
-
-   spin_lock_bh(&pmlmepriv->lock);
-
-   res = rtw_sitesurvey_cmd23a(padapter, pssid, ssid_max_num,
-NULL, 0);
-
-   spin_unlock_bh(&pmlmepriv->lock);
-   }
-exit:
-   return res;
-}
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index bdebde7..e89d019 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -1538,26 +1538,9 @@ void rtw_scan_timeout_handler23a(unsigned long data)
rtw_cfg80211_indicate_scan_done(wdev_to_priv(adapter->rtw_wdev), true);
 }
 
-static void rtw_auto_scan_handler(struct rtw_adapter *padapter)
-{
-   struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-
-   /* auto site survey per 60sec */
-   if (pmlmepriv->scan_interval > 0) {
-   pmlmepriv->scan_interval--;
-   if (pmlmepriv->scan_interval == 0) {
-   DBG_8723A("%s\n", __func__);
-   rtw_set_802_11_bssid23a_list_scan(padapter, NU

[PATCH 64/76] staging: rtl8723au: rtw_surveydone_event_callback23a(): We always set _FW_UNDER_LINKING

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 06dc897..d2b38f7 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -732,15 +732,13 @@ rtw_surveydone_event_callback23a(struct rtw_adapter 
*adapter, const u8 *pbuf)
rtw_set_signal_stat_timer(&adapter->recvpriv);
 
if (pmlmepriv->to_join == true) {
+   set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
-   set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
-
ret = rtw_select_and_join_from_scanned_queue23a(
pmlmepriv);
if (ret != _SUCCESS)
rtw_do_join_adhoc(adapter);
} else {
-   set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
pmlmepriv->to_join = false;
ret = rtw_select_and_join_from_scanned_queue23a(
pmlmepriv);
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 69/76] staging: rtl8723au: rtw_get_cur_max_rate23a(): Remove duplicate fwstate checks

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ioctl_set.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
index 77835fc..481f94c 100644
--- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
@@ -100,10 +100,6 @@ u16 rtw_get_cur_max_rate23a(struct rtw_adapter *adapter)
u8 bw_40MHz = 0, short_GI_20 = 0, short_GI_40 = 0;
u16 mcs_rate = 0;
 
-   if (!check_fwstate(pmlmepriv, _FW_LINKED) &&
-   !check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE))
-   return 0;
-
if (pmlmeext->cur_wireless_mode & (WIRELESS_11_24N|WIRELESS_11_5N)) {
p = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY,
 &pcur_bss->IEs[12],
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 45/76] staging: rtl8723au: cfg80211_rtw_connect(): Check correct return value from rtw_set_802_11_ssid23a()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index d4eb2a9..1168e7c 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -2204,7 +2204,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
/* rtw_set_802_11_encryption_mode(padapter,
   padapter->securitypriv.ndisencryptstatus); */
 
-   if (rtw_set_802_11_ssid23a(padapter, &ndis_ssid) == false) {
+   if (rtw_set_802_11_ssid23a(padapter, &ndis_ssid) != _SUCCESS) {
ret = -1;
goto exit;
}
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 16/76] staging: rtl8723au: Make struct htpriv.ampdu_enable a bool

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Be consistent in parsing it's value

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c | 5 ++---
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 2 +-
 drivers/staging/rtl8723au/include/rtw_ht.h| 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 31c414a..4a33e7d 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -2291,8 +2291,7 @@ void rtw_update_ht_cap23a(struct rtw_adapter *padapter, 
u8 *pie, uint ie_len)
ie_len -= bcn_fixed_size;
 
/* maybe needs check if ap supports rx ampdu. */
-   if (phtpriv->ampdu_enable == false &&
-   pregistrypriv->ampdu_enable == 1) {
+   if (!phtpriv->ampdu_enable && pregistrypriv->ampdu_enable == 1) {
if (pregistrypriv->wifi_spec == 1)
phtpriv->ampdu_enable = false;
else
@@ -2409,7 +2408,7 @@ void rtw_issue_addbareq_cmd23a(struct rtw_adapter 
*padapter,
 
phtpriv = &psta->htpriv;
 
-   if (phtpriv->ht_option && phtpriv->ampdu_enable == true) {
+   if (phtpriv->ht_option && phtpriv->ampdu_enable) {
issued = (phtpriv->agg_enable_bitmap>>priority)&0x1;
issued |= (phtpriv->candidate_tid_bitmap>>priority)&0x1;
 
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index ae8d38f..9b8566c 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -5848,7 +5848,7 @@ static void addba_timer_hdl(unsigned long data)
 
phtpriv = &psta->htpriv;
 
-   if (phtpriv->ht_option && phtpriv->ampdu_enable == true) {
+   if (phtpriv->ht_option && phtpriv->ampdu_enable) {
if (phtpriv->candidate_tid_bitmap)
phtpriv->candidate_tid_bitmap = 0x0;
}
diff --git a/drivers/staging/rtl8723au/include/rtw_ht.h 
b/drivers/staging/rtl8723au/include/rtw_ht.h
index f086376..cfc947d 100644
--- a/drivers/staging/rtl8723au/include/rtw_ht.h
+++ b/drivers/staging/rtl8723au/include/rtw_ht.h
@@ -22,7 +22,7 @@
 struct ht_priv
 {
boolht_option;
-   u32 ampdu_enable;/* for enable Tx A-MPDU */
+   boolampdu_enable;/* for enable Tx A-MPDU */
/* u8   baddbareq_issued[16]; */
u32 tx_amsdu_enable;/* for enable Tx A-MSDU */
u32 tx_amdsu_maxlen; /*  1: 8k, 0:4k ; default:8k, for tx */
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 53/76] staging: rtl8723au: rtw_cfg80211_add_wep(): Use WLAN_KEY_LEN_*

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 3819368..45061c2 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -1931,12 +1931,12 @@ static int rtw_cfg80211_add_wep(struct rtw_adapter 
*padapter,
}
 
switch (wep->keylen) {
-   case 5:
+   case WLAN_KEY_LEN_WEP40:
psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP40;
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
 ("%s:wep->KeyLength = 5\n", __func__));
break;
-   case 13:
+   case WLAN_KEY_LEN_WEP104:
psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP104;
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
 ("%s:wep->KeyLength = 13\n", __func__));
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 71/76] staging: rtl8723au: Move rtw_get_cur_max_rate23a() to ioctl_cfg80211.c

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

This function has only one caller, so move it home and declare it static

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ioctl_set.c| 63 ---
 drivers/staging/rtl8723au/include/rtw_ioctl_set.h |  1 -
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 59 -
 3 files changed, 58 insertions(+), 65 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
index e2c40a6..b58cd9e 100644
--- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
@@ -78,66 +78,3 @@ int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter 
*padapter,
 exit:
return res;
 }
-
-/*
-* rtw_get_cur_max_rate23a -
-* @adapter: pointer to _adapter structure
-*
-* Return 0 or 100Kbps
-*/
-u16 rtw_get_cur_max_rate23a(struct rtw_adapter *adapter)
-{
-   int i = 0;
-   const u8 *p;
-   u16 rate = 0, max_rate = 0;
-   struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
-   struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
-   struct registry_priv *pregistrypriv = &adapter->registrypriv;
-   struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
-   struct wlan_bssid_ex  *pcur_bss = &pmlmepriv->cur_network.network;
-   struct ieee80211_ht_cap *pht_capie;
-   u8 rf_type = 0;
-   u8 bw_40MHz = 0, short_GI_20 = 0, short_GI_40 = 0;
-   u16 mcs_rate = 0;
-
-   p = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, &pcur_bss->IEs[12],
-pcur_bss->IELength - 12);
-   if (p && p[1] > 0) {
-   pht_capie = (struct ieee80211_ht_cap *)(p + 2);
-
-   memcpy(&mcs_rate, &pht_capie->mcs, 2);
-
-   /* bw_40MHz = (pht_capie->cap_info&
-  IEEE80211_HT_CAP_SUP_WIDTH_20_40) ? 1:0; */
-   /* cur_bwmod is updated by beacon, pmlmeinfo is
-  updated by association response */
-   bw_40MHz = (pmlmeext->cur_bwmode &&
-   (pmlmeinfo->HT_info.ht_param &
-IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) ? 1:0;
-
-   /* short_GI = (pht_capie->cap_info & (IEEE80211_HT_CAP
-  _SGI_20|IEEE80211_HT_CAP_SGI_40)) ? 1 : 0; */
-   short_GI_20 = (pmlmeinfo->ht_cap.cap_info &
-  cpu_to_le16(IEEE80211_HT_CAP_SGI_20)) ? 1:0;
-   short_GI_40 = (pmlmeinfo->ht_cap.cap_info &
-  cpu_to_le16(IEEE80211_HT_CAP_SGI_40)) ? 1:0;
-
-   rf_type = rtl8723a_get_rf_type(adapter);
-   max_rate = rtw_mcs_rate23a(rf_type, bw_40MHz &
-  pregistrypriv->cbw40_enable,
-  short_GI_20, short_GI_40,
-  &pmlmeinfo->ht_cap.mcs);
-   } else {
-   while (pcur_bss->SupportedRates[i] != 0 &&
-  pcur_bss->SupportedRates[i] != 0xFF) {
-   rate = pcur_bss->SupportedRates[i] & 0x7F;
-   if (rate>max_rate)
-   max_rate = rate;
-   i++;
-   }
-
-   max_rate = max_rate * 10 / 2;
-   }
-
-   return max_rate;
-}
diff --git a/drivers/staging/rtl8723au/include/rtw_ioctl_set.h 
b/drivers/staging/rtl8723au/include/rtw_ioctl_set.h
index e84a422..855fc40 100644
--- a/drivers/staging/rtl8723au/include/rtw_ioctl_set.h
+++ b/drivers/staging/rtl8723au/include/rtw_ioctl_set.h
@@ -21,7 +21,6 @@ int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter 
*padapter,
  struct cfg80211_ssid *pssid,
  int ssid_max_num);
 
-u16 rtw_get_cur_max_rate23a(struct rtw_adapter *adapter);
 s32 FillH2CCmd(struct rtw_adapter *padapter, u8 ElementID, u32 CmdLen, u8 
*pCmdBuffer);
 
 #endif
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 7f4a52c..7674087 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -1223,6 +1223,63 @@ static int cfg80211_rtw_set_default_key(struct wiphy 
*wiphy,
return 0;
 }
 
+static u16 rtw_get_cur_max_rate(struct rtw_adapter *adapter)
+{
+   int i = 0;
+   const u8 *p;
+   u16 rate = 0, max_rate = 0;
+   struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
+   struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
+   struct registry_priv *pregistrypriv = &adapter->registrypriv;
+   struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
+   struct wlan_bssid_ex  *pcur_bss = &pmlmepriv->cur_network.network;
+   struct ieee80211_ht_cap *pht_capie;
+   u8 rf_type = 0;
+   u8 bw_40MHz = 0, short_GI_20 = 0, short_GI_40 = 0;
+   u16 mcs_rate = 0;
+
+   p =

[PATCH 59/76] staging: rtl8723au: rtw_do_join23a(): Use __func__ to get function name in debug messages

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ioctl_set.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
index d2ed9d1..f3dd995 100644
--- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
@@ -35,8 +35,7 @@ int rtw_do_join23a(struct rtw_adapter *padapter)
plist = phead->next;
 
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
-("\n rtw_do_join23a: phead = %p; plist = %p\n\n\n",
- phead, plist));
+("%s: phead = %p; plist = %p\n\n\n", __func__, phead, plist));
 
pmlmepriv->cur_network.join_res = -2;
 
@@ -55,8 +54,8 @@ int rtw_do_join23a(struct rtw_adapter *padapter)
if (pmlmepriv->LinkDetectInfo.bBusyTraffic == false ||
padapter->mlmepriv.to_roaming > 0) {
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
-("rtw_do_join23a(): site survey if 
scanned_queue "
- "is empty\n."));
+("%s: site survey if scanned_queue is empty\n",
+__func__));
/*  submit site_survey23a_cmd */
ret = rtw_sitesurvey_cmd23a(padapter,
 &pmlmepriv->assoc_ssid, 1,
@@ -64,8 +63,8 @@ int rtw_do_join23a(struct rtw_adapter *padapter)
if (ret != _SUCCESS) {
pmlmepriv->to_join = false;
RT_TRACE(_module_rtl871x_ioctl_set_c_, 
_drv_err_,
-("rtw_do_join23a(): site survey return 
"
- "error\n."));
+("%s: site survey return error\n",
+__func__));
}
} else {
pmlmepriv->to_join = false;
@@ -134,7 +133,7 @@ int rtw_do_join23a(struct rtw_adapter *padapter)
ret = rtw_sitesurvey_cmd23a(padapter, 
&pmlmepriv->assoc_ssid, 1, NULL, 0);
if (ret != _SUCCESS) {
pmlmepriv->to_join = false;
-   
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("do_join(): site survey 
return error\n."));
+   
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("%s: site survey return 
error\n", __func__));
}
} else {
ret = _FAIL;
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 34/76] staging: rtl8723au: rtw_check_bcn_info23a(): Don't search for WPA/WPA2 info twice

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_wlan_util.c | 63 ++
 1 file changed, 25 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
index 17b04c2..5aaff13 100644
--- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
@@ -886,9 +886,8 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
struct wlan_network *cur_network = &Adapter->mlmepriv.cur_network;
struct ieee80211_ht_operation *pht_info;
unsigned short val16;
-   u8 encryp_protocol;
+   u8 crypto, bcn_channel;
int group_cipher = 0, pairwise_cipher = 0, is_8021x = 0, r;
-   u32 bcn_channel;
int pie_len, ie_offset, ssid_len, privacy;
const u8 *p, *ssid;
 
@@ -984,29 +983,23 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
 
p = cfg80211_find_ie(WLAN_EID_RSN, mgmt->u.beacon.variable, pie_len);
if (p && p[1]) {
-   encryp_protocol = ENCRYP_PROTOCOL_WPA2;
-   } else if (cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
-  WLAN_OUI_TYPE_MICROSOFT_WPA,
-  mgmt->u.beacon.variable, pie_len)) {
-   encryp_protocol = ENCRYP_PROTOCOL_WPA;
+   crypto = ENCRYP_PROTOCOL_WPA2;
+   if (p && p[1]) {
+   r = rtw_parse_wpa2_ie23a(p, p[1] + 2, &group_cipher,
+&pairwise_cipher, &is_8021x);
+   if (r == _SUCCESS)
+   RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
+("%s pnetwork->pairwise_cipher: %d, "
+ "pnetwork->group_cipher: %d, is_802x "
+ ": %d\n", __func__, pairwise_cipher,
+ group_cipher, is_8021x));
+   }
} else {
-   if (privacy)
-   encryp_protocol = ENCRYP_PROTOCOL_WEP;
-   else
-   encryp_protocol = ENCRYP_PROTOCOL_OPENSYS;
-   }
-
-   if (cur_network->BcnInfo.encryp_protocol != encryp_protocol) {
-   DBG_8723A("%s(): enctyp is not match, return FAIL\n", __func__);
-   goto _mismatch;
-   }
-
-   if (encryp_protocol == ENCRYP_PROTOCOL_WPA ||
-   encryp_protocol == ENCRYP_PROTOCOL_WPA2) {
p = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
WLAN_OUI_TYPE_MICROSOFT_WPA,
mgmt->u.beacon.variable, pie_len);
-   if (p && p[1] > 0) {
+   if (p && p[1]) {
+   crypto = ENCRYP_PROTOCOL_WPA;
r = rtw_parse_wpa_ie23a(p, p[1] + 2, &group_cipher,
&pairwise_cipher, &is_8021x);
if (r == _SUCCESS)
@@ -1016,25 +1009,19 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
  "%d\n", __func__, pairwise_cipher,
  group_cipher, is_8021x));
} else {
-   p = cfg80211_find_ie(WLAN_EID_RSN,
-mgmt->u.beacon.variable, pie_len);
-
-   if (p && p[1] > 0) {
-   r = rtw_parse_wpa2_ie23a(p, p[1] + 2,
-&group_cipher,
-&pairwise_cipher,
-&is_8021x);
-   if (r == _SUCCESS)
-   RT_TRACE(_module_rtl871x_mlme_c_,
-_drv_info_,
-("%s pnetwork->pairwise_cipher"
- ": %d, pnetwork->group_cipher"
- " is %d, is_802x is %d\n",
- __func__, pairwise_cipher,
- group_cipher, is_8021x));
-   }
+   if (privacy)
+   crypto = ENCRYP_PROTOCOL_WEP;
+   else
+   crypto = ENCRYP_PROTOCOL_OPENSYS;
}
+   }
+
+   if (cur_network->BcnInfo.encryp_protocol != crypto) {
+   DBG_8723A("%s(): encryption mismatch, return FAIL\n", __func__);
+   goto _mismatch;
+   }
 
+   if (crypto == ENCRYP_PROTOCOL_WPA || crypto == ENCRYP_PROTOCOL_WPA2) {
RT_TRACE(_module_rtl871x

[PATCH 46/76] staging: rtl8723au: Fold rtw_set_802_11_authentication_mode23a() into cfg80211_rtw_connect()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ioctl_set.c| 24 ---
 drivers/staging/rtl8723au/include/rtw_ioctl_set.h |  2 --
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 10 +++---
 3 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
index 8d76748..5c3b561 100644
--- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
@@ -343,30 +343,6 @@ exit:
return res;
 }
 
-int rtw_set_802_11_authentication_mode23a(struct rtw_adapter* padapter,
- enum ndis_802_11_auth_mode authmode)
-{
-   struct security_priv *psecuritypriv = &padapter->securitypriv;
-   int res;
-
-   RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
-("set_802_11_auth.mode(): mode =%x\n", authmode));
-
-   psecuritypriv->ndisauthtype = authmode;
-
-   RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
-("rtw_set_802_11_authentication_mode23a:"
- "psecuritypriv->ndisauthtype =%d",
- psecuritypriv->ndisauthtype));
-
-   if (psecuritypriv->ndisauthtype > 3)
-   psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
-
-   res = rtw_set_auth23a(padapter, psecuritypriv);
-
-   return res;
-}
-
 /*
 * rtw_get_cur_max_rate23a -
 * @adapter: pointer to _adapter structure
diff --git a/drivers/staging/rtl8723au/include/rtw_ioctl_set.h 
b/drivers/staging/rtl8723au/include/rtw_ioctl_set.h
index 040543b..bc5805a 100644
--- a/drivers/staging/rtl8723au/include/rtw_ioctl_set.h
+++ b/drivers/staging/rtl8723au/include/rtw_ioctl_set.h
@@ -17,8 +17,6 @@
 
 #include 
 
-int rtw_set_802_11_authentication_mode23a(struct rtw_adapter *pdapter,
- enum ndis_802_11_auth_mode authmode);
 int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter,
  struct cfg80211_ssid *pssid,
  int ssid_max_num);
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 1168e7c..b3b3fdc 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -1987,7 +1987,6 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
int ret = 0;
struct list_head *phead, *plist, *ptmp;
struct wlan_network *pnetwork = NULL;
-   enum ndis_802_11_auth_mode authmode;
struct cfg80211_ssid ndis_ssid;
u8 *dst_ssid;
u8 *src_ssid;
@@ -2198,8 +2197,13 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
goto exit;
}
 
-   authmode = psecuritypriv->ndisauthtype;
-   rtw_set_802_11_authentication_mode23a(padapter, authmode);
+   if (psecuritypriv->ndisauthtype > 3)
+   psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
+
+   if (rtw_set_auth23a(padapter, psecuritypriv) != _SUCCESS) {
+   ret = -EBUSY;
+   goto exit;
+   }
 
/* rtw_set_802_11_encryption_mode(padapter,
   padapter->securitypriv.ndisencryptstatus); */
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 75/76] staging: rtl8723au: Move FillH2CCmd() prototype to rtl8723a_cmd.h where it really belongs

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

As an added bonus, remove the now obsolete rtw_ioctl_set.h

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c  |  1 -
 .../staging/rtl8723au/hal/rtl8723a_bt-coexist.c|  1 -
 drivers/staging/rtl8723au/hal/rtl8723a_cmd.c   |  1 -
 drivers/staging/rtl8723au/include/rtl8723a_cmd.h   |  2 ++
 drivers/staging/rtl8723au/include/rtw_ioctl_set.h  | 22 --
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c  |  1 -
 drivers/staging/rtl8723au/os_dep/mlme_linux.c  |  1 -
 7 files changed, 2 insertions(+), 27 deletions(-)
 delete mode 100644 drivers/staging/rtl8723au/include/rtw_ioctl_set.h

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index e89d019..ab95ef0 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -24,7 +24,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 static struct wlan_network *
diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c 
b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c
index bb86986..9054a98 100644
--- a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c
+++ b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c
@@ -14,7 +14,6 @@
  
**/
 #include 
 #include 
-#include 
 #include 
 
 #define DIS_PS_RX_BCN
diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c 
b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
index e873791..6e1fed2 100644
--- a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
+++ b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
@@ -18,7 +18,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
diff --git a/drivers/staging/rtl8723au/include/rtl8723a_cmd.h 
b/drivers/staging/rtl8723au/include/rtl8723a_cmd.h
index 900bacc..e1ecbd0 100644
--- a/drivers/staging/rtl8723au/include/rtl8723a_cmd.h
+++ b/drivers/staging/rtl8723au/include/rtl8723a_cmd.h
@@ -155,4 +155,6 @@ void rtl8723a_add_rateatid(struct rtw_adapter *padapter, 
u32 bitmap, u8 arg, u8
 
 void CheckFwRsvdPageContent23a(struct rtw_adapter *padapter);
 
+int FillH2CCmd(struct rtw_adapter *padapter, u8 ElementID, u32 CmdLen, u8 
*pCmdBuffer);
+
 #endif
diff --git a/drivers/staging/rtl8723au/include/rtw_ioctl_set.h 
b/drivers/staging/rtl8723au/include/rtw_ioctl_set.h
deleted file mode 100644
index 6c102dc..000
--- a/drivers/staging/rtl8723au/include/rtw_ioctl_set.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- 
**/
-#ifndef __RTW_IOCTL_SET_H_
-#define __RTW_IOCTL_SET_H_
-
-#include 
-
-s32 FillH2CCmd(struct rtw_adapter *padapter, u8 ElementID, u32 CmdLen, u8 
*pCmdBuffer);
-
-#endif
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 7674087..1d7c822 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -16,7 +16,6 @@
 
 #include 
 #include 
-#include 
 #include 
 
 #include "ioctl_cfg80211.h"
diff --git a/drivers/staging/rtl8723au/os_dep/mlme_linux.c 
b/drivers/staging/rtl8723au/os_dep/mlme_linux.c
index ac618fb..ca24369 100644
--- a/drivers/staging/rtl8723au/os_dep/mlme_linux.c
+++ b/drivers/staging/rtl8723au/os_dep/mlme_linux.c
@@ -18,7 +18,6 @@
 #include 
 #include 
 #include 
-#include 
 
 static struct rt_pmkid_list backupPMKIDList[NUM_PMKID_CACHE];
 
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 63/76] staging: rtl8723au: to_join will no be true if _FW_LINKED is set

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index efb2161..06dc897 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -705,6 +705,7 @@ rtw_surveydone_event_callback23a(struct rtw_adapter 
*adapter, const u8 *pbuf)
 {
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
+   int ret;
 
spin_lock_bh(&pmlmepriv->lock);
 
@@ -732,15 +733,13 @@ rtw_surveydone_event_callback23a(struct rtw_adapter 
*adapter, const u8 *pbuf)
 
if (pmlmepriv->to_join == true) {
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
-   if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
-   set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
+   set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
 
-   if (rtw_select_and_join_from_scanned_queue23a(
-   pmlmepriv) != _SUCCESS)
-   rtw_do_join_adhoc(adapter);
-   }
+   ret = rtw_select_and_join_from_scanned_queue23a(
+   pmlmepriv);
+   if (ret != _SUCCESS)
+   rtw_do_join_adhoc(adapter);
} else {
-   int ret;
set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
pmlmepriv->to_join = false;
ret = rtw_select_and_join_from_scanned_queue23a(
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 44/76] staging: rtl8723au: Make rtw_is_same_ibss23a() return bool

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ioctl_set.c | 44 --
 drivers/staging/rtl8723au/core/rtw_mlme.c  |  6 ++--
 drivers/staging/rtl8723au/include/rtw_mlme.h   |  4 +--
 3 files changed, 33 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
index 1d2ea4e..8d76748 100644
--- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
@@ -188,26 +188,38 @@ int rtw_set_802_11_ssid23a(struct rtw_adapter* padapter,
!memcmp(&pmlmepriv->assoc_ssid.ssid, ssid->ssid,
ssid->ssid_len)) {
if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
-   RT_TRACE(_module_rtl871x_ioctl_set_c_, 
_drv_err_,
-("Set SSID is the same ssid, fw_state 
= 0x%08x\n",
- get_fwstate(pmlmepriv)));
+   RT_TRACE(_module_rtl871x_ioctl_set_c_,
+_drv_err_, ("New SSID is same SSID, "
+"fw_state = 0x%08x\n",
+get_fwstate(pmlmepriv)));
+
+   if (rtw_is_same_ibss23a(padapter, pnetwork)) {
+   /*
+* it means driver is in
+* WIFI_ADHOC_MASTER_STATE, we needn't
+* create bss again.
+*/
+   goto release_mlme_lock;
+   }
 
-   if (rtw_is_same_ibss23a(padapter, pnetwork) == 
false)
-   {
-   /* if in WIFI_ADHOC_MASTER_STATE | 
WIFI_ADHOC_STATE, create bss or rejoin again */
-   rtw_disassoc_cmd23a(padapter, 0, true);
+   /*
+* if in WIFI_ADHOC_MASTER_STATE |
+* WIFI_ADHOC_STATE, create bss or
+* rejoin again
+*/
+   rtw_disassoc_cmd23a(padapter, 0, true);
 
-   if (check_fwstate(pmlmepriv, 
_FW_LINKED))
-   
rtw_indicate_disconnect23a(padapter);
+   if (check_fwstate(pmlmepriv, _FW_LINKED))
+   rtw_indicate_disconnect23a(padapter);
 
-   rtw_free_assoc_resources23a(padapter, 
1);
+   rtw_free_assoc_resources23a(padapter, 1);
 
-   if (check_fwstate(pmlmepriv, 
WIFI_ADHOC_MASTER_STATE)) {
-   _clr_fwstate_(pmlmepriv, 
WIFI_ADHOC_MASTER_STATE);
-   set_fwstate(pmlmepriv, 
WIFI_ADHOC_STATE);
-   }
-   } else {
-   goto release_mlme_lock;/* it means 
driver is in WIFI_ADHOC_MASTER_STATE, we needn't create bss again. */
+   if (check_fwstate(pmlmepriv,
+ WIFI_ADHOC_MASTER_STATE)) {
+   _clr_fwstate_(pmlmepriv,
+ WIFI_ADHOC_MASTER_STATE);
+   set_fwstate(pmlmepriv,
+   WIFI_ADHOC_STATE);
}
} else {
rtw_lps_ctrl_wk_cmd23a(padapter, 
LPS_CTRL_JOINBSS, 1);
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index bcc6893..2a0c43a 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -334,10 +334,10 @@ static void rtw_free_network_nolock(struct mlme_priv 
*pmlmepriv,
_rtw_free_network23a(pmlmepriv, pnetwork);
 }
 
-int rtw_is_same_ibss23a(struct rtw_adapter *adapter,
-   struct wlan_network *pnetwork)
+bool rtw_is_same_ibss23a(struct rtw_adapter *adapter,
+struct wlan_network *pnetwork)
 {
-   int ret = true;
+   int ret;
struct security_priv *psecuritypriv = &adapter->securitypriv;
 
if (psecuritypriv->dot11PrivacyAlgrthm != 0 &&
diff --git a/drivers/staging/rtl8723au/include/rtw_mlme.h 
b/drivers/staging/rtl8723au/include/rtw_mlme.h
index baac8da..c8e82bf 100644
--- a/drivers/staging/rtl8723au/in

[PATCH 65/76] staging: rtl8723au: rtw_select_and_join_from_scanned_queue23a() never returns 2

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index d2b38f7..1557088 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -742,10 +742,7 @@ rtw_surveydone_event_callback23a(struct rtw_adapter 
*adapter, const u8 *pbuf)
pmlmepriv->to_join = false;
ret = rtw_select_and_join_from_scanned_queue23a(
pmlmepriv);
-   if (ret == 2) {/* there is no need to wait */
-   _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
-   rtw_indicate_connect23a(adapter);
-   } else if (ret != _SUCCESS) {
+   if (ret != _SUCCESS) {
DBG_8723A("try_to_join, but select scanning "
  "queue fail, to_roaming:%d\n",
  adapter->mlmepriv.to_roaming);
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 74/76] staging: rtl8723au: Quiet unused variable warning when building with CONFIG_8723AU_AP_MODE=n

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index 59047ad..0d52699 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -2931,7 +2931,6 @@ static void issue_auth(struct rtw_adapter *padapter, 
struct sta_info *psta,
unsigned char *pframe;
struct ieee80211_mgmt *mgmt;
unsigned int val32;
-   unsigned short val16;
u16 auth_algo;
int use_shared_key = 0;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@@ -2960,6 +2959,7 @@ static void issue_auth(struct rtw_adapter *padapter, 
struct sta_info *psta,
 
if (psta) { /*  for AP mode */
 #ifdef CONFIG_8723AU_AP_MODE
+   unsigned short val16;
ether_addr_copy(mgmt->da, psta->hwaddr);
ether_addr_copy(mgmt->sa, myid(&padapter->eeprompriv));
ether_addr_copy(mgmt->bssid, myid(&padapter->eeprompriv));
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 61/76] staging: rtl8723au: Consolidate duplicate adhoc joining code into rtw_do_join_adhoc()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ioctl_set.c | 40 +--
 drivers/staging/rtl8723au/core/rtw_mlme.c  | 93 ++
 drivers/staging/rtl8723au/include/rtw_mlme.h   |  1 +
 3 files changed, 41 insertions(+), 93 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
index f3dd995..a994893e 100644
--- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
@@ -25,7 +25,6 @@
 int rtw_do_join23a(struct rtw_adapter *padapter)
 {
struct list_head *plist, *phead;
-   u8* pibss = NULL;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct rtw_queue *queue = &pmlmepriv->scanned_queue;
int ret = _SUCCESS;
@@ -80,43 +79,10 @@ int rtw_do_join23a(struct rtw_adapter *padapter)
pmlmepriv->to_join = false;
} else {
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
-   struct wlan_bssid_ex *pdev_network;
-   /*  submit createbss_cmd to change to a
-   ADHOC_MASTER */
-
-   /* pmlmepriv->lock has been acquired by
-  caller... */
-   pdev_network =
-   &padapter->registrypriv.dev_network;
-
-   pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE;
-
-   pibss = 
padapter->registrypriv.dev_network.MacAddress;
-
-   memcpy(&pdev_network->Ssid,
-  &pmlmepriv->assoc_ssid,
-  sizeof(struct cfg80211_ssid));
-
-   
rtw_update_registrypriv_dev_network23a(padapter);
-
-   rtw_generate_random_ibss23a(pibss);
-
-   if (rtw_createbss_cmd23a(padapter) != _SUCCESS) 
{
-   RT_TRACE(_module_rtl871x_ioctl_set_c_,
-_drv_err_,
-("***Error =>do_goin: 
rtw_creat"
- "ebss_cmd status FAIL***\n"));
-   ret = _FAIL;
+   /* switch to ADHOC_MASTER */
+   ret = rtw_do_join_adhoc(padapter);
+   if (ret != _SUCCESS)
goto exit;
-   }
-
-   pmlmepriv->to_join = false;
-
-   RT_TRACE(_module_rtl871x_ioctl_set_c_,
-_drv_info_,
-("***Error => rtw_select_and_join_from"
- "_scanned_queue FAIL under STA_Mode"
- "***\n "));
} else {
/*  can't associate ; reset under-linking */
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 77a0a4a..81693c1 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -705,8 +705,6 @@ rtw_surveydone_event_callback23a(struct rtw_adapter 
*adapter, const u8 *pbuf)
 {
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
-   struct wlan_bssid_ex *pdev_network;
-   u8 *pibss;
 
spin_lock_bh(&pmlmepriv->lock);
 
@@ -738,39 +736,8 @@ rtw_surveydone_event_callback23a(struct rtw_adapter 
*adapter, const u8 *pbuf)
set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
 
if (rtw_select_and_join_from_scanned_queue23a(
-   pmlmepriv) == _SUCCESS) {
-   } else {
-   pdev_network = 
&adapter->registrypriv.dev_network;
-   pibss = 
adapter->registrypriv.dev_network.MacAddress;
-
-   _clr_fwstate_(pmlmepriv,
- _FW_UNDER_SURVEY);
-
-   RT_TRACE(_module_rtl871x_mlme_c_,
-_drv_err_,
-("switching to adhoc "
- "master\n"));
-
-   memcpy(&pdev_network->Ssid,
-  &pmlmepriv->assoc_ssid,
-   

[PATCH 33/76] staging: rtl8723au: rtw_check_bcn_info23a(): Don't make a local copy of beacon just to parse it

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

In addition be consistent with return values and parsing them.

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c  |  2 +-
 drivers/staging/rtl8723au/core/rtw_wlan_util.c | 88 +-
 2 files changed, 32 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index ff0800e..693a1a4 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -857,7 +857,7 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame 
*precv_frame)
psta = rtw_get_stainfo23a(pstapriv, mgmt->sa);
if (psta) {
ret = rtw_check_bcn_info23a(padapter, mgmt, pkt_len);
-   if (!ret) {
+   if (ret != _SUCCESS) {
DBG_8723A_LEVEL(_drv_always_, "ap has changed, "
"disconnect now\n");
receive_disconnect23a(padapter, 
pmlmeinfo->network.MacAddress, 65535);
diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
index a2c249f..17b04c2 100644
--- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
@@ -885,28 +885,19 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
 {
struct wlan_network *cur_network = &Adapter->mlmepriv.cur_network;
struct ieee80211_ht_operation *pht_info;
-   struct wlan_bssid_ex *bssid;
unsigned short val16;
u8 encryp_protocol;
int group_cipher = 0, pairwise_cipher = 0, is_8021x = 0, r;
u32 bcn_channel;
-   int len, pie_len, ie_offset;
-   const u8 *p;
-   u8 *pie;
+   int pie_len, ie_offset, ssid_len, privacy;
+   const u8 *p, *ssid;
 
if (is_client_associated_to_ap23a(Adapter) == false)
-   return true;
+   return _SUCCESS;
 
if (unlikely(!ieee80211_is_beacon(mgmt->frame_control))) {
printk(KERN_WARNING "%s: received a non beacon frame!\n",
   __func__);
-   return false;
-   }
-
-   len = pkt_len - sizeof(struct ieee80211_hdr_3addr);
-
-   if (len > MAX_IE_SZ) {
-   DBG_8723A("%s IE too long for survey event\n", __func__);
return _FAIL;
}
 
@@ -914,36 +905,25 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
DBG_8723A("%s: linked but recv other bssid bcn"
  MAC_FMT MAC_FMT "\n", __func__, MAC_ARG(mgmt->bssid),
  MAC_ARG(cur_network->network.MacAddress));
-   return true;
-   }
-
-   bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC);
-   if (!bssid)
return _FAIL;
-
-   bssid->reserved = 1;
-
-   bssid->Length = offsetof(struct wlan_bssid_ex, IEs) + len;
-
-   /* below is to copy the information element */
-   bssid->IELength = len;
-   memcpy(bssid->IEs, &mgmt->u, len);
+   }
 
/* check bw and channel offset */
/* parsing HT_CAP_IE */
ie_offset = offsetof(struct ieee80211_mgmt, u.beacon.variable) -
offsetof(struct ieee80211_mgmt, u);
-   pie = bssid->IEs + ie_offset;
-   pie_len = pkt_len - ie_offset;
+   pie_len = pkt_len - offsetof(struct ieee80211_mgmt, u.beacon.variable);
 
/* Checking for channel */
-   p = cfg80211_find_ie(WLAN_EID_DS_PARAMS, pie, pie_len);
+   p = cfg80211_find_ie(WLAN_EID_DS_PARAMS, mgmt->u.beacon.variable,
+pie_len);
if (p)
bcn_channel = p[2];
else {
/* In 5G, some ap do not have DSSET IE checking HT
   info for channel */
-   p = cfg80211_find_ie(WLAN_EID_HT_OPERATION, pie, pie_len);
+   p = cfg80211_find_ie(WLAN_EID_HT_OPERATION,
+mgmt->u.beacon.variable, pie_len);
 
if (p && p[1] > 0) {
pht_info = (struct ieee80211_ht_operation *)(p + 2);
@@ -962,60 +942,55 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
}
 
/* checking SSID */
-   p = cfg80211_find_ie(WLAN_EID_SSID, pie, pie_len);
+   p = cfg80211_find_ie(WLAN_EID_SSID, mgmt->u.beacon.variable, pie_len);
if (p && p[1]) {
-   memcpy(bssid->Ssid.ssid, p + 2, p[1]);
-   bssid->Ssid.ssid_len = p[1];
+   ssid = p + 2;
+   ssid_len = p[1];
} else {
DBG_8723A("%s marc: cannot find SSID for survey event\n",
  __func__);
-   bssid->Ssid.ssid_len = 0;
-   bssid->Ssid.ssid[0] = '\0';
+   ssid = NULL;
+   ssid_len = 0;
}
 
RT_TRACE(_mo

[PATCH 47/76] staging: rtl8723au: Move rtw_set_802_11_ssid23a() to ioctl_cfg80211.c

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ioctl_set.c| 135 --
 drivers/staging/rtl8723au/include/rtw_ioctl_set.h |   2 -
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 134 -
 3 files changed, 132 insertions(+), 139 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
index 5c3b561..7b0d3db 100644
--- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
@@ -151,141 +151,6 @@ exit:
return ret;
 }
 
-int rtw_set_802_11_ssid23a(struct rtw_adapter* padapter,
-  struct cfg80211_ssid *ssid)
-{
-   int status = _SUCCESS;
-   u32 cur_time = 0;
-
-   struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-   struct wlan_network *pnetwork = &pmlmepriv->cur_network;
-
-
-
-   DBG_8723A_LEVEL(_drv_always_, "set ssid [%s] fw_state = 0x%08x\n",
-   ssid->ssid, get_fwstate(pmlmepriv));
-
-   if (padapter->hw_init_completed == false) {
-   RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
-("set_ssid: hw_init_completed == false =>exit!!!\n"));
-   status = _FAIL;
-   goto exit;
-   }
-
-   spin_lock_bh(&pmlmepriv->lock);
-
-   DBG_8723A("Set SSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv));
-   if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
-   goto handle_tkip_countermeasure;
-   else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
-   goto release_mlme_lock;
-
-   if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) {
-   RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
-("set_ssid: _FW_LINKED||WIFI_ADHOC_MASTER_STATE\n"));
-
-   if ((pmlmepriv->assoc_ssid.ssid_len == ssid->ssid_len) &&
-   !memcmp(&pmlmepriv->assoc_ssid.ssid, ssid->ssid,
-   ssid->ssid_len)) {
-   if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
-   RT_TRACE(_module_rtl871x_ioctl_set_c_,
-_drv_err_, ("New SSID is same SSID, "
-"fw_state = 0x%08x\n",
-get_fwstate(pmlmepriv)));
-
-   if (rtw_is_same_ibss23a(padapter, pnetwork)) {
-   /*
-* it means driver is in
-* WIFI_ADHOC_MASTER_STATE, we needn't
-* create bss again.
-*/
-   goto release_mlme_lock;
-   }
-
-   /*
-* if in WIFI_ADHOC_MASTER_STATE |
-* WIFI_ADHOC_STATE, create bss or
-* rejoin again
-*/
-   rtw_disassoc_cmd23a(padapter, 0, true);
-
-   if (check_fwstate(pmlmepriv, _FW_LINKED))
-   rtw_indicate_disconnect23a(padapter);
-
-   rtw_free_assoc_resources23a(padapter, 1);
-
-   if (check_fwstate(pmlmepriv,
- WIFI_ADHOC_MASTER_STATE)) {
-   _clr_fwstate_(pmlmepriv,
- WIFI_ADHOC_MASTER_STATE);
-   set_fwstate(pmlmepriv,
-   WIFI_ADHOC_STATE);
-   }
-   } else {
-   rtw_lps_ctrl_wk_cmd23a(padapter, 
LPS_CTRL_JOINBSS, 1);
-   }
-   } else {
-   RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
-("Set SSID not the same ssid\n"));
-   RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
-("set_ssid =[%s] len = 0x%x\n", ssid->ssid,
- (unsigned int)ssid->ssid_len));
-   RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
-("assoc_ssid =[%s] len = 0x%x\n",
- pmlmepriv->assoc_ssid.ssid,
- (unsigned 
int)pmlmepriv->assoc_ssid.ssid_len));
-
-   rtw_disassoc_cmd23a(padapter, 0, true);
-
-   if (check_fwstate(pmlmepriv, _FW_LINKED))
-   rtw_indicate_disconnect23a(padapter);
-
-   r

[PATCH 62/76] staging: rtl8723au: Remove no-op rtw_get_encrypt_decrypt_from_registrypriv23a()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c| 7 ---
 drivers/staging/rtl8723au/include/rtw_mlme.h | 2 --
 2 files changed, 9 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 81693c1..efb2161 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -1151,8 +1151,6 @@ void rtw_joinbss_event_prehandle23a(struct rtw_adapter 
*adapter, u8 *pbuf)
 ("joinbss event call back received with res=%d\n",
  pnetwork->join_res));
 
-   rtw_get_encrypt_decrypt_from_registrypriv23a(adapter);
-
if (pmlmepriv->assoc_ssid.ssid_len == 0) {
RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,
 ("@   joinbss event call back  for Any SSid\n"));
@@ -2155,11 +2153,6 @@ void rtw_update_registrypriv_dev_network23a(struct 
rtw_adapter* adapter)
/* pdev_network->IELength = cpu_to_le32(sz); */
 }
 
-void rtw_get_encrypt_decrypt_from_registrypriv23a(struct rtw_adapter* adapter)
-{
-
-}
-
 /* the fucntion is at passive_level */
 void rtw_joinbss_reset23a(struct rtw_adapter *padapter)
 {
diff --git a/drivers/staging/rtl8723au/include/rtw_mlme.h 
b/drivers/staging/rtl8723au/include/rtw_mlme.h
index 79c3b3d..bc420ec 100644
--- a/drivers/staging/rtl8723au/include/rtw_mlme.h
+++ b/drivers/staging/rtl8723au/include/rtw_mlme.h
@@ -331,8 +331,6 @@ void rtw_init_registrypriv_dev_network23a(struct 
rtw_adapter *adapter);
 
 void rtw_update_registrypriv_dev_network23a(struct rtw_adapter *adapter);
 
-void rtw_get_encrypt_decrypt_from_registrypriv23a(struct rtw_adapter *adapter);
-
 void rtw_scan_timeout_handler23a(unsigned long data);
 
 void rtw_dynamic_check_timer_handler(unsigned long data);
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 49/76] staging: rtl8723au: cfg80211_rtw_connect(): Remove obfuscating pointers

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

dst_ssid and dst_bssid were just obfuscating that we were in fact
looking at pnetwork.

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 1de7e9e..c959adb 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -2118,8 +2118,6 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
struct list_head *phead, *plist, *ptmp;
struct wlan_network *pnetwork = NULL;
struct cfg80211_ssid ssid;
-   u8 *dst_ssid;
-   u8 *dst_bssid;
/* u8 matched_by_bssid = false; */
/* u8 matched_by_ssid = false; */
u8 matched = false;
@@ -2172,9 +2170,6 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
list_for_each_safe(plist, ptmp, phead) {
pnetwork = container_of(plist, struct wlan_network, list);
 
-   dst_ssid = pnetwork->network.Ssid.ssid;
-   dst_bssid = pnetwork->network.MacAddress;
-
if (sme->bssid) {
if (!ether_addr_equal(pnetwork->network.MacAddress,
  sme->bssid))
@@ -2189,7 +2184,8 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
}
 
if (sme->bssid) {
-   if (ether_addr_equal(dst_bssid, sme->bssid)) {
+   if (ether_addr_equal(pnetwork->network.MacAddress,
+sme->bssid)) {
DBG_8723A("matched by bssid\n");
 
memcpy(ssid.ssid, pnetwork->network.Ssid.ssid,
@@ -2200,7 +2196,8 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
break;
}
} else if (sme->ssid && sme->ssid_len) {
-   if (!memcmp(dst_ssid, sme->ssid, sme->ssid_len) &&
+   if (!memcmp(pnetwork->network.Ssid.ssid,
+   sme->ssid, sme->ssid_len) &&
pnetwork->network.Ssid.ssid_len == sme->ssid_len) {
DBG_8723A("matched by ssid\n");
 
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 70/76] staging: rtl8723au: rtw_get_cur_max_rate23a(): We are in N mode if WLAN_EID_HT_CAPABILITY is present

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_ioctl_set.c | 63 --
 1 file changed, 29 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
index 481f94c..e2c40a6 100644
--- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c
@@ -100,41 +100,36 @@ u16 rtw_get_cur_max_rate23a(struct rtw_adapter *adapter)
u8 bw_40MHz = 0, short_GI_20 = 0, short_GI_40 = 0;
u16 mcs_rate = 0;
 
-   if (pmlmeext->cur_wireless_mode & (WIRELESS_11_24N|WIRELESS_11_5N)) {
-   p = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY,
-&pcur_bss->IEs[12],
-pcur_bss->IELength - 12);
-   if (p && p[1] > 0) {
-   pht_capie = (struct ieee80211_ht_cap *)(p + 2);
-
-   memcpy(&mcs_rate, &pht_capie->mcs, 2);
-
-   /* bw_40MHz = (pht_capie->cap_info&
-  IEEE80211_HT_CAP_SUP_WIDTH_20_40) ? 1:0; */
-   /* cur_bwmod is updated by beacon, pmlmeinfo is
-  updated by association response */
-   bw_40MHz = (pmlmeext->cur_bwmode &&
-   (pmlmeinfo->HT_info.ht_param &
-IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) ? 1:0;
-
-   /* short_GI = (pht_capie->cap_info & (IEEE80211_HT_CAP
-  _SGI_20|IEEE80211_HT_CAP_SGI_40)) ? 1 : 0; */
-   short_GI_20 =
-   (pmlmeinfo->ht_cap.cap_info &
-cpu_to_le16(IEEE80211_HT_CAP_SGI_20)) ? 1:0;
-   short_GI_40 =
-   (pmlmeinfo->ht_cap.cap_info &
-cpu_to_le16(IEEE80211_HT_CAP_SGI_40)) ? 1:0;
-
-   rf_type = rtl8723a_get_rf_type(adapter);
-   max_rate = rtw_mcs_rate23a(rf_type, bw_40MHz &
-   pregistrypriv->cbw40_enable,
-   short_GI_20, short_GI_40,
-   &pmlmeinfo->ht_cap.mcs);
-   }
+   p = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, &pcur_bss->IEs[12],
+pcur_bss->IELength - 12);
+   if (p && p[1] > 0) {
+   pht_capie = (struct ieee80211_ht_cap *)(p + 2);
+
+   memcpy(&mcs_rate, &pht_capie->mcs, 2);
+
+   /* bw_40MHz = (pht_capie->cap_info&
+  IEEE80211_HT_CAP_SUP_WIDTH_20_40) ? 1:0; */
+   /* cur_bwmod is updated by beacon, pmlmeinfo is
+  updated by association response */
+   bw_40MHz = (pmlmeext->cur_bwmode &&
+   (pmlmeinfo->HT_info.ht_param &
+IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) ? 1:0;
+
+   /* short_GI = (pht_capie->cap_info & (IEEE80211_HT_CAP
+  _SGI_20|IEEE80211_HT_CAP_SGI_40)) ? 1 : 0; */
+   short_GI_20 = (pmlmeinfo->ht_cap.cap_info &
+  cpu_to_le16(IEEE80211_HT_CAP_SGI_20)) ? 1:0;
+   short_GI_40 = (pmlmeinfo->ht_cap.cap_info &
+  cpu_to_le16(IEEE80211_HT_CAP_SGI_40)) ? 1:0;
+
+   rf_type = rtl8723a_get_rf_type(adapter);
+   max_rate = rtw_mcs_rate23a(rf_type, bw_40MHz &
+  pregistrypriv->cbw40_enable,
+  short_GI_20, short_GI_40,
+  &pmlmeinfo->ht_cap.mcs);
} else {
-   while ((pcur_bss->SupportedRates[i] != 0) &&
-  (pcur_bss->SupportedRates[i] != 0xFF)) {
+   while (pcur_bss->SupportedRates[i] != 0 &&
+  pcur_bss->SupportedRates[i] != 0xFF) {
rate = pcur_bss->SupportedRates[i] & 0x7F;
if (rate>max_rate)
max_rate = rate;
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 35/76] staging: rtl8723au: Declare rtw_update_scanned_network() static

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c| 6 +++---
 drivers/staging/rtl8723au/include/rtw_mlme.h | 2 --
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 4a33e7d..44a5249 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -487,8 +487,8 @@ static void update_current_network(struct rtw_adapter 
*adapter,
 Caller must hold pmlmepriv->lock first.
 
 */
-void rtw_update_scanned_network23a(struct rtw_adapter *adapter,
-  struct wlan_bssid_ex *target)
+static void rtw_update_scanned_network(struct rtw_adapter *adapter,
+  struct wlan_bssid_ex *target)
 {
struct list_head *plist, *phead;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
@@ -571,7 +571,7 @@ static void rtw_add_network(struct rtw_adapter *adapter,
struct wlan_bssid_ex *pnetwork)
 {
update_current_network(adapter, pnetwork);
-   rtw_update_scanned_network23a(adapter, pnetwork);
+   rtw_update_scanned_network(adapter, pnetwork);
 }
 
 /* select the desired network based on the capability of the (i)bss. */
diff --git a/drivers/staging/rtl8723au/include/rtw_mlme.h 
b/drivers/staging/rtl8723au/include/rtw_mlme.h
index a11b5bd..baac8da 100644
--- a/drivers/staging/rtl8723au/include/rtw_mlme.h
+++ b/drivers/staging/rtl8723au/include/rtw_mlme.h
@@ -308,8 +308,6 @@ static inline void clr_fwstate_ex(struct mlme_priv 
*pmlmepriv, int state)
 }
 
 u16 rtw_get_capability23a(struct wlan_bssid_ex *bss);
-void rtw_update_scanned_network23a(struct rtw_adapter *adapter,
-   struct wlan_bssid_ex *target);
 void rtw_disconnect_hdl23a_under_linked(struct rtw_adapter *adapter,
 struct sta_info *psta, u8 free_assoc);
 void rtw_generate_random_ibss23a(u8 *pibss);
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 51/76] staging: rtl8723au: Pass a struct wlan_network to rtw_set_ssid()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

There is no point copying the ssid out of struct wlan_network when we
can just pass on the whole struct.

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 32 +++
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index ea03d4f..2cb2c7e 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -1981,8 +1981,8 @@ exit:
return res;
 }
 
-static int rtw_set_ssid(struct rtw_adapter* padapter,
-   struct cfg80211_ssid *ssid)
+static int rtw_set_ssid(struct rtw_adapter *padapter,
+   struct wlan_network *newnetwork)
 {
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_network *pnetwork = &pmlmepriv->cur_network;
@@ -1990,7 +1990,7 @@ static int rtw_set_ssid(struct rtw_adapter* padapter,
u32 cur_time = 0;
 
DBG_8723A_LEVEL(_drv_always_, "set ssid [%s] fw_state = 0x%08x\n",
-   ssid->ssid, get_fwstate(pmlmepriv));
+   newnetwork->network.Ssid.ssid, get_fwstate(pmlmepriv));
 
if (padapter->hw_init_completed == false) {
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
@@ -2011,9 +2011,11 @@ static int rtw_set_ssid(struct rtw_adapter* padapter,
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
 ("set_ssid: _FW_LINKED||WIFI_ADHOC_MASTER_STATE\n"));
 
-   if (pmlmepriv->assoc_ssid.ssid_len == ssid->ssid_len &&
-   !memcmp(&pmlmepriv->assoc_ssid.ssid, ssid->ssid,
-   ssid->ssid_len)) {
+   if (pmlmepriv->assoc_ssid.ssid_len ==
+   newnetwork->network.Ssid.ssid_len &&
+   !memcmp(&pmlmepriv->assoc_ssid.ssid,
+   newnetwork->network.Ssid.ssid,
+   newnetwork->network.Ssid.ssid_len)) {
if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
RT_TRACE(_module_rtl871x_ioctl_set_c_,
 _drv_err_, ("New SSID is same SSID, "
@@ -2056,8 +2058,9 @@ static int rtw_set_ssid(struct rtw_adapter* padapter,
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
 ("Set SSID not the same ssid\n"));
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
-("set_ssid =[%s] len = 0x%x\n", ssid->ssid,
- ssid->ssid_len));
+("set_ssid =[%s] len = 0x%x\n",
+ newnetwork->network.Ssid.ssid,
+ newnetwork->network.Ssid.ssid_len));
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
 ("assoc_ssid =[%s] len = 0x%x\n",
  pmlmepriv->assoc_ssid.ssid,
@@ -2093,7 +2096,9 @@ handle_tkip_countermeasure:
}
}
 
-   memcpy(&pmlmepriv->assoc_ssid, ssid, sizeof(struct cfg80211_ssid));
+   memcpy(&pmlmepriv->assoc_ssid, &newnetwork->network.Ssid,
+  sizeof(struct cfg80211_ssid));
+
pmlmepriv->assoc_by_bssid = false;
 
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
@@ -2117,7 +2122,6 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
int ret = 0;
struct list_head *phead, *plist, *ptmp;
struct wlan_network *pnetwork = NULL;
-   struct cfg80211_ssid ssid;
/* u8 matched_by_bssid = false; */
/* u8 matched_by_ssid = false; */
u8 matched = false;
@@ -2161,8 +2165,6 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
rtw_scan_abort23a(padapter);
}
 
-   memset(ssid.ssid, 0, sizeof(struct cfg80211_ssid));
-
spin_lock_bh(&queue->lock);
 
phead = get_list_head(queue);
@@ -2315,11 +2317,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, 
struct net_device *ndev,
/* rtw_set_802_11_encryption_mode(padapter,
   padapter->securitypriv.ndisencryptstatus); */
 
-   memcpy(ssid.ssid, pnetwork->network.Ssid.ssid,
-  pnetwork->network.Ssid.ssid_len);
-   ssid.ssid_len = pnetwork->network.Ssid.ssid_len;
-
-   if (rtw_set_ssid(padapter, &ssid) != _SUCCESS) {
+   if (rtw_set_ssid(padapter, pnetwork) != _SUCCESS) {
ret = -EBUSY;
goto exit;
}
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 57/76] staging: rtl8723au: Introduce rtw_select_candidate_from_queue()

2014-06-09 Thread Jes . Sorensen
From: Jes Sorensen 

This splits a portion of rtw_select_and_join_from_scanned_queue23a()
into rtw_select_candidate_from_queue()

Signed-off-by: Jes Sorensen 
---
 drivers/staging/rtl8723au/core/rtw_mlme.c | 31 +--
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c 
b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 31cf1ac..9248f48 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -27,6 +27,9 @@
 #include 
 #include 
 
+static struct wlan_network *
+rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv);
+
 static void rtw_init_mlme_timer(struct rtw_adapter *padapter)
 {
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -1754,18 +1757,15 @@ pmlmepriv->lock
 
 */
 
-int rtw_select_and_join_from_scanned_queue23a(struct mlme_priv *pmlmepriv)
+static struct wlan_network *
+rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv)
 {
-   int ret;
-   struct list_head *phead, *plist, *ptmp;
-   struct rtw_adapter *adapter;
+   struct wlan_network *pnetwork, *candidate = NULL;
struct rtw_queue *queue = &pmlmepriv->scanned_queue;
-   struct wlan_network *pnetwork;
-   struct wlan_network *candidate = NULL;
+   struct list_head *phead, *plist, *ptmp;
 
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
phead = get_list_head(queue);
-   adapter = pmlmepriv->nic_hdl;
 
list_for_each_safe(plist, ptmp, phead) {
pnetwork = container_of(plist, struct wlan_network, list);
@@ -1773,13 +1773,26 @@ int rtw_select_and_join_from_scanned_queue23a(struct 
mlme_priv *pmlmepriv)
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
 ("%s: return _FAIL:(pnetwork == NULL)\n",
  __func__));
-   ret = _FAIL;
goto exit;
}
 
rtw_check_join_candidate(pmlmepriv, &candidate, pnetwork);
}
 
+exit:
+   spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
+   return candidate;
+}
+
+int rtw_select_and_join_from_scanned_queue23a(struct mlme_priv *pmlmepriv)
+{
+   struct rtw_adapter *adapter;
+   struct wlan_network *candidate = NULL;
+   int ret;
+
+   adapter = pmlmepriv->nic_hdl;
+
+   candidate = rtw_select_candidate_from_queue(pmlmepriv);
if (!candidate) {
DBG_8723A("%s: return _FAIL(candidate == NULL)\n", __func__);
ret = _FAIL;
@@ -1803,8 +1816,6 @@ int rtw_select_and_join_from_scanned_queue23a(struct 
mlme_priv *pmlmepriv)
ret = rtw_joinbss_cmd23a(adapter, candidate);
 
 exit:
-   spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
-
return ret;
 }
 
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-09 Thread Russell King - ARM Linux
On Mon, Jun 09, 2014 at 10:44:14AM -0300, Fabio Estevam wrote:
> Russell,
> 
> On Fri, Jun 6, 2014 at 10:56 AM, Russell King
>  wrote:
> > The initial state at boot is assumed to be disconnected, and we hope
> > to receive an interrupt to update the status.  Let's be more explicit
> > about the current state - reading the PHY status register tells us
> > the current level of the hotplug signal, which we can report back in
> > the _detect() method.
> >
> > Signed-off-by: Russell King 
> 
> I have applied this patch against 3.15 and I still have the following
> issue on a mx6qsabresd:
> 
> If I boot the kernel with the HDMI cable connected, no HDMI image
> comes up. In order to get HDMI working I need to remove and then
> reconnect the cable.
> 
> Still haven't had a chance to debug this though.

Please check the status in /sys/class/drm/card0-HDMI-A-1/status.  This
should report the current state of the hotplug detection.

Remember that this code detects off the HPD signal - if the HPD signal
has not been correctly wired up, this patch is not going to help (really
it comes down to a hardware fault, which I'm not trying to solve with
this patch.)

What I'm trying to resolve with this patch is that the state detected
on properly wired up systems corresponds with the real initial state of
the interface at initialisation time.

The problem with the current code is that we start off assuming that the
interface is disconnected, and we rely on an interrupt arriving to change
that state.  If for whatever reason that interrupt does not arrive, then,
even if the HPD signal is active, we continue believing that the interface
is not connected.

I seem to remember discussion in the past that the HPD signal is not
wired up on SabreSD.  Really, this needs to be a DT flag to indicate
that the connectivity on the platform is not correct, and we should
fallback to using RXSENSE detection and/or DDC polling (both of which
are sub-standard and incorrect to the HDMI spec.)

I'd suggest a standard HDMI interface property like:

hotplug-detect = "hpd" | "rxsense" | "ddc"

defaulting to the standard hpd method.

As I've said in the past, my problem with just going with DDC polling
for everything is that the connected HDMI sink is permitted to update
the EDID EEPROM (when it does, it is required to lower and re-raise the
HPD signal.)  If we are polling DDC, we may hit the situation where the
EDID EEPROM is mid-update and possibly end up with corrupted data (though
there's a checksum to save us from this.)

While I2C is multi-master, we're talking about consumer stuff here, and
I bet I2C arbitration on the DDC bus is not something that is tested.
I would not be surprised if the assumption is made that when HPD is
lowered, the HDMI sink has exclusive access to the EEPROM and doesn't
need to be concerned with arbitration.

RXSENSE has the problem that it doesn't detect EDID updates (there's no
requirement for a HDMI sink to make RXSENSE on a source go inactive
across an EDID update.)

So, I would much rather go by the spec, using the HPD signal on devices
where that signal is correctly wired, and only fall back to other methods
(which cause us to go against the standard) where the hardware is buggy.

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: bcm: nvm.c: Cleaning up a array that is filled incompletely

2014-06-09 Thread Dan Carpenter
On Sun, Jun 08, 2014 at 11:45:28PM +0200, Rickard Strandqvist wrote:
> Array 'SigBuff' is filled incompletely.
> Someone forget to multiply for the sizeof type.
> 
> This was partly found using a static code analysis program called cppcheck.
> 

I took a look at code which uses MAX_RW_SIZE and it's really confused
about whether it is in bytes or number of ints.

This code is a real mess.  For example, look at the call to:

WriteToFlashWithoutSectorErase(Adapter,
   SigBuff,
   eISOWritePart,
   sigOffset,
   MAX_RW_SIZE);

If you look at it, that function says it takes int pointers but really
I think it wants u8 pointers.

I think this is the real fix here, to change
WriteToFlashWithoutSectorErase() to take char pointers and then make the
SigBuff buffer an array of u8.

I think this is the correct way to fix this code, but this driver is
very horrible so I could be wrong.  Please check.

regards,
dan carpenter

PS: These days I add everything to the TODO so we don't forget about it.

TODO-list: 2014-06-09: bcm: make SigBuff in BcmCopyISO() an array of u8.


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-09 Thread Fabio Estevam
On Mon, Jun 9, 2014 at 11:06 AM, Russell King - ARM Linux
 wrote:

> Please check the status in /sys/class/drm/card0-HDMI-A-1/status.  This
> should report the current state of the hotplug detection.

/sys/class/drm/card0-HDMI-A-1/status returns the correct state for
HDMI cable connection.

> Remember that this code detects off the HPD signal - if the HPD signal
> has not been correctly wired up, this patch is not going to help (really
> it comes down to a hardware fault, which I'm not trying to solve with
> this patch.)
>
> What I'm trying to resolve with this patch is that the state detected
> on properly wired up systems corresponds with the real initial state of
> the interface at initialisation time.
>
> The problem with the current code is that we start off assuming that the
> interface is disconnected, and we rely on an interrupt arriving to change
> that state.  If for whatever reason that interrupt does not arrive, then,
> even if the HPD signal is active, we continue believing that the interface
> is not connected.
>
> I seem to remember discussion in the past that the HPD signal is not
> wired up on SabreSD.  Really, this needs to be a DT flag to indicate

It is sabrelite board that does not have HPD signal not wired up.

sabresd does have HPD signal connected.

The HDMI undetected issue I am seeing on sabresd seems to be related
to the simultaneous usage of HDMI and LVDS.

If I remove the ldb node from the imx6qdl-sabresd.dtsi, then the HDMI
cable is correctly detected and HDMI is shown right after boot.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-09 Thread Shawn Guo
On Mon, Jun 09, 2014 at 11:29:28AM -0300, Fabio Estevam wrote:
> On Mon, Jun 9, 2014 at 11:06 AM, Russell King - ARM Linux
>  wrote:
> 
> > Please check the status in /sys/class/drm/card0-HDMI-A-1/status.  This
> > should report the current state of the hotplug detection.
> 
> /sys/class/drm/card0-HDMI-A-1/status returns the correct state for
> HDMI cable connection.
> 
> > Remember that this code detects off the HPD signal - if the HPD signal
> > has not been correctly wired up, this patch is not going to help (really
> > it comes down to a hardware fault, which I'm not trying to solve with
> > this patch.)
> >
> > What I'm trying to resolve with this patch is that the state detected
> > on properly wired up systems corresponds with the real initial state of
> > the interface at initialisation time.
> >
> > The problem with the current code is that we start off assuming that the
> > interface is disconnected, and we rely on an interrupt arriving to change
> > that state.  If for whatever reason that interrupt does not arrive, then,
> > even if the HPD signal is active, we continue believing that the interface
> > is not connected.
> >
> > I seem to remember discussion in the past that the HPD signal is not
> > wired up on SabreSD.  Really, this needs to be a DT flag to indicate
> 
> It is sabrelite board that does not have HPD signal not wired up.
> 
> sabresd does have HPD signal connected.
> 
> The HDMI undetected issue I am seeing on sabresd seems to be related
> to the simultaneous usage of HDMI and LVDS.
> 
> If I remove the ldb node from the imx6qdl-sabresd.dtsi, then the HDMI
> cable is correctly detected and HDMI is shown right after boot.

This is a known limitation.

http://thread.gmane.org/gmane.linux.ports.arm.kernel/315968/focus=318559

Shawn
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[patch] VME: remove duplicate CA91CX42_DCTL_VDW_M define

2014-06-09 Thread Dan Carpenter
The CA91CX42_DCTL_VDW_M define is cut and pasted twice so we can delete
the second instance.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/vme/bridges/vme_ca91cx42.h 
b/drivers/vme/bridges/vme_ca91cx42.h
index 02a7c79..d46b12d 100644
--- a/drivers/vme/bridges/vme_ca91cx42.h
+++ b/drivers/vme/bridges/vme_ca91cx42.h
@@ -360,7 +360,6 @@ static const int CA91CX42_VSI_TO[] = { VSI0_TO, VSI1_TO, 
VSI2_TO, VSI3_TO,
  */
 #define CA91CX42_DCTL_L2V  (1<<31)
 #define CA91CX42_DCTL_VDW_M(3<<22)
-#define CA91CX42_DCTL_VDW_M(3<<22)
 #define CA91CX42_DCTL_VDW_D8   0
 #define CA91CX42_DCTL_VDW_D16  (1<<22)
 #define CA91CX42_DCTL_VDW_D32  (1<<23)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/76] staging-next: rtl8723au: More fixes for 3.16

2014-06-09 Thread Greg KH
On Mon, Jun 09, 2014 at 03:15:52PM +0200, jes.soren...@redhat.com wrote:
> From: Jes Sorensen 
> 
> Greg,
> 
> Thanks for pushing my other changes to Linus. This set goes on top of
> the set I sent you on 2014/05/31 and the fix from 2014/06/03. If you
> prefer I go back and submit it all as one large set, let me know.
> 
> This set contains a number of fixes, including getting rid of some 'on
> the wire' noise that isn't in the spec, plus removes a bunch of
> functionality which is handled by the 802.11 stack, and shouldn't be
> done within the driver.
> 
> I hope there is still a change to get it all in through the 3.16 merge
> window?

76 patches is a lot for "bugfixes and reverts only" kernel releases.

I know lots of these are cleanups, look at the first one listed:

>   staging: rtl8723au: rtw_get_wps_ie23a(): Remove unused dest pointer
> wps_ie

I don't feel comfortable justifying that to Linus or anyone about how
important it is to get into 3.16-final, sorry.

So, can you split this out into "bugfixes/regressions" and "cleanups, so
I can apply them to the two different trees (for 3.16-final and for
3.17-rc1.)

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-09 Thread Fabio Estevam
On Mon, Jun 9, 2014 at 11:33 AM, Shawn Guo  wrote:
> On Mon, Jun 09, 2014 at 11:29:28AM -0300, Fabio Estevam wrote:
>> On Mon, Jun 9, 2014 at 11:06 AM, Russell King - ARM Linux
>>  wrote:
>>
>> > Please check the status in /sys/class/drm/card0-HDMI-A-1/status.  This
>> > should report the current state of the hotplug detection.
>>
>> /sys/class/drm/card0-HDMI-A-1/status returns the correct state for
>> HDMI cable connection.
>>
>> > Remember that this code detects off the HPD signal - if the HPD signal
>> > has not been correctly wired up, this patch is not going to help (really
>> > it comes down to a hardware fault, which I'm not trying to solve with
>> > this patch.)
>> >
>> > What I'm trying to resolve with this patch is that the state detected
>> > on properly wired up systems corresponds with the real initial state of
>> > the interface at initialisation time.
>> >
>> > The problem with the current code is that we start off assuming that the
>> > interface is disconnected, and we rely on an interrupt arriving to change
>> > that state.  If for whatever reason that interrupt does not arrive, then,
>> > even if the HPD signal is active, we continue believing that the interface
>> > is not connected.
>> >
>> > I seem to remember discussion in the past that the HPD signal is not
>> > wired up on SabreSD.  Really, this needs to be a DT flag to indicate
>>
>> It is sabrelite board that does not have HPD signal not wired up.
>>
>> sabresd does have HPD signal connected.
>>
>> The HDMI undetected issue I am seeing on sabresd seems to be related
>> to the simultaneous usage of HDMI and LVDS.
>>
>> If I remove the ldb node from the imx6qdl-sabresd.dtsi, then the HDMI
>> cable is correctly detected and HDMI is shown right after boot.
>
> This is a known limitation.
>
> http://thread.gmane.org/gmane.linux.ports.arm.kernel/315968/focus=318559

There were versions of linux-next that hdmi and lvds works at the same
time without problems.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/76] staging-next: rtl8723au: More fixes for 3.16

2014-06-09 Thread Jes Sorensen
Greg KH  writes:
> On Mon, Jun 09, 2014 at 03:15:52PM +0200, jes.soren...@redhat.com wrote:
>> From: Jes Sorensen 
>> 
>> Greg,
>> 
>> Thanks for pushing my other changes to Linus. This set goes on top of
>> the set I sent you on 2014/05/31 and the fix from 2014/06/03. If you
>> prefer I go back and submit it all as one large set, let me know.
>> 
>> This set contains a number of fixes, including getting rid of some 'on
>> the wire' noise that isn't in the spec, plus removes a bunch of
>> functionality which is handled by the 802.11 stack, and shouldn't be
>> done within the driver.
>> 
>> I hope there is still a change to get it all in through the 3.16 merge
>> window?
>
> 76 patches is a lot for "bugfixes and reverts only" kernel releases.
>
> I know lots of these are cleanups, look at the first one listed:
>
>>   staging: rtl8723au: rtw_get_wps_ie23a(): Remove unused dest pointer
>> wps_ie
>
> I don't feel comfortable justifying that to Linus or anyone about how
> important it is to get into 3.16-final, sorry.
>
> So, can you split this out into "bugfixes/regressions" and "cleanups, so
> I can apply them to the two different trees (for 3.16-final and for
> 3.17-rc1.)

OK, in that case, punt them for 3.17. The opening of 3.16 caught me a
bit by surprise to be honest, I thought I had another week or two.

The previous set I sent you, I really would like in for 3.16
though. That is a total of 13 commits.

Cheers,
Jes
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/76] staging-next: rtl8723au: More fixes for 3.16

2014-06-09 Thread Greg KH
On Mon, Jun 09, 2014 at 05:39:54PM +0200, Jes Sorensen wrote:
> Greg KH  writes:
> > On Mon, Jun 09, 2014 at 03:15:52PM +0200, jes.soren...@redhat.com wrote:
> >> From: Jes Sorensen 
> >> 
> >> Greg,
> >> 
> >> Thanks for pushing my other changes to Linus. This set goes on top of
> >> the set I sent you on 2014/05/31 and the fix from 2014/06/03. If you
> >> prefer I go back and submit it all as one large set, let me know.
> >> 
> >> This set contains a number of fixes, including getting rid of some 'on
> >> the wire' noise that isn't in the spec, plus removes a bunch of
> >> functionality which is handled by the 802.11 stack, and shouldn't be
> >> done within the driver.
> >> 
> >> I hope there is still a change to get it all in through the 3.16 merge
> >> window?
> >
> > 76 patches is a lot for "bugfixes and reverts only" kernel releases.
> >
> > I know lots of these are cleanups, look at the first one listed:
> >
> >>   staging: rtl8723au: rtw_get_wps_ie23a(): Remove unused dest pointer
> >> wps_ie
> >
> > I don't feel comfortable justifying that to Linus or anyone about how
> > important it is to get into 3.16-final, sorry.
> >
> > So, can you split this out into "bugfixes/regressions" and "cleanups, so
> > I can apply them to the two different trees (for 3.16-final and for
> > 3.17-rc1.)
> 
> OK, in that case, punt them for 3.17. The opening of 3.16 caught me a
> bit by surprise to be honest, I thought I had another week or two.
> 
> The previous set I sent you, I really would like in for 3.16
> though. That is a total of 13 commits.

Ok, I'll go through them (and the 400+ other patches in my todo list)
after 3.16-rc1 is out next week.

thanks

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/76] staging-next: rtl8723au: More fixes for 3.16

2014-06-09 Thread Jes Sorensen
Greg KH  writes:
> On Mon, Jun 09, 2014 at 05:39:54PM +0200, Jes Sorensen wrote:
>> Greg KH  writes:
>> > I don't feel comfortable justifying that to Linus or anyone about how
>> > important it is to get into 3.16-final, sorry.
>> >
>> > So, can you split this out into "bugfixes/regressions" and "cleanups, so
>> > I can apply them to the two different trees (for 3.16-final and for
>> > 3.17-rc1.)
>> 
>> OK, in that case, punt them for 3.17. The opening of 3.16 caught me a
>> bit by surprise to be honest, I thought I had another week or two.
>> 
>> The previous set I sent you, I really would like in for 3.16
>> though. That is a total of 13 commits.
>
> Ok, I'll go through them (and the 400+ other patches in my todo list)
> after 3.16-rc1 is out next week.

Thanks!

For further staging-3.17 patches, do you prefer I hold off on those for
now?

Cheers,
Jes
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/76] staging-next: rtl8723au: More fixes for 3.16

2014-06-09 Thread Larry Finger

On 06/09/2014 10:39 AM, Jes Sorensen wrote:

Greg KH  writes:

On Mon, Jun 09, 2014 at 03:15:52PM +0200, jes.soren...@redhat.com wrote:

From: Jes Sorensen 

Greg,

Thanks for pushing my other changes to Linus. This set goes on top of
the set I sent you on 2014/05/31 and the fix from 2014/06/03. If you
prefer I go back and submit it all as one large set, let me know.

This set contains a number of fixes, including getting rid of some 'on
the wire' noise that isn't in the spec, plus removes a bunch of
functionality which is handled by the 802.11 stack, and shouldn't be
done within the driver.

I hope there is still a change to get it all in through the 3.16 merge
window?


76 patches is a lot for "bugfixes and reverts only" kernel releases.

I know lots of these are cleanups, look at the first one listed:


   staging: rtl8723au: rtw_get_wps_ie23a(): Remove unused dest pointer
 wps_ie


I don't feel comfortable justifying that to Linus or anyone about how
important it is to get into 3.16-final, sorry.

So, can you split this out into "bugfixes/regressions" and "cleanups, so
I can apply them to the two different trees (for 3.16-final and for
3.17-rc1.)


OK, in that case, punt them for 3.17. The opening of 3.16 caught me a
bit by surprise to be honest, I thought I had another week or two.

The previous set I sent you, I really would like in for 3.16
though. That is a total of 13 commits.


Jes and Greg,

Linus wanted to issue 3.16-rc1 before he started his family vacation. The 
necessity of needing 3.15-rc8 interfered with that so he opened the merge in a 
temporary "next" branch of mainline, thus merging was already in progress when 
3.15 was released.


That said, patches 19 and 20 fix a firmware naming problem, and they should be 
included in 3.16, and backported to 3.15.


Larry


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/76] staging-next: rtl8723au: More fixes for 3.16

2014-06-09 Thread Greg KH
On Mon, Jun 09, 2014 at 05:51:24PM +0200, Jes Sorensen wrote:
> Greg KH  writes:
> > On Mon, Jun 09, 2014 at 05:39:54PM +0200, Jes Sorensen wrote:
> >> Greg KH  writes:
> >> > I don't feel comfortable justifying that to Linus or anyone about how
> >> > important it is to get into 3.16-final, sorry.
> >> >
> >> > So, can you split this out into "bugfixes/regressions" and "cleanups, so
> >> > I can apply them to the two different trees (for 3.16-final and for
> >> > 3.17-rc1.)
> >> 
> >> OK, in that case, punt them for 3.17. The opening of 3.16 caught me a
> >> bit by surprise to be honest, I thought I had another week or two.
> >> 
> >> The previous set I sent you, I really would like in for 3.16
> >> though. That is a total of 13 commits.
> >
> > Ok, I'll go through them (and the 400+ other patches in my todo list)
> > after 3.16-rc1 is out next week.
> 
> Thanks!
> 
> For further staging-3.17 patches, do you prefer I hold off on those for
> now?

Given that you have about 80 patches outstanding, yeah, if you could
wait a week or so before sending more, that would be great :)

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/76] staging-next: rtl8723au: More fixes for 3.16

2014-06-09 Thread Greg KH
On Mon, Jun 09, 2014 at 10:54:46AM -0500, Larry Finger wrote:
> On 06/09/2014 10:39 AM, Jes Sorensen wrote:
> >Greg KH  writes:
> >>On Mon, Jun 09, 2014 at 03:15:52PM +0200, jes.soren...@redhat.com wrote:
> >>>From: Jes Sorensen 
> >>>
> >>>Greg,
> >>>
> >>>Thanks for pushing my other changes to Linus. This set goes on top of
> >>>the set I sent you on 2014/05/31 and the fix from 2014/06/03. If you
> >>>prefer I go back and submit it all as one large set, let me know.
> >>>
> >>>This set contains a number of fixes, including getting rid of some 'on
> >>>the wire' noise that isn't in the spec, plus removes a bunch of
> >>>functionality which is handled by the 802.11 stack, and shouldn't be
> >>>done within the driver.
> >>>
> >>>I hope there is still a change to get it all in through the 3.16 merge
> >>>window?
> >>
> >>76 patches is a lot for "bugfixes and reverts only" kernel releases.
> >>
> >>I know lots of these are cleanups, look at the first one listed:
> >>
> >>>   staging: rtl8723au: rtw_get_wps_ie23a(): Remove unused dest pointer
> >>> wps_ie
> >>
> >>I don't feel comfortable justifying that to Linus or anyone about how
> >>important it is to get into 3.16-final, sorry.
> >>
> >>So, can you split this out into "bugfixes/regressions" and "cleanups, so
> >>I can apply them to the two different trees (for 3.16-final and for
> >>3.17-rc1.)
> >
> >OK, in that case, punt them for 3.17. The opening of 3.16 caught me a
> >bit by surprise to be honest, I thought I had another week or two.
> >
> >The previous set I sent you, I really would like in for 3.16
> >though. That is a total of 13 commits.
> 
> Jes and Greg,
> 
> Linus wanted to issue 3.16-rc1 before he started his family vacation. The
> necessity of needing 3.15-rc8 interfered with that so he opened the merge in
> a temporary "next" branch of mainline, thus merging was already in progress
> when 3.15 was released.
> 
> That said, patches 19 and 20 fix a firmware naming problem, and they should
> be included in 3.16, and backported to 3.15.

Ok, I'll look into backporting those when I apply them, thanks.  Any
others you feel should go into 3.16, please let me know.

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-09 Thread Russell King - ARM Linux
On Mon, Jun 09, 2014 at 11:29:28AM -0300, Fabio Estevam wrote:
> On Mon, Jun 9, 2014 at 11:06 AM, Russell King - ARM Linux
>  wrote:
> 
> > Please check the status in /sys/class/drm/card0-HDMI-A-1/status.  This
> > should report the current state of the hotplug detection.
> 
> /sys/class/drm/card0-HDMI-A-1/status returns the correct state for
> HDMI cable connection.

Good, so that means we're reporting the correct status to the DRM layer.
Please post the kernel boot messages, one with the HDMI cable disconnected,
and one with a HDMI sink connected.

> The HDMI undetected issue I am seeing on sabresd seems to be related
> to the simultaneous usage of HDMI and LVDS.
> 
> If I remove the ldb node from the imx6qdl-sabresd.dtsi, then the HDMI
> cable is correctly detected and HDMI is shown right after boot.

I wonder if the problem is that HDMI and LVDS are interfering with each
other wrt the required pixel clock, and LVDS is winning.  If we have
HDMI enabled, many HDMI sinks will only work if we set one of their
supported modes (with the dot clock within 1% - though some sinks are
more lenient).

I think the Novena people have run into this issue, but I've not seen
much in the way of contributions back, despite them making use of my
patches...

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-09 Thread Fabio Estevam
On Mon, Jun 9, 2014 at 2:49 PM, Russell King - ARM Linux
 wrote:
> On Mon, Jun 09, 2014 at 11:29:28AM -0300, Fabio Estevam wrote:
>> On Mon, Jun 9, 2014 at 11:06 AM, Russell King - ARM Linux
>>  wrote:
>>
>> > Please check the status in /sys/class/drm/card0-HDMI-A-1/status.  This
>> > should report the current state of the hotplug detection.
>>
>> /sys/class/drm/card0-HDMI-A-1/status returns the correct state for
>> HDMI cable connection.
>
> Good, so that means we're reporting the correct status to the DRM layer.
> Please post the kernel boot messages, one with the HDMI cable disconnected,
> and one with a HDMI sink connected.

With HDMI cable connected (no image is seen on HDMI, only on lvds cable):

imx-ipuv3 240.ipu: IPUv3H probed
imx-ipuv3 280.ipu: IPUv3H probed
[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
mmcblk0: mmc1:0007 SD4GB 3.70 GiB
[drm] No driver support for vblank timestamp query.
 mmcblk0: unknown partition table
imx-drm display-subsystem.11: bound imx-ipuv3-crtc.0 (ops ipu_crtc_ops)
imx-drm display-subsystem.11: bound imx-ipuv3-crtc.1 (ops ipu_crtc_ops)
imx-drm display-subsystem.11: bound imx-ipuv3-crtc.2 (ops ipu_crtc_ops)
imx-drm display-subsystem.11: bound imx-ipuv3-crtc.3 (ops ipu_crtc_ops)
imx-hdmi 12.hdmi: Detected HDMI controller 0x13:0xa:0xa0:0xc1
imx-hdmi 12.hdmi: hdmi_set_clk_regenerator: samplerate=48000
ratio=100  pixelclk=7425  N=6144 cts=74250
imx-drm display-subsystem.11: bound 12.hdmi (ops hdmi_ops)
imx-hdmi 12.hdmi: EVENT=plugin
imx-hdmi 12.hdmi: Non-CEA mode used in HDMI
imx-hdmi 12.hdmi: final pixclk = 0
imx-drm display-subsystem.11: bound ldb.10 (ops imx_ldb_ops)
imx-hdmi 12.hdmi: imx_hdmi_setup DVI mode
imx-hdmi 12.hdmi: got edid: width[51] x height[28]
imx-hdmi 12.hdmi: Non-CEA mode used in HDMI
imx-hdmi 12.hdmi: final pixclk = 13850
imx-hdmi 12.hdmi: imx_hdmi_setup DVI mode
imx-hdmi 12.hdmi: Non-CEA mode used in HDMI
imx-hdmi 12.hdmi: final pixclk = 13850
imx-hdmi 12.hdmi: imx_hdmi_setup DVI mode

If I disconnect/reconnect the HDMI cable (then image is seen on both
HDMI and LVDS):

root@freescale /$ imx-hdmi 12.hdmi: EVENT=plugout
imx-hdmi 12.hdmi: EVENT=plugin
imx-hdmi 12.hdmi: Non-CEA mode used in HDMI
imx-hdmi 12.hdmi: final pixclk = 13850
imx-hdmi 12.hdmi: imx_hdmi_setup DVI mode
imx-hdmi 12.hdmi: got edid: width[51] x height[28]
imx-hdmi 12.hdmi: Non-CEA mode used in HDMI
imx-hdmi 12.hdmi: final pixclk = 13850
imx-hdmi 12.hdmi: imx_hdmi_setup DVI mode
imx-hdmi 12.hdmi: Non-CEA mode used in HDMI
imx-hdmi 12.hdmi: final pixclk = 13850
imx-hdmi 12.hdmi: imx_hdmi_setup DVI mode

Now booting the kernel with HDMI disconnected:

[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
mmcblk0: mmc1:0007 SD4GB 3.70 GiB
[drm] No driver support for vblank timestamp query.
 mmcblk0: unknown partition table
imx-drm display-subsystem.11: bound imx-ipuv3-crtc.0 (ops ipu_crtc_ops)
imx-drm display-subsystem.11: bound imx-ipuv3-crtc.1 (ops ipu_crtc_ops)
imx-drm display-subsystem.11: bound imx-ipuv3-crtc.2 (ops ipu_crtc_ops)
imx-drm display-subsystem.11: bound imx-ipuv3-crtc.3 (ops ipu_crtc_ops)
imx-hdmi 12.hdmi: Detected HDMI controller 0x13:0xa:0xa0:0xc1
imx-hdmi 12.hdmi: hdmi_set_clk_regenerator: samplerate=48000
ratio=100  pixelclk=7425  N=6144 cts=74250
imx-drm display-subsystem.11: bound 12.hdmi (ops hdmi_ops)
imx-drm display-subsystem.11: bound ldb.10 (ops imx_ldb_ops)
Console: switching to colour frame buffer device 128x48
imx-drm display-subsystem.11: fb0:  frame buffer device
imx-drm display-subsystem.11: registered panic notifier
[drm] Initialized imx-drm 1.0.0 20120507 on minor 0

And after connecting the HDMI cable:

imx-hdmi 12.hdmi: EVENT=plugin
imx-hdmi 12.hdmi: Non-CEA mode used in HDMI
imx-hdmi 12.hdmi: final pixclk = 0
imx-hdmi 12.hdmi: imx_hdmi_setup DVI mode
imx-hdmi 12.hdmi: got edid: width[51] x height[28]
imx-hdmi 12.hdmi: Non-CEA mode used in HDMI
imx-hdmi 12.hdmi: final pixclk = 7880
imx-hdmi 12.hdmi: imx_hdmi_setup DVI mode
imx-hdmi 12.hdmi: Non-CEA mode used in HDMI
imx-hdmi 12.hdmi: final pixclk = 7880
imx-hdmi 12.hdmi: imx_hdmi_setup DVI mode

Image is seen on both LVDS and HDMI monitor, but HDMI resolution is
not correct (this is a different bug though).

>
>> The HDMI undetected issue I am seeing on sabresd seems to be related
>> to the simultaneous usage of HDMI and LVDS.
>>
>> If I remove the ldb node from the imx6qdl-sabresd.dtsi, then the HDMI
>> cable is correctly detected and HDMI is shown right after boot.
>
> I wonder if the problem is that HDMI and LVDS are interfering with each
> other wrt the required pixel clock, and LVDS is winning.  If we have
> HDMI enabled, many HDMI sinks will only work if we set one of their
> supported modes (with the dot clock within 1% - though some sinks are
> more lenient).

Yes, it seems th

Re: [PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-09 Thread Fabio Estevam
On Mon, Jun 9, 2014 at 3:15 PM, Fabio Estevam  wrote:
>> I wonder if the problem is that HDMI and LVDS are interfering with each
>> other wrt the required pixel clock, and LVDS is winning.  If we have
>> HDMI enabled, many HDMI sinks will only work if we set one of their
>> supported modes (with the dot clock within 1% - though some sinks are
>> more lenient).
>
> Yes, it seems this is the case.

I tested not using pll5 as the parent of LVDS:

--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -439,12 +439,6 @@ static void __init imx6q_clocks_init(struct device_node *cc
clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");
clk_register_clkdev(clk[enet_ref], "enet_ref", NULL);

-   if ((imx_get_soc_revision() != IMX_CHIP_REVISION_1_0) ||
-   cpu_is_imx6dl()) {
-   clk_set_parent(clk[ldb_di0_sel], clk[pll5_video_div]);
-   clk_set_parent(clk[ldb_di1_sel], clk[pll5_video_div]);
-   }
-
clk_set_parent(clk[ipu1_di0_pre_sel], clk[pll5_video_div]);
clk_set_parent(clk[ipu1_di1_pre_sel], clk[pll5_video_div]);
clk_set_parent(clk[ipu2_di0_pre_sel], clk[pll5_video_div]);


Then the HDMI detection works fine and I get images on both HDMI and LVDS.

I understand that many LVDS panels need a frequency range that can
only be obtained via PLL5 though.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


  1   2   >