Re: Matching crc32 checksums from kernel and user space

2015-11-16 Thread Kalle Valo
Kalle Valo  writes:

> Hi,
>
> I want ath10k to print a checksum for the firmware image and include
> that to the firmware crash dump file as well. Then I want to print the
> same checksum from user space scripts and verify it with the crash dump
> file.
>
> I thought that crc32 would be good enough for me but it wasn't that
> simple as I can't seem to getting matching checksums, at least not with
> the user space tools I found. For a test case I created a simple file:
>
> $ xxd /lib/firmware/ath10k/crc-test.bin 
> : 3132 3334 3536 3738 3930 0a  1234567890.
>
> In kernel I get these checksums:
>
> [  574.867724] crc32_le(0) 8916bc26
> [  574.867739] crc32_le(~0) 1d6ef235
> [  574.867743] crc32_be(0) b9346a4c
> [  574.867746] crc32_be(~0) 71467465
>
> And from python I got (value in parenthesis is the seed I used):
>
> binascii.crc32() 0xe2910dcaL
> binascii.crc32() 0x76e943d9L

Johannes Berg pointed out that this looks to be a sign issue, I just
need to invert the python value and then I get the same value:

>>> hex(~0x76e943d9 & 0x)
'0x8916bc26'

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


10ec:b723 [HP Notebook - 15-ac106na] Wifi unstable NO HTML

2015-11-16 Thread Alan
 sorry guys my first bug report
[1.]
Bug #1516251 10ec:b723 [HP Notebook - 15-ac106na] Wifi unstable

[2.]
Networks not detected unless router is within 2feet
weak signal strength, connection dropping [when it does connect]
device dropping [disappearing from NetworkManager]

only affects this wireless device [rtl8723be] all others function as expected

###Irq error for i915 graphics is fixed in 4.2.6 and this error still
occurs in that kernel

bios F.1A [latest]

router:-
Virgin superhub
software version V2.39.02 [latest]
bootcode version 2.3.0beta7

[3.]

[4.]
Linux version 4.4.0-rc1 (al@n) (gcc version 4.9.2 (Ubuntu
4.9.2-10ubuntu13) ) #1 SMP Mon Nov 16 10:52:31 GMT 2015#

[5.]
No oops but i do get this line in dmesg in 4.4-Rc only, possible my
error compiling?? [NOOB]
[   15.734897] rtl8723be :0d:00.0 wlan0: set_features() failed
(-1); wanted 0x4000, left 0x4800

[6.]
happens every boot

[7.]
Description:Ubuntu 15.04
Release:15.04

[7.1]
If some fields are empty or look unusual you may have an old version.
Compare to the current minimal requirements in Documentation/Changes.

Linux n 4.4.0-rc1 #1 SMP Mon Nov 16 10:52:31 GMT 2015 x86_64 x86_64
x86_64 GNU/Linux

GNU C   4.9.2
GNU Make4.0
Binutils2.25
Util-linux  2.25.2
Mount   2.25.2
Module-init-tools   18
E2fsprogs   1.42.12
Pcmciautils 018
PPP 2.4.6
Linux C Library 2.21
Dynamic linker (ldd)2.21
Linux C++ Library   6.0.20
Procps  3.3.9
Net-tools   1.60
Kbd 1.15.5
Console-tools   1.15.5
Sh-utils8.23
Udev219
Wireless-tools  30
Modules Loaded  8250_dw acpi_pad acpi_thermal_rel ahci arc4
autofs4 binfmt_misc bluetooth bnep btbcm btcoexist btintel btrtl btusb
cfg80211 coretemp crc32_pclmul crct10dif_pclmul drm drm_kms_helper
dw_dmac dw_dmac_core fb_sys_fops fjes hid hid_generic hp_wireless
hp_wmi i2c_algo_bit i2c_designware_core i2c_designware_platform
i2c_hid i915 input_leds int3400_thermal int3402_thermal
int3403_thermal int340x_thermal_zone intel_pch_thermal
intel_powerclamp intel_rapl intel_soc_dts_iosf iosf_mbi irqbypass
joydev kvm kvm_intel libahci lp lpc_ich mac80211 mac_hid media mei
mei_me mii nls_iso8859_1 parport parport_pc ppdev
processor_thermal_device psmouse r8169 rfcomm rtl8723be rtl8723_common
rtl_pci rtlwifi sdhci sdhci_acpi serio_raw shpchp snd snd_hda_codec
snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_codec_realtek
snd_hda_core snd_hda_intel snd_hwdep snd_pcm snd_rawmidi snd_seq
snd_seq_device snd_seq_midi snd_seq_midi_event snd_soc_core
snd_soc_rl6347a snd_soc_rt286 snd_soc_ssm4567 snd_soc_sst_acpi
snd_timer soundcore sparse_keymap spi_pxa2xx_platform syscopyarea
sysfillrect sysimgblt tpm_crb usbhid uvcvideo v4l2_common video
videobuf2_core videobuf2_memops videobuf2_v4l2 videobuf2_vmalloc
videodev wmi x86_pkg_temp_thermal

[7.2]
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model   : 61
model name  : Intel(R) Pentium(R) CPU 3825U @ 1.90GHz
stepping: 4
microcode   : 0x21
cpu MHz : 1900.000
cache size  : 2048 KB
physical id : 0
siblings: 4
core id : 0
cpu cores   : 2
apicid  : 0
initial apicid  : 0
fpu : yes
fpu_exception   : yes
cpuid level : 20
wp  : yes
flags   : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe
syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts
rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq
dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg cx16 xtpr pdcm pcid
sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer xsave rdrand
lahf_lm abm 3dnowprefetch ida arat epb pln pts dtherm intel_pt
tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust erms invpcid
rdseed xsaveopt
bugs:
bogomips: 3791.26
clflush size: 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor   : 1
vendor_id   : GenuineIntel
cpu family  : 6
model   : 61
model name  : Intel(R) Pentium(R) CPU 3825U @ 1.90GHz
stepping: 4
microcode   : 0x21
cpu MHz : 1845.152
cache size  : 2048 KB
physical id : 0
siblings: 4
core id : 1
cpu cores   : 2
apicid  : 2
initial apicid  : 2
fpu : yes
fpu_exception   : yes
cpuid level : 20
wp  : yes
flags   : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe
syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts
rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq
dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg cx16 xtpr pdcm pcid
sse4_1 

[PATCH 09/19] staging/wilc1000: move init/exit functions to driver files

2015-11-16 Thread Arnd Bergmann
The driver interfaces are in linux_wlan_sdio.c and linux_wlan_spi.c, so
this is where the init and exit functions should be. Splitting this up
enables further cleanups, including eventually allowing both modules
to be built together.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c | 51 +--
 drivers/staging/wilc1000/linux_wlan_common.h  | 10 ++
 drivers/staging/wilc1000/linux_wlan_sdio.c| 16 +++--
 drivers/staging/wilc1000/linux_wlan_sdio.h|  6 ++--
 drivers/staging/wilc1000/linux_wlan_spi.c | 23 +++-
 drivers/staging/wilc1000/linux_wlan_spi.h |  3 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 7 files changed, 52 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 0747a0eefe92..876bcfb3b546 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1398,7 +1398,7 @@ void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 
size)
WILC_WFI_p2p_rx(wilc->vif[1].ndev, buff, size);
 }
 
-void wl_wlan_cleanup(struct wilc *wilc)
+void wilc_netdev_cleanup(struct wilc *wilc)
 {
int i = 0;
perInterface_wlan_t *nic[NUM_CONCURRENT_IFC];
@@ -1517,52 +1517,3 @@ int wilc_netdev_init(struct wilc **wilc)
 
return 0;
 }
-
-static int __init init_wilc_driver(void)
-{
-#ifdef WILC_SPI
-   struct wilc *wilc;
-#endif
-
-#if defined(WILC_DEBUGFS)
-   if (wilc_debugfs_init() < 0) {
-   PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc 
driver\n");
-   return -1;
-   }
-#endif
-
-   printk("IN INIT FUNCTION\n");
-   printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
-
-#ifdef WILC_SDIO
-   {
-   int ret;
-
-   ret = sdio_register_driver(_bus);
-   if (ret < 0)
-   PRINT_D(INIT_DBG, "init_wilc_driver: Failed register 
sdio driver\n");
-
-   return ret;
-   }
-#else
-   PRINT_D(INIT_DBG, "Initializing netdev\n");
-   if (wilc_netdev_init())
-   PRINT_ER("Couldn't initialize netdev\n");
-   return 0;
-#endif
-}
-late_initcall(init_wilc_driver);
-
-static void __exit exit_wilc_driver(void)
-{
-#ifndef WILC_SDIO
-   PRINT_D(INIT_DBG, "SPI unregister...\n");
-   spi_unregister_driver(_bus);
-#else
-   PRINT_D(INIT_DBG, "SDIO unregister...\n");
-   sdio_unregister_driver(_bus);
-#endif
-}
-module_exit(exit_wilc_driver);
-
-MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_common.h 
b/drivers/staging/wilc1000/linux_wlan_common.h
index b8dfc4a5e5cb..f2ea8280b8f8 100644
--- a/drivers/staging/wilc1000/linux_wlan_common.h
+++ b/drivers/staging/wilc1000/linux_wlan_common.h
@@ -121,6 +121,16 @@ extern atomic_t WILC_DEBUG_LEVEL;
printk("ERR [%s: %d]", __func__, __LINE__); \
printk(__VA_ARGS__);\
} while (0)
+
+static inline int wilc_debugfs_init(void)
+{
+   return 0;
+}
+
+static inline void wilc_debugfs_remove(void)
+{
+}
+
 #endif
 
 #define FN_IN   /* PRINT_D(">>> \n") */
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 0b01873faf79..06fd0e600c2a 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -146,11 +146,11 @@ static void linux_sdio_remove(struct sdio_func *func)
struct wilc_sdio *wl_sdio;
 
wl_sdio = sdio_get_drvdata(func);
-   wl_wlan_cleanup(wl_sdio->wilc);
+   wilc_netdev_cleanup(wl_sdio->wilc);
kfree(wl_sdio);
 }
 
-struct sdio_driver wilc_bus = {
+static struct sdio_driver wilc_bus = {
.name   = SDIO_MODALIAS,
.id_table   = wilc_sdio_ids,
.probe  = linux_sdio_probe,
@@ -237,4 +237,16 @@ int wilc_sdio_set_default_speed(void)
 }
 
 
+static int __init init_wilc_sdio_driver(void)
+{
+   return sdio_register_driver(_bus);
+}
+late_initcall(init_wilc_sdio_driver);
+
+static void __exit exit_wilc_sdio_driver(void)
+{
+   sdio_unregister_driver(_bus);
+}
+module_exit(exit_wilc_sdio_driver);
 
+MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h 
b/drivers/staging/wilc1000/linux_wlan_sdio.h
index 49cce2c43410..3e1618526e78 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.h
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.h
@@ -1,11 +1,11 @@
-extern struct sdio_func *wilc_sdio_func;
-extern struct sdio_driver wilc_bus;
-
 #include 
 
+extern struct sdio_func *wilc_sdio_func;
+
 int wilc_sdio_init(void);
 int wilc_sdio_cmd52(sdio_cmd52_t *cmd);
 int wilc_sdio_cmd53(sdio_cmd53_t *cmd);
+
 int wilc_sdio_enable_interrupt(void);
 void wilc_sdio_disable_interrupt(void);
 int wilc_sdio_set_max_speed(void);
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 

[PATCH 05/19] staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT

2015-11-16 Thread Arnd Bergmann
The linux_wlan.c file uses a set of enums from wilc_wlan_if.h,
with the exception of the NO_ENCRYPT that comes from
wilc_wfi_cfgoperations.h. The two sets of enums clearly have
the same intention but are defined a bit different.

To prepare to clean up the ones in wilc_wfi_cfgoperations.h, this
first changes over the only other user.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index f1e70b225deb..040caa0d0d0b 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -643,7 +643,7 @@ static int linux_wlan_init_test_config(struct net_device 
*dev, struct wilc *p_ni
if (!wilc_wlan_cfg_set(0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
goto _fail_;
 
-   c_val[0] = NO_ENCRYPT;
+   c_val[0] = NO_SECURITY; /* NO_ENCRYPT, 0x79 */
if (!wilc_wlan_cfg_set(0, WID_11I_MODE, c_val, 1, 0, 0))
goto _fail_;
 
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 15/20] staging/wilc1000: pass hif operations through initialization

2015-11-16 Thread Arnd Bergmann
On Monday 16 November 2015 10:36:47 glen lee wrote:
> On 2015년 11월 13일 18:17, Arnd Bergmann wrote:
> > On Friday 13 November 2015 16:49:22 glen lee wrote:
> >> Hi arnd,
> >>
> >> I found this. These should be like this. It works fine.
> >> +   .hif_block_tx_ext = sdio_write,
> >> +   .hif_block_rx_ext = sdio_read,
> >>
> >> also, wilc_hif_spi need to be fixed together like this.
> >> +   .hif_block_tx_ext = _wilc_spi_write,
> >> +   .hif_block_rx_ext = _wilc_spi_read,
> >>
> >> Thank you for all the patches.
> >>
> > Glad you found it. How should we go on to get the right version merged?
> > Do you want to send the working version of my patches to Greg along with
> > whatever you have on your end, or do you prefer me to re-send it?
> 
> In my opinion, why don't you re-send the whole patches again since I'm still 
> working on.
> 

Ok, done.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[question] Rate control algorithm for mesh

2015-11-16 Thread ferran
Hello everybody,

I would like to know if there is a transmit rate control algorithm out
there that takes into account the destination MAC address. My setting is
like this:

[node0]·  ·  ·  ·  ·[node1][node2]

Where the spaced pattern means a poor connection and the densely dotted
pattern means a good connection.

The problem here is that node1 oscillates between fast rates and slow
rates, as when transmitting to node0 it must reduce the rate, and when
transmitting to node2 it increases the rate since it must take profit of
the channel. I am therefore getting many re-tx between n1 and n0, and
n1-->n2 isn't as fast as it could.

Currently I am using the PID-based RC, but I'm afraid that this problem
isn't adressed at Minstrel neither.
Am I wrong?

Thank you for your excellent work!
Ferran

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: BUG #1516251 10ec:b723 [HP Notebook - 15-ac106na] Wifi unstable

2015-11-16 Thread Larry Finger

On 11/16/2015 06:32 AM, Alan wrote:


[1.]
Bug #1516251 10ec:b723 [HP Notebook - 15-ac106na] Wifi unstable

[2.]
Networks not detected unless router is within 2feet
weak signal strength, connection dropping [when it does connect]
device dropping [disappearing from NetworkManager]

only affects this wireless device [rtl8723be] all others function as expected

###Irq error for i915 graphics is fixed in 4.2.6 and this error still occurs in
that kernel

bios F.1A [latest]

router:-
Virgin superhub
software version V2.39.02 [latest]
bootcode version 2.3.0beta7

[3.]

[4.]
Linux version 4.4.0-rc1 (al@n) (gcc version 4.9.2 (Ubuntu 4.9.2-10ubuntu13) ) #1
SMP Mon Nov 16 10:52:31 GMT 2015#

[5.]
No oops but i do get this line in dmesg in 4.4-Rc only, possible my error
compiling?? [NOOB]
[   15.734897] rtl8723be :0d:00.0 wlan0: set_features() failed (-1); wanted
0x4000, left 0x4800

[6.]
happens every boot

[7.]
Description:Ubuntu 15.04
Release:15.04

[7.1]
If some fields are empty or look unusual you may have an old version.
Compare to the current minimal requirements in Documentation/Changes.

Linux n 4.4.0-rc1 #1 SMP Mon Nov 16 10:52:31 GMT 2015 x86_64 x86_64 x86_64 
GNU/Linux

GNU C   4.9.2
GNU Make4.0
Binutils2.25
Util-linux  2.25.2
Mount   2.25.2
Module-init-tools   18
E2fsprogs   1.42.12
Pcmciautils 018
PPP 2.4.6
Linux C Library 2.21
Dynamic linker (ldd)2.21
Linux C++ Library   6.0.20
Procps  3.3.9
Net-tools   1.60
Kbd 1.15.5
Console-tools   1.15.5
Sh-utils8.23
Udev219
Wireless-tools  30
Modules Loaded  8250_dw acpi_pad acpi_thermal_rel ahci arc4 autofs4
binfmt_misc bluetooth bnep btbcm btcoexist btintel btrtl btusb cfg80211 coretemp
crc32_pclmul crct10dif_pclmul drm drm_kms_helper dw_dmac dw_dmac_core
fb_sys_fops fjes hid hid_generic hp_wireless hp_wmi i2c_algo_bit
i2c_designware_core i2c_designware_platform i2c_hid i915 input_leds
int3400_thermal int3402_thermal int3403_thermal int340x_thermal_zone
intel_pch_thermal intel_powerclamp intel_rapl intel_soc_dts_iosf iosf_mbi
irqbypass joydev kvm kvm_intel libahci lp lpc_ich mac80211 mac_hid media mei
mei_me mii nls_iso8859_1 parport parport_pc ppdev processor_thermal_device
psmouse r8169 rfcomm rtl8723be rtl8723_common rtl_pci rtlwifi sdhci sdhci_acpi
serio_raw shpchp snd snd_hda_codec snd_hda_codec_generic snd_hda_codec_hdmi
snd_hda_codec_realtek snd_hda_core snd_hda_intel snd_hwdep snd_pcm snd_rawmidi
snd_seq snd_seq_device snd_seq_midi snd_seq_midi_event snd_soc_core
snd_soc_rl6347a snd_soc_rt286 snd_soc_ssm4567 snd_soc_sst_acpi snd_timer
soundcore sparse_keymap spi_pxa2xx_platform syscopyarea sysfillrect sysimgblt
tpm_crb usbhid uvcvideo v4l2_common video videobuf2_core videobuf2_memops
videobuf2_v4l2 videobuf2_vmalloc videodev wmi x86_pkg_temp_thermal

[7.2]
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model   : 61
model name  : Intel(R) Pentium(R) CPU 3825U @ 1.90GHz
stepping: 4
microcode   : 0x21
cpu MHz : 1900.000
cache size  : 2048 KB
physical id : 0
siblings: 4
core id : 0
cpu cores   : 2
apicid  : 0
initial apicid  : 0
fpu : yes
fpu_exception   : yes
cpuid level : 20
wp  : yes
flags   : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb
rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc
aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg
cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer xsave
rdrand lahf_lm abm 3dnowprefetch ida arat epb pln pts dtherm intel_pt tpr_shadow
vnmi flexpriority ept vpid fsgsbase tsc_adjust erms invpcid rdseed xsaveopt
bugs:
bogomips: 3791.26
clflush size: 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor   : 1
vendor_id   : GenuineIntel
cpu family  : 6
model   : 61
model name  : Intel(R) Pentium(R) CPU 3825U @ 1.90GHz
stepping: 4
microcode   : 0x21
cpu MHz : 1845.152
cache size  : 2048 KB
physical id : 0
siblings: 4
core id : 1
cpu cores   : 2
apicid  : 2
initial apicid  : 2
fpu : yes
fpu_exception   : yes
cpuid level : 20
wp  : yes
flags   : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb
rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc
aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg
cx16 xtpr pdcm pcid 

[PATCH] rtlwifi: Delete unnecessary checks before the function call "kfree_skb"

2015-11-16 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 16 Nov 2015 13:12:25 +0100

The kfree_skb() function tests whether its argument is NULL and then
returns immediately. Thus the test around the calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/net/wireless/realtek/rtlwifi/core.c | 3 +--
 drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.c | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c 
b/drivers/net/wireless/realtek/rtlwifi/core.c
index c925a4d..4ae421e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/core.c
+++ b/drivers/net/wireless/realtek/rtlwifi/core.c
@@ -1833,8 +1833,7 @@ bool rtl_cmd_send_packet(struct ieee80211_hw *hw, struct 
sk_buff *skb)
 
spin_lock_irqsave(>locks.irq_th_lock, flags);
pskb = __skb_dequeue(>queue);
-   if (pskb)
-   kfree_skb(pskb);
+   kfree_skb(pskb);
 
/*this is wrong, fill_tx_cmddesc needs update*/
pdesc = >desc[0];
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.c
index a2f5e89..6e51862 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.c
@@ -318,9 +318,7 @@ bool rtl8723_cmd_send_packet(struct ieee80211_hw *hw,
ring = >tx_ring[BEACON_QUEUE];
 
pskb = __skb_dequeue(>queue);
-   if (pskb)
-   kfree_skb(pskb);
-
+   kfree_skb(pskb);
spin_lock_irqsave(>locks.irq_th_lock, flags);
 
pdesc = >desc[0];
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/19] staging/wilc1000: avoid static definitions in header

2015-11-16 Thread Arnd Bergmann
The wilc_wfi_cfgoperations.h header defines the ieee80211_txrx_stypes
and cipher_suites variables that are only used in wilc_wfi_cfgoperations.c
and should not be shared in a header file.

This moves over all that data into the .c file, and also moves all
the macro definitions from the file that are also not needed here.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 84 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 83 --
 2 files changed, 84 insertions(+), 83 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 49b82b4a0688..46c3f578a6fd 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -17,6 +17,90 @@
 #include "host_interface.h"
 #include 
 
+/* The following macros describe the bitfield map used by the firmware to 
determine its 11i mode */
+#define NO_ENCRYPT 0
+#define ENCRYPT_ENABLEDBIT(0)
+#define WEPBIT(1)
+#define WEP_EXTENDED   BIT(2)
+#define WPABIT(3)
+#define WPA2   BIT(4)
+#define AESBIT(5)
+#define TKIP   BIT(6)
+
+/*Public action frame index IDs*/
+#define FRAME_TYPE_ID  0
+#define ACTION_CAT_ID  24
+#define ACTION_SUBTYPE_ID  25
+#define P2P_PUB_ACTION_SUBTYPE 30
+
+/*Public action frame Attribute IDs*/
+#define ACTION_FRAME   0xd0
+#define GO_INTENT_ATTR_ID  0x04
+#define CHANLIST_ATTR_ID   0x0b
+#define OPERCHAN_ATTR_ID   0x11
+#define PUB_ACTION_ATTR_ID 0x04
+#define P2PELEM_ATTR_ID0xdd
+
+/*Public action subtype values*/
+#define GO_NEG_REQ 0x00
+#define GO_NEG_RSP 0x01
+#define GO_NEG_CONF0x02
+#define P2P_INV_REQ0x03
+#define P2P_INV_RSP0x04
+#define PUBLIC_ACT_VENDORSPEC  0x09
+#define GAS_INTIAL_REQ 0x0a
+#define GAS_INTIAL_RSP 0x0b
+
+#define INVALID_CHANNEL0
+
+#define nl80211_SCAN_RESULT_EXPIRE (3 * HZ)
+#define SCAN_RESULT_EXPIRE (40 * HZ)
+
+static const u32 cipher_suites[] = {
+   WLAN_CIPHER_SUITE_WEP40,
+   WLAN_CIPHER_SUITE_WEP104,
+   WLAN_CIPHER_SUITE_TKIP,
+   WLAN_CIPHER_SUITE_CCMP,
+   WLAN_CIPHER_SUITE_AES_CMAC,
+};
+
+static const struct ieee80211_txrx_stypes
+   wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = {
+   [NL80211_IFTYPE_STATION] = {
+   .tx = 0x,
+   .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+   BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
+   },
+   [NL80211_IFTYPE_AP] = {
+   .tx = 0x,
+   .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+   BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+   BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+   BIT(IEEE80211_STYPE_DISASSOC >> 4) |
+   BIT(IEEE80211_STYPE_AUTH >> 4) |
+   BIT(IEEE80211_STYPE_DEAUTH >> 4) |
+   BIT(IEEE80211_STYPE_ACTION >> 4)
+   },
+   [NL80211_IFTYPE_P2P_CLIENT] = {
+   .tx = 0x,
+   .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+   BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+   BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+   BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+   BIT(IEEE80211_STYPE_DISASSOC >> 4) |
+   BIT(IEEE80211_STYPE_AUTH >> 4) |
+   BIT(IEEE80211_STYPE_DEAUTH >> 4)
+   }
+};
+
+/* Time to stay on the channel */
+#define WILC_WFI_DWELL_PASSIVE 100
+#define WILC_WFI_DWELL_ACTIVE  40
+
+#define TCP_ACK_FILTER_LINK_SPEED_THRESH   54
+#define DEFAULT_LINK_SPEED 72
+
+
 #define IS_MANAGMEMENT 0x100
 #define IS_MANAGMEMENT_CALLBACK0x080
 #define IS_MGMT_STATUS_SUCCES  0x040
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index ae2aaea508db..158d98c0eb87 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -10,86 +10,6 @@
 #define NM_WFI_CFGOPERATIONS
 #include "wilc_wfi_netdevice.h"
 
-/* The following macros describe the bitfield map used by the firmware to 
determine its 11i mode */
-#define NO_ENCRYPT 0
-#define ENCRYPT_ENABLEDBIT(0)
-#define WEPBIT(1)
-#define WEP_EXTENDED   BIT(2)
-#define WPABIT(3)
-#define WPA2   BIT(4)

[PATCH 03/19] staging/wilc1000: use proper naming for global symbols

2015-11-16 Thread Arnd Bergmann
There are many global symbols in the wilc1000 driver, some of them
with names like "DEBUG_LEVEL" or "probe" that are not acceptable
for globals in the linux kernel as they may easily conflict with other
(equally broken) drivers.

This renames all the globals that do not already start with
wilc or a variation of that to start with wilc_ and to follow
the usual naming conventions.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/coreconfigurator.c   |  10 +-
 drivers/staging/wilc1000/coreconfigurator.h   |  16 +-
 drivers/staging/wilc1000/host_interface.c | 260 +++---
 drivers/staging/wilc1000/host_interface.h |  82 +++
 drivers/staging/wilc1000/linux_mon.c  |   4 +-
 drivers/staging/wilc1000/linux_wlan.c | 115 +-
 drivers/staging/wilc1000/linux_wlan_common.h  |  18 +-
 drivers/staging/wilc1000/linux_wlan_sdio.c|  50 ++---
 drivers/staging/wilc1000/linux_wlan_sdio.h|  16 +-
 drivers/staging/wilc1000/linux_wlan_spi.c |  14 +-
 drivers/staging/wilc1000/linux_wlan_spi.h |  10 +-
 drivers/staging/wilc1000/wilc_debugfs.c   |  18 +-
 drivers/staging/wilc1000/wilc_sdio.c  |  62 +++---
 drivers/staging/wilc1000/wilc_spi.c   |  48 ++--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 260 +++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |   2 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |   8 +-
 drivers/staging/wilc1000/wilc_wlan.c  |  42 ++--
 drivers/staging/wilc1000/wilc_wlan.h  |   2 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  |   6 +-
 20 files changed, 521 insertions(+), 522 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index eef06cdcc905..6a5b2273fda6 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -342,7 +342,7 @@ static u8 get_current_channel_802_11n(u8 *pu8msa, u16 
u16RxLen)
  *  @date  1 Mar 2012
  *  @version   1.0
  */
-s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
+s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
 {
tstrNetworkInfo *pstrNetworkInfo = NULL;
u8 u8MsgType = 0;
@@ -464,7 +464,7 @@ s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
  *  @date  1 Mar 2012
  *  @version   1.0
  */
-s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
+s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
 {
s32 s32Error = 0;
 
@@ -497,7 +497,7 @@ s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
  *  @date  2 Apr 2012
  *  @version   1.0
  */
-s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
+s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
   tstrConnectRespInfo **ppstrConnectRespInfo)
 {
s32 s32Error = 0;
@@ -549,7 +549,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
  *  @date  2 Apr 2012
  *  @version   1.0
  */
-s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo)
+s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo)
 {
s32 s32Error = 0;
 
@@ -586,7 +586,7 @@ s32 DeallocateAssocRespInfo(tstrConnectRespInfo 
*pstrConnectRespInfo)
  *  @date  1 Mar 2012
  *  @version   1.0
  */
-s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv)
+s32 wilc_send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv)
 {
s32 counter = 0, ret = 0;
 
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index 3253f6f1393a..912d5c2879e4 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -127,16 +127,16 @@ typedef struct {
size_t ie_len;
 } tstrDisconnectNotifInfo;
 
-s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv);
-s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
-s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo);
+s32 wilc_send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv);
+s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo);
+s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
 
-s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
+s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
   tstrConnectRespInfo **ppstrConnectRespInfo);
-s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo);
+s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo);
 
-void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length);
-void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length);
-void 

[PATCH 01/19] staging/wilc1000: remove unused functions

2015-11-16 Thread Arnd Bergmann
A number of symbols in the wilc1000 driver are completely unused
and can be removed.
This includes two variables that are only written but not read.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/host_interface.c | 295 --
 drivers/staging/wilc1000/host_interface.h |  19 --
 drivers/staging/wilc1000/linux_wlan_sdio.c|  11 -
 drivers/staging/wilc1000/linux_wlan_sdio.h|   1 -
 drivers/staging/wilc1000/linux_wlan_spi.c |  14 -
 drivers/staging/wilc1000/linux_wlan_spi.h |   1 -
 drivers/staging/wilc1000/wilc_sdio.c  |  56 
 drivers/staging/wilc1000/wilc_spi.c   | 225 -
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  36 ---
 drivers/staging/wilc1000/wilc_wlan.c  |   4 -
 10 files changed, 662 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index d5b7725ec2bf..6c205b97293d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3366,36 +3366,6 @@ s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, 
struct host_if_pmkid_at
return result;
 }
 
-s32 host_int_get_pmkid_info(struct host_if_drv *hif_drv,
-   u8 *pu8PmkidInfoArray,
-   u32 u32PmkidInfoLen)
-{
-   struct wid wid;
-
-   wid.id = (u16)WID_PMKID_INFO;
-   wid.type = WID_STR;
-   wid.size = u32PmkidInfoLen;
-   wid.val = pu8PmkidInfoArray;
-
-   return 0;
-}
-
-s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv,
-u8 *pu8PassPhrase,
-u8 u8Psklength)
-{
-   struct wid wid;
-
-   if ((u8Psklength > 7) && (u8Psklength < 65)) {
-   wid.id = (u16)WID_11I_PSK;
-   wid.type = WID_STR;
-   wid.val = pu8PassPhrase;
-   wid.size = u8Psklength;
-   }
-
-   return 0;
-}
-
 s32 hif_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
 {
s32 result = 0;
@@ -3436,19 +3406,6 @@ s32 host_int_set_MacAddress(struct host_if_drv *hif_drv, 
u8 *pu8MacAddress)
return result;
 }
 
-s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv,
-u8 *pu8PassPhrase, u8 u8Psklength)
-{
-   struct wid wid;
-
-   wid.id = (u16)WID_11I_PSK;
-   wid.type = WID_STR;
-   wid.size = u8Psklength;
-   wid.val = pu8PassPhrase;
-
-   return 0;
-}
-
 s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource)
 {
struct wid wid;
@@ -3461,18 +3418,6 @@ s32 host_int_set_start_scan_req(struct host_if_drv 
*hif_drv, u8 scanSource)
return 0;
 }
 
-s32 host_int_get_start_scan_req(struct host_if_drv *hif_drv, u8 *pu8ScanSource)
-{
-   struct wid wid;
-
-   wid.id = (u16)WID_START_SCAN_REQ;
-   wid.type = WID_CHAR;
-   wid.val = (s8 *)pu8ScanSource;
-   wid.size = sizeof(char);
-
-   return 0;
-}
-
 s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid,
  const u8 *pu8ssid, size_t ssidLen,
  const u8 *pu8IEs, size_t IEsLen,
@@ -3589,31 +3534,6 @@ s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 
u16ReasonCode)
return result;
 }
 
-s32 host_int_disconnect_station(struct host_if_drv *hif_drv, u8 assoc_id)
-{
-   struct wid wid;
-
-   wid.id = (u16)WID_DISCONNECT;
-   wid.type = WID_CHAR;
-   wid.val = (s8 *)_id;
-   wid.size = sizeof(char);
-
-   return 0;
-}
-
-s32 host_int_get_assoc_req_info(struct host_if_drv *hif_drv,
-   u8 *pu8AssocReqInfo,
-   u32 u32AssocReqInfoLen)
-{
-   struct wid wid;
-
-   wid.id = (u16)WID_ASSOC_REQ_INFO;
-   wid.type = WID_STR;
-   wid.val = pu8AssocReqInfo;
-   wid.size = u32AssocReqInfoLen;
-
-   return 0;
-}
 
 s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
u8 *pu8AssocRespInfo,
@@ -3646,20 +3566,6 @@ s32 host_int_get_assoc_res_info(struct host_if_drv 
*hif_drv,
return result;
 }
 
-s32 host_int_get_rx_power_level(struct host_if_drv *hif_drv,
-   u8 *pu8RxPowerLevel,
-   u32 u32RxPowerLevelLen)
-{
-   struct wid wid;
-
-   wid.id = (u16)WID_RX_POWER_LEVEL;
-   wid.type = WID_STR;
-   wid.val = pu8RxPowerLevel;
-   wid.size = u32RxPowerLevelLen;
-
-   return 0;
-}
-
 int host_int_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel)
 {
int result;
@@ -3740,31 +3646,6 @@ int host_int_set_operation_mode(struct host_if_drv 
*hif_drv, u32 mode)
return result;
 }
 
-s32 host_int_get_host_chnl_num(struct host_if_drv *hif_drv, u8 *pu8ChNo)
-{
-   s32 result = 0;
-   struct 

[PATCH 08/19] staging/wilc1000: move wilc_wlan_inp_t into struct wilc

2015-11-16 Thread Arnd Bergmann
wilc_wlan_inp_t is an unnecessary indirection and requires linux_wlan.c
to have knowledge of the specific sdio and spi front-ends. This
removes the structure and places io_type directly inside the struct wilc.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c | 21 ++---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 drivers/staging/wilc1000/wilc_wlan.c  | 19 +--
 drivers/staging/wilc1000/wilc_wlan_if.h   | 11 +--
 4 files changed, 17 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 6e1ef99fc856..0747a0eefe92 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -839,17 +839,6 @@ static int wlan_deinit_locks(struct net_device *dev)
return 0;
 }
 
-static void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
-{
-   PRINT_D(INIT_DBG, "Linux to Wlan services ...\n");
-
-#ifdef WILC_SDIO
-   nwi->io_func.io_type = HIF_SDIO;
-#else
-   nwi->io_func.io_type = HIF_SPI;
-#endif
-}
-
 static int wlan_initialize_threads(struct net_device *dev)
 {
perInterface_wlan_t *nic;
@@ -893,7 +882,6 @@ static void wlan_deinitialize_threads(struct net_device 
*dev)
 
 int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 {
-   wilc_wlan_inp_t nwi;
perInterface_wlan_t *nic = p_nic;
int ret = 0;
struct wilc *wl = nic->wilc;
@@ -904,9 +892,12 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
 
wlan_init_locks(dev);
 
-   linux_to_wlan(, wl);
-
-   ret = wilc_wlan_init(dev, );
+#ifdef WILC_SDIO
+   wl->io_type = HIF_SDIO;
+#else
+   wl->io_type = HIF_SPI;
+#endif
+   ret = wilc_wlan_init(dev);
if (ret < 0) {
PRINT_ER("Initializing WILC_Wlan FAILED\n");
ret = -EIO;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 3358fe3bcd0a..0c608d73a22e 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -156,6 +156,7 @@ struct wilc_vif {
 };
 
 struct wilc {
+   int io_type;
int mac_status;
bool initialized;
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index f7359f79ff8d..2958689a13c6 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -5,7 +5,7 @@
 
 typedef struct {
int quit;
-   wilc_wlan_io_func_t io_func;
+   int io_type;
struct wilc_hif_func hif_func;
int cfg_frame_in_use;
struct wilc_cfg_frame cfg_frame;
@@ -576,7 +576,7 @@ static inline void chip_wakeup(void)
u32 reg, clk_status_reg, trials = 0;
u32 sleep_time;
 
-   if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) {
+   if ((g_wlan.io_type & 0x1) == HIF_SPI) {
do {
g_wlan.hif_func.hif_read_reg(1, );
g_wlan.hif_func.hif_write_reg(1, reg | BIT(1));
@@ -590,7 +590,7 @@ static inline void chip_wakeup(void)
} while ((wilc_get_chipid(true) == 0) && ((++trials % 
3) == 0));
 
} while (wilc_get_chipid(true) == 0);
-   } else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO)   {
+   } else if ((g_wlan.io_type & 0x1) == HIF_SDIO)   {
g_wlan.hif_func.hif_read_reg(0xf0, );
do {
g_wlan.hif_func.hif_write_reg(0xf0, reg | BIT(0));
@@ -636,12 +636,12 @@ static inline void chip_wakeup(void)
u32 reg, trials = 0;
 
do {
-   if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) {
+   if ((g_wlan.io_type & 0x1) == HIF_SPI) {
g_wlan.hif_func.hif_read_reg(1, );
g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1));
g_wlan.hif_func.hif_write_reg(1, reg | BIT(1));
g_wlan.hif_func.hif_write_reg(1, reg  & ~BIT(1));
-   } else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO)   {
+   } else if ((g_wlan.io_type & 0x1) == HIF_SDIO)   {
g_wlan.hif_func.hif_read_reg(0xf0, );
g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0));
g_wlan.hif_func.hif_write_reg(0xf0, reg | BIT(0));
@@ -1252,10 +1252,10 @@ int wilc_wlan_start(void)
int ret;
u32 chipid;
 
-   if (p->io_func.io_type == HIF_SDIO) {
+   if (p->io_type == HIF_SDIO) {
reg = 0;
reg |= BIT(3);
-   } else if (p->io_func.io_type == HIF_SPI) {
+   } else if (p->io_type == HIF_SPI) {

[PATCH 14/19] staging/wilc1000: pass hif operations through initialization

2015-11-16 Thread Arnd Bergmann
The wilc_hif_spi and wilc_hif_sdio structures are part of
the bus specific code, and the generic code should have no knowledge
of their addresses.

This changes the code to reference them only from the bus
specific initialization code, which we can then use to split
up the driver into separate modules.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c |  4 ++-
 drivers/staging/wilc1000/linux_wlan_sdio.c|  3 ++-
 drivers/staging/wilc1000/linux_wlan_spi.c |  2 +-
 drivers/staging/wilc1000/wilc_sdio.c  | 35 +--
 drivers/staging/wilc1000/wilc_spi.c   | 34 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  4 ++-
 drivers/staging/wilc1000/wilc_wlan.c  | 15 ++--
 drivers/staging/wilc1000/wilc_wlan.h  |  4 +--
 8 files changed, 47 insertions(+), 54 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index e81e90678d0f..2fb1d97bded1 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1408,7 +1408,8 @@ void wilc_netdev_cleanup(struct wilc *wilc)
 #endif
 }
 
-int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, int 
gpio)
+int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
+int gpio, const struct wilc_hif_func *ops)
 {
int i;
perInterface_wlan_t *nic;
@@ -1423,6 +1424,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type, int gp
*wilc = wilc_dev;
wilc_dev->io_type = io_type;
wilc_dev->gpio = gpio;
+   wilc_dev->ops = ops;
 
register_inetaddr_notifier(_dev_notifier);
 
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 732b0d66366b..f4250fda6cf1 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -119,7 +119,8 @@ static int linux_sdio_probe(struct sdio_func *func, const 
struct sdio_device_id
 
PRINT_D(INIT_DBG, "Initializing netdev\n");
wilc_sdio_func = func;
-   if (wilc_netdev_init(, >dev, HIF_SDIO, gpio)) {
+   if (wilc_netdev_init(, >dev, HIF_SDIO, gpio,
+_hif_sdio)) {
PRINT_ER("Couldn't initialize netdev\n");
return -1;
}
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index f4dda4a6fa7b..a7a52593156a 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -404,7 +404,7 @@ static int __init init_wilc_spi_driver(void)
 
wilc_debugfs_init();
 
-   ret = wilc_netdev_init(, NULL, HIF_SPI, GPIO_NUM);
+   ret = wilc_netdev_init(, NULL, HIF_SPI, GPIO_NUM, _hif_spi);
if (ret) {
wilc_debugfs_remove();
return ret;
diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 8441fcc4..006aae4679cb 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -912,23 +912,22 @@ static int sdio_sync_ext(int nint /*  how mant interrupts 
to enable. */)
  *
  /
 
-struct wilc_hif_func wilc_hif_sdio = {
-   sdio_init,
-   sdio_deinit,
-   sdio_read_reg,
-   sdio_write_reg,
-   sdio_read,
-   sdio_write,
-   sdio_sync,
-   sdio_clear_int,
-   sdio_read_int,
-   sdio_clear_int_ext,
-   sdio_read_size,
-   sdio_write,
-   sdio_read,
-   sdio_sync_ext,
-
-   sdio_set_max_speed,
-   sdio_set_default_speed,
+const struct wilc_hif_func wilc_hif_sdio = {
+   .hif_init = sdio_init,
+   .hif_deinit = sdio_deinit,
+   .hif_read_reg = sdio_read_reg,
+   .hif_write_reg = sdio_write_reg,
+   .hif_block_rx = sdio_read,
+   .hif_block_tx = sdio_write,
+   .hif_sync = sdio_sync,
+   .hif_clear_int = sdio_clear_int,
+   .hif_read_int = sdio_read_int,
+   .hif_clear_int_ext = sdio_clear_int_ext,
+   .hif_read_size = sdio_read_size,
+   .hif_block_tx_ext = sdio_write,
+   .hif_block_rx_ext = sdio_read,
+   .hif_sync_ext = sdio_sync_ext,
+   .hif_set_max_bus_speed = sdio_set_max_speed,
+   .hif_set_default_bus_speed = sdio_set_default_speed,
 };
 
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index dc9cdf5e4065..39dd75665ba7 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -1021,21 +1021,21 @@ static int wilc_spi_sync_ext(int nint /*  how mant 
interrupts to enable. */)
  *  Global spi HIF function table
  *
  /
-struct wilc_hif_func wilc_hif_spi = {
-   _wilc_spi_init,
-   _wilc_spi_deinit,
-   wilc_spi_read_reg,
-   

[PATCH 04/19] staging/wilc1000: move extern declarations to headers

2015-11-16 Thread Arnd Bergmann
'extern' declarations belong into a header file rather than
a .c file, to ensure that the definition matches the declaration.

This moves all declarations into a header file that seems
most appropriate for it.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/host_interface.c |  9 +
 drivers/staging/wilc1000/host_interface.h |  9 +
 drivers/staging/wilc1000/linux_mon.c  |  3 ---
 drivers/staging/wilc1000/linux_wlan.c |  9 -
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  6 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  1 -
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 ++
 drivers/staging/wilc1000/wilc_wlan.c  |  8 +---
 drivers/staging/wilc1000/wilc_wlan.h  | 21 +
 9 files changed, 35 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 228a2fefe714..d968483c6f00 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4,17 +4,12 @@
 #include 
 #include "host_interface.h"
 #include "coreconfigurator.h"
+#include "wilc_wlan.h"
 #include "wilc_wlan_if.h"
 #include "wilc_msgqueue.h"
 #include 
 #include "wilc_wfi_netdevice.h"
 
-extern u8 wilc_connecting;
-
-extern struct timer_list wilc_during_ip_timer;
-
-extern u8 wilc_initialized;
-
 #define HOST_IF_MSG_SCAN0
 #define HOST_IF_MSG_CONNECT 1
 #define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO2
@@ -271,8 +266,6 @@ static struct host_if_drv *join_req_drv;
 
 static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo);
 
-extern int wilc_wlan_get_num_conn_ifcs(void);
-
 static int add_handler_in_list(struct host_if_drv *handler)
 {
int i;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index d0b85a53c29e..efeb9e233589 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -394,4 +394,13 @@ void wilc_free_join_params(void *pJoinParams);
 s32 wilc_get_statistics(struct host_if_drv *hWFIDrv,
struct rf_info *pstrStatistics);
 void wilc_resolve_disconnect_aberration(struct host_if_drv *hif_drv);
+
+extern bool wilc_optaining_ip;
+extern u8 wilc_connected_SSID[6];
+extern u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
+
+extern int wilc_connecting;
+extern u8 wilc_initialized;
+extern struct timer_list wilc_during_ip_timer;
+
 #endif
diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index f0a458764ff2..e550027645b7 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -26,9 +26,6 @@ struct wilc_wfi_radiotap_cb_hdr {
 
 static struct net_device *wilc_wfi_mon; /* global monitor netdev */
 
-extern int  wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-
-
 static u8 srcAdd[6];
 static u8 bssid[6];
 static u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index d3d07fc30e23..f1e70b225deb 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -37,10 +37,6 @@
  #define _linux_wlan_device_detection(){}
  #define _linux_wlan_device_removal()  {}
 
-extern bool wilc_optaining_ip;
-extern u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
-extern struct timer_list wilc_during_ip_timer;
-
 static int linux_wlan_device_power(int on_off)
 {
PRINT_D(INIT_DBG, "linux_wlan_device_power.. (%d)\n", on_off);
@@ -81,14 +77,9 @@ static struct semaphore close_exit_sync;
 
 static int wlan_deinit_locks(struct net_device *dev);
 static void wlan_deinitialize_threads(struct net_device *dev);
-extern void WILC_WFI_monitor_rx(u8 *buff, u32 size);
-extern void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
 
 static void linux_wlan_tx_complete(void *priv, int status);
 static int  mac_init_fn(struct net_device *ndev);
-int  wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-int  wilc_mac_open(struct net_device *ndev);
-int  wilc_mac_close(struct net_device *ndev);
 static struct net_device_stats *mac_stats(struct net_device *dev);
 static int  mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd);
 static void wilc_set_multicast_list(struct net_device *dev);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index f8fd7a895d44..49b82b4a0688 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -14,6 +14,7 @@
 #ifdef WILC_SDIO
 #include "linux_wlan_sdio.h"
 #endif
+#include "host_interface.h"
 #include 
 
 #define IS_MANAGMEMENT 

[PATCH 15/19] staging/wilc1000: turn enable_irq/disable_irq into callbacks

2015-11-16 Thread Arnd Bergmann
As a preparation for turning the SDIO side of wilc1000 into a separate
module, this removes the last direct caller from the core module into
the sdio specific portion. All calls to wilc_sdio_enable_interrupt()
and wilc_sdio_disable_interrupt() now go through a function pointer
in wilc_hif_func. We also change arguments slightly to pass the device,
as we are already touching those lines and the change will be needed
later to remove the global variables.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c  | 22 +-
 drivers/staging/wilc1000/linux_wlan_sdio.c | 21 +++--
 drivers/staging/wilc1000/linux_wlan_sdio.h |  4 ++--
 drivers/staging/wilc1000/wilc_sdio.c   |  2 ++
 drivers/staging/wilc1000/wilc_wlan.h   |  2 ++
 5 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 2fb1d97bded1..1b6e1eec2446 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -25,8 +25,6 @@
 
 #include 
 
-#include "linux_wlan_sdio.h"
-
 static int dev_state_ev_handler(struct notifier_block *this, unsigned long 
event, void *ptr);
 
 static struct notifier_block g_dev_notifier = {
@@ -739,9 +737,10 @@ void wilc1000_wlan_deinit(struct net_device *dev)
 #endif
 
PRINT_D(INIT_DBG, "Disabling IRQ\n");
-   if (!wl->dev_irq_num) {
+   if (!wl->dev_irq_num &&
+   wl->ops->disable_interrupt) {
mutex_lock(>hif_cs);
-   wilc_sdio_disable_interrupt();
+   wl->ops->disable_interrupt(wl);
mutex_unlock(>hif_cs);
}
if (>txq_event)
@@ -758,11 +757,13 @@ void wilc1000_wlan_deinit(struct net_device *dev)
PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
wilc_wlan_cleanup(dev);
 #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || 
defined(PLAT_ALLWINNER_A31)
-   if (!wl->dev_irq_num) {
+   if (!wl->dev_irq_num &&
+   wl->ops->disable_interrupt) {
+
PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
 
mutex_lock(>hif_cs);
-   wilc_sdio_disable_interrupt();
+   wl->ops->disable_interrupt(wl);
mutex_unlock(>hif_cs);
}
 #endif
@@ -897,7 +898,9 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
goto _fail_wilc_wlan_;
}
 
-   if (!wl->dev_irq_num && wilc_sdio_enable_interrupt()) {
+   if (!wl->dev_irq_num &&
+   wl->ops->enable_interrupt &&
+   wl->ops->enable_interrupt(wl)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_irq_init_;
@@ -950,8 +953,9 @@ _fail_fw_start_:
wilc_wlan_stop();
 
 _fail_irq_enable_:
-   if (!wl->dev_irq_num)
-   wilc_sdio_disable_interrupt();
+   if (!wl->dev_irq_num &&
+   wl->ops->disable_interrupt)
+   wl->ops->disable_interrupt(wl);
 _fail_irq_init_:
if (wl->dev_irq_num)
deinit_irq(dev);
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index f4250fda6cf1..9072de43bcd9 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -1,5 +1,4 @@
 #include "wilc_wfi_netdevice.h"
-#include "linux_wlan_sdio.h"
 
 #include 
 #include 
@@ -8,7 +7,7 @@
 #include 
 #include 
 
-
+#include "linux_wlan_sdio.h"
 
 #define SDIO_MODALIAS "wilc1000_sdio"
 
@@ -143,13 +142,14 @@ static struct sdio_driver wilc_bus = {
.remove = linux_sdio_remove,
 };
 
-int wilc_sdio_enable_interrupt(void)
+int wilc_sdio_enable_interrupt(struct wilc *dev)
 {
+   struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev);
int ret = 0;
 
-   sdio_claim_host(wilc_sdio_func);
-   ret = sdio_claim_irq(wilc_sdio_func, wilc_sdio_interrupt);
-   sdio_release_host(wilc_sdio_func);
+   sdio_claim_host(func);
+   ret = sdio_claim_irq(func, wilc_sdio_interrupt);
+   sdio_release_host(func);
 
if (ret < 0) {
PRINT_ER("can't claim sdio_irq, err(%d)\n", ret);
@@ -158,18 +158,19 @@ int wilc_sdio_enable_interrupt(void)
return ret;
 }
 
-void wilc_sdio_disable_interrupt(void)
+void wilc_sdio_disable_interrupt(struct wilc *dev)
 {
+   struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev);
int ret;
 
PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt IN\n");
 
-   sdio_claim_host(wilc_sdio_func);
-   ret = 

[PATCH 07/19] staging/wilc1000: remove linux_wlan_{device_power,device_detection}

2015-11-16 Thread Arnd Bergmann
The driver provides an interface for custom power management
and detection that is meant to be filled by people customizing
the driver. The default implementation of this is empty, and
we don't actually want people to have to modify the source code.

If anybody needs this, they need to describe the respective
hardware specifics using device tree or platform data and make
the driver handle this is a more general way.

This removes the empty stubs.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c | 40 ---
 1 file changed, 40 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 040caa0d0d0b..6e1ef99fc856 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -31,40 +31,6 @@
 #include "linux_wlan_spi.h"
 #endif
 
- #define _linux_wlan_device_power_on() {}
- #define _linux_wlan_device_power_off(){}
-
- #define _linux_wlan_device_detection(){}
- #define _linux_wlan_device_removal()  {}
-
-static int linux_wlan_device_power(int on_off)
-{
-   PRINT_D(INIT_DBG, "linux_wlan_device_power.. (%d)\n", on_off);
-
-   if (on_off) {
-   _linux_wlan_device_power_on();
-   } else {
-   _linux_wlan_device_power_off();
-   }
-
-   return 0;
-}
-
-static int linux_wlan_device_detection(int on_off)
-{
-   PRINT_D(INIT_DBG, "linux_wlan_device_detection.. (%d)\n", on_off);
-
-#ifdef WILC_SDIO
-   if (on_off) {
-   _linux_wlan_device_detection();
-   } else {
-   _linux_wlan_device_removal();
-   }
-#endif
-
-   return 0;
-}
-
 static int dev_state_ev_handler(struct notifier_block *this, unsigned long 
event, void *ptr);
 
 static struct notifier_block g_dev_notifier = {
@@ -1476,8 +1442,6 @@ void wl_wlan_cleanup(struct wilc *wilc)
 #if defined(WILC_DEBUGFS)
wilc_debugfs_remove();
 #endif
-   linux_wlan_device_detection(0);
-   linux_wlan_device_power(0);
 }
 
 int wilc_netdev_init(struct wilc **wilc)
@@ -1579,10 +1543,6 @@ static int __init init_wilc_driver(void)
printk("IN INIT FUNCTION\n");
printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
 
-   linux_wlan_device_power(1);
-   msleep(100);
-   linux_wlan_device_detection(1);
-
 #ifdef WILC_SDIO
{
int ret;
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/19] staging/wilc1000: use device pointer for phy creation

2015-11-16 Thread Arnd Bergmann
wilc_create_wiphy tries to get a pointer to a device from the
global wilc_sdio_func variable. This is a layering violation
and we can use the wilc_dev->dev pointer instead.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c | 2 +-
 drivers/staging/wilc1000/linux_wlan_sdio.c| 2 +-
 drivers/staging/wilc1000/linux_wlan_sdio.h| 2 --
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 9 ++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 +-
 5 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index b1707147aa7d..08c3be8728b2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1457,7 +1457,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type)
 
{
struct wireless_dev *wdev;
-   wdev = wilc_create_wiphy(ndev);
+   wdev = wilc_create_wiphy(ndev, dev);
 
if (dev)
SET_NETDEV_DEV(ndev, dev);
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index d2843b949a1b..874a859cad21 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -22,7 +22,7 @@
  #define MAX_SPEED (6 * 100) /* Max 50M */
 #endif
 
-struct sdio_func *wilc_sdio_func;
+static struct sdio_func *wilc_sdio_func;
 static unsigned int sdio_default_speed;
 
 #define SDIO_VENDOR_ID_WILC 0x0296
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h 
b/drivers/staging/wilc1000/linux_wlan_sdio.h
index 3e1618526e78..df733c25e770 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.h
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.h
@@ -1,7 +1,5 @@
 #include 
 
-extern struct sdio_func *wilc_sdio_func;
-
 int wilc_sdio_init(void);
 int wilc_sdio_cmd52(sdio_cmd52_t *cmd);
 int wilc_sdio_cmd53(sdio_cmd53_t *cmd);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 46c3f578a6fd..cc279c654e53 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -11,9 +11,6 @@
  */
 
 #include "wilc_wfi_cfgoperations.h"
-#ifdef WILC_SDIO
-#include "linux_wlan_sdio.h"
-#endif
 #include "host_interface.h"
 #include 
 
@@ -3414,7 +3411,7 @@ _fail_:
  *  @date  01 MAR 2012
  *  @version   1.0
  */
-struct wireless_dev *wilc_create_wiphy(struct net_device *net)
+struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device 
*dev)
 {
struct wilc_priv *priv;
struct wireless_dev *wdev;
@@ -3466,9 +3463,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device 
*net)
   wdev->wiphy->max_scan_ssids, wdev->wiphy->max_scan_ie_len, 
wdev->wiphy->signal_type,
   wdev->wiphy->interface_modes, wdev->iftype);
 
-   #ifdef WILC_SDIO
-   set_wiphy_dev(wdev->wiphy, _sdio_func->dev);
-   #endif
+   set_wiphy_dev(wdev->wiphy, dev);
 
/*Register wiphy structure*/
s32Error = wiphy_register(wdev->wiphy);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index 158d98c0eb87..ab53d9d59081 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -10,7 +10,7 @@
 #define NM_WFI_CFGOPERATIONS
 #include "wilc_wfi_netdevice.h"
 
-struct wireless_dev *wilc_create_wiphy(struct net_device *net);
+struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device 
*dev);
 void wilc_free_wiphy(struct net_device *net);
 int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed);
 int wilc_deinit_host_int(struct net_device *net);
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 18/19] staging/wilc1000: use more regular probing

2015-11-16 Thread Arnd Bergmann
So far, my patches tried to do equivalent conversions of the
existing code.  This one goes beyond that by restructuring
how the devices get probed. In particular, the spi driver
no longer creates the netdev until the device is probed,
and I've removed the global wilc_sdio_func and wilc_spi_dev
variables in favor of retrieving them from the wilc_dev
variable that will eventually get passed through all functions
instead of using a global.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c|   6 +-
 drivers/staging/wilc1000/linux_wlan_common.h |  12 ---
 drivers/staging/wilc1000/linux_wlan_sdio.c   |  30 +++
 drivers/staging/wilc1000/linux_wlan_spi.c| 122 +--
 drivers/staging/wilc1000/wilc_debugfs.c  |   6 +-
 5 files changed, 58 insertions(+), 118 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 0d6c22ca7920..c3b521e085f2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1408,10 +1408,6 @@ void wilc_netdev_cleanup(struct wilc *wilc)
}
 
kfree(wilc);
-
-#if defined(WILC_DEBUGFS)
-   wilc_debugfs_remove();
-#endif
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
 
@@ -1491,3 +1487,5 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
return 0;
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_init);
+
+MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_common.h 
b/drivers/staging/wilc1000/linux_wlan_common.h
index f2ea8280b8f8..72b524a98cba 100644
--- a/drivers/staging/wilc1000/linux_wlan_common.h
+++ b/drivers/staging/wilc1000/linux_wlan_common.h
@@ -38,9 +38,6 @@ enum debug_region {
 #define FIRM_DBG(1 << Firmware_debug)
 
 #if defined (WILC_DEBUGFS)
-int wilc_debugfs_init(void);
-void wilc_debugfs_remove(void);
-
 extern atomic_t WILC_REGION;
 extern atomic_t WILC_DEBUG_LEVEL;
 
@@ -122,15 +119,6 @@ extern atomic_t WILC_DEBUG_LEVEL;
printk(__VA_ARGS__);\
} while (0)
 
-static inline int wilc_debugfs_init(void)
-{
-   return 0;
-}
-
-static inline void wilc_debugfs_remove(void)
-{
-}
-
 #endif
 
 #define FN_IN   /* PRINT_D(">>> \n") */
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 9072de43bcd9..1f366b5f0d2d 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -135,12 +135,14 @@ static void linux_sdio_remove(struct sdio_func *func)
wilc_netdev_cleanup(sdio_get_drvdata(func));
 }
 
-static struct sdio_driver wilc_bus = {
+static struct sdio_driver wilc1000_sdio_driver = {
.name   = SDIO_MODALIAS,
.id_table   = wilc_sdio_ids,
.probe  = linux_sdio_probe,
.remove = linux_sdio_remove,
 };
+module_driver(wilc1000_sdio_driver, sdio_register_driver, 
sdio_unregister_driver);
+MODULE_LICENSE("GPL");
 
 int wilc_sdio_enable_interrupt(struct wilc *dev)
 {
@@ -178,14 +180,15 @@ void wilc_sdio_disable_interrupt(struct wilc *dev)
 static int linux_sdio_set_speed(int speed)
 {
struct mmc_ios ios;
+   struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, 
dev);
 
-   sdio_claim_host(wilc_sdio_func);
+   sdio_claim_host(func);
 
-   memcpy((void *), (void *)_sdio_func->card->host->ios, 
sizeof(struct mmc_ios));
-   wilc_sdio_func->card->host->ios.clock = speed;
+   memcpy((void *), (void *)>card->host->ios, sizeof(struct 
mmc_ios));
+   func->card->host->ios.clock = speed;
ios.clock = speed;
-   wilc_sdio_func->card->host->ops->set_ios(wilc_sdio_func->card->host, 
);
-   sdio_release_host(wilc_sdio_func);
+   func->card->host->ops->set_ios(func->card->host, );
+   sdio_release_host(func);
PRINT_INFO(INIT_DBG, " change SDIO speed to %d 
@\n", speed);
 
return 1;
@@ -193,7 +196,8 @@ static int linux_sdio_set_speed(int speed)
 
 static int linux_sdio_get_speed(void)
 {
-   return wilc_sdio_func->card->host->ios.clock;
+   struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, 
dev);
+   return func->card->host->ios.clock;
 }
 
 int wilc_sdio_init(void)
@@ -218,16 +222,4 @@ int wilc_sdio_set_default_speed(void)
return linux_sdio_set_speed(sdio_default_speed);
 }
 
-static int __init init_wilc_sdio_driver(void)
-{
-   return sdio_register_driver(_bus);
-}
-late_initcall(init_wilc_sdio_driver);
-
-static void __exit exit_wilc_sdio_driver(void)
-{
-   sdio_unregister_driver(_bus);
-}
-module_exit(exit_wilc_sdio_driver);
-
 MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index a7a52593156a..1d8922d6eb6a 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ 

[PATCH] NFC: nci: fix memory leak

2015-11-16 Thread Sudip Mukherjee
In case of invalid number_destination_params we were returning error but
we missed releasing cmd. Lets check for the number of parameter before
allocating memory so that we don't have a memory leak.

Signed-off-by: Sudip Mukherjee 
---
 net/nfc/nci/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 10c99a5..fbb7a2b 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -610,14 +610,14 @@ int nci_core_conn_create(struct nci_dev *ndev, u8 
destination_type,
struct nci_core_conn_create_cmd *cmd;
struct core_conn_create_data data;
 
+   if (!number_destination_params)
+   return -EINVAL;
+
data.length = params_len + sizeof(struct nci_core_conn_create_cmd);
cmd = kzalloc(data.length, GFP_KERNEL);
if (!cmd)
return -ENOMEM;
 
-   if (!number_destination_params)
-   return -EINVAL;
-
cmd->destination_type = destination_type;
cmd->number_destination_params = number_destination_params;
memcpy(cmd->params, params, params_len);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 17/19] staging/wilc1000: split out bus specific modules

2015-11-16 Thread Arnd Bergmann
The SPI and SDIO specific code is now separate enough that
we just need to restructure the Makefile and Kconfig logic
a bit and export a couple of symbols from the common module
to have separate bus glue drivers.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/Kconfig| 66 ++---
 drivers/staging/wilc1000/Makefile   |  7 +++-
 drivers/staging/wilc1000/linux_wlan.c   |  4 ++
 drivers/staging/wilc1000/wilc_debugfs.c |  2 +
 drivers/staging/wilc1000/wilc_wlan.c|  1 +
 5 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/drivers/staging/wilc1000/Kconfig b/drivers/staging/wilc1000/Kconfig
index ee51b4278088..2923122346ef 100644
--- a/drivers/staging/wilc1000/Kconfig
+++ b/drivers/staging/wilc1000/Kconfig
@@ -1,41 +1,12 @@
-config WILC1000_DRIVER
-   bool "WILC1000 support (WiFi only)"
-   depends on CFG80211 && WEXT_CORE && INET
-   ---help---
- This module only support IEEE 802.11n WiFi.
-
-if WILC1000_DRIVER
-
 config WILC1000
tristate
-
-choice
-prompt "Memory Allocation"
-default WILC1000_PREALLOCATE_AT_LOADING_DRIVER
-
-config WILC1000_PREALLOCATE_AT_LOADING_DRIVER
-   bool "Preallocate memory at loading driver"
+   select WIRELESS_EXT
---help---
- This choice supports static allocation of the memory
- for the receive buffer. The driver will allocate the RX buffer
- during initial time. The driver will also free the buffer
- by calling network device stop.
-
-config WILC1000_DYNAMICALLY_ALLOCATE_MEMROY
-bool "Dynamically allocate memory in real time"
----help---
- This choice supports dynamic allocation of the memory
- for the receive buffer. The driver will allocate the RX buffer
- when it is required.
-endchoice
-
-choice
-   prompt "Bus Type"
-   default WILC1000_SDIO
+ This module only support IEEE 802.11n WiFi.
 
 config WILC1000_SDIO
-   bool "SDIO support"
-   depends on MMC
+   tristate "Atmel WILC1000 SDIO (WiFi only)"
+   depends on CFG80211 && INET && MMC
select WILC1000
---help---
  This module adds support for the SDIO interface of adapters using
@@ -48,9 +19,9 @@ config WILC1000_SDIO
  this if your platform is using the SDIO bus.
 
 config WILC1000_SPI
-   depends on SPI
+   tristate "Atmel WILC1000 SPI (WiFi only)"
+   depends on CFG80211 && INET && SPI
select WILC1000
-   bool "SPI support"
---help---
  This module adds support for the SPI interface of adapters using
  WILC1000 chipset. The Atmel WILC1000 has a Serial Peripheral
@@ -59,10 +30,31 @@ config WILC1000_SPI
  full-duplex slave synchronous serial interface that is available
  immediately following reset when pin 9 (SDIO_SPI_CFG) is tied to
  VDDIO. Select this if your platform is using the SPI bus.
+
+choice
+prompt "WILC1000 Memory Allocation"
+depends on WILC1000
+default WILC1000_PREALLOCATE_AT_LOADING_DRIVER
+
+config WILC1000_PREALLOCATE_AT_LOADING_DRIVER
+   bool "Preallocate memory at loading driver"
+   ---help---
+ This choice supports static allocation of the memory
+ for the receive buffer. The driver will allocate the RX buffer
+ during initial time. The driver will also free the buffer
+ by calling network device stop.
+
+config WILC1000_DYNAMICALLY_ALLOCATE_MEMROY
+bool "Dynamically allocate memory in real time"
+---help---
+ This choice supports dynamic allocation of the memory
+ for the receive buffer. The driver will allocate the RX buffer
+ when it is required.
 endchoice
 
+
 config WILC1000_HW_OOB_INTR
-   bool "Use out of band interrupt"
+   bool "WILC1000 out of band interrupt"
depends on WILC1000_SDIO
default n
---help---
@@ -71,5 +63,3 @@ config WILC1000_HW_OOB_INTR
  mechanism for SDIO host controllers that don't support SDIO interrupt.
  Select this option If the SDIO host controller in your platform
  doesn't support SDIO time devision interrupt.
-
-endif
diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index dcba27bd3bce..198d536da57c 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -21,5 +21,8 @@ wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o 
linux_mon.o \
wilc_wlan_cfg.o wilc_debugfs.o \
wilc_wlan.o
 
-wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o wilc_sdio.o
-wilc1000-$(CONFIG_WILC1000_SPI) += linux_wlan_spi.o wilc_spi.o
+obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
+wilc1000-sdio-objs += linux_wlan_sdio.o wilc_sdio.o
+
+obj-$(CONFIG_WILC1000_SPI) += wilc1000-spi.o
+wilc1000-spi-objs += linux_wlan_spi.o wilc_spi.o
diff --git 

[PATCH 13/19] staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO

2015-11-16 Thread Arnd Bergmann
Whether the SDIO function uses an internal or external interrupt
should not be a compiletime decision but be determined at runtime.

This changes the code to pass a GPIO number from the init code
as early as possible, and leaves just one #ifdef WILC_SDIO_IRQ_GPIO
to preserve the previous behavior.

All other locations that check for the interrupt method are turned
into runtime checks based on the gpio number (>=0) or the interrupt
number (>0).

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/Makefile |   1 -
 drivers/staging/wilc1000/linux_wlan.c |  69 -
 drivers/staging/wilc1000/linux_wlan_sdio.c|  18 ++---
 drivers/staging/wilc1000/linux_wlan_spi.c |   2 +-
 drivers/staging/wilc1000/wilc_sdio.c  | 105 +++---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |   7 +-
 drivers/staging/wilc1000/wilc_wlan.c  |   8 +-
 7 files changed, 92 insertions(+), 118 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index 9696f69bda48..fe480c76c521 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -1,7 +1,6 @@
 obj-$(CONFIG_WILC1000) += wilc1000.o
 
 ccflags-$(CONFIG_WILC1000_SDIO) += -DWILC_SDIO -DCOMPLEMENT_BOOT
-ccflags-$(CONFIG_WILC1000_HW_OOB_INTR) += -DWILC_SDIO_IRQ_GPIO
 ccflags-$(CONFIG_WILC1000_SPI) += -DWILC_SPI
 
 ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 08c3be8728b2..e81e90678d0f 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -161,7 +161,6 @@ static int dev_state_ev_handler(struct notifier_block 
*this, unsigned long event
return NOTIFY_DONE;
 }
 
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
 static irqreturn_t isr_uh_routine(int irq, void *user_data)
 {
perInterface_wlan_t *nic;
@@ -207,9 +206,9 @@ static int init_irq(struct net_device *dev)
nic = netdev_priv(dev);
wl = nic->wilc;
 
-   if ((gpio_request(GPIO_NUM, "WILC_INTR") == 0) &&
-   (gpio_direction_input(GPIO_NUM) == 0)) {
-   wl->dev_irq_num = gpio_to_irq(GPIO_NUM);
+   if ((gpio_request(wl->gpio, "WILC_INTR") == 0) &&
+   (gpio_direction_input(wl->gpio) == 0)) {
+   wl->dev_irq_num = gpio_to_irq(wl->gpio);
} else {
ret = -1;
PRINT_ER("could not obtain gpio for WILC_INTR\n");
@@ -220,16 +219,16 @@ static int init_irq(struct net_device *dev)
  isr_bh_routine,
  IRQF_TRIGGER_LOW | IRQF_ONESHOT,
  "WILC_IRQ", dev) < 0) {
-   PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM);
+   PRINT_ER("Failed to request IRQ for GPIO: %d\n", wl->gpio);
+   gpio_free(wl->gpio);
ret = -1;
} else {
PRINT_D(INIT_DBG, "IRQ request succeeded IRQ-NUM= %d on GPIO: 
%d\n",
-   wl->dev_irq_num, GPIO_NUM);
+   wl->dev_irq_num, wl->gpio);
}
 
return ret;
 }
-#endif
 
 static void deinit_irq(struct net_device *dev)
 {
@@ -239,13 +238,11 @@ static void deinit_irq(struct net_device *dev)
nic = netdev_priv(dev);
wilc = nic->wilc;
 
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
-   if (>dev_irq_num != 0) {
+   /* Deintialize IRQ */
+   if (wilc->dev_irq_num) {
free_irq(wilc->dev_irq_num, wilc);
-
-   gpio_free(GPIO_NUM);
+   gpio_free(wilc->gpio);
}
-#endif
 }
 
 void linux_wlan_dbg(u8 *buff)
@@ -742,11 +739,11 @@ void wilc1000_wlan_deinit(struct net_device *dev)
 #endif
 
PRINT_D(INIT_DBG, "Disabling IRQ\n");
-#ifdef WILC_SDIO
-   mutex_lock(>hif_cs);
-   wilc_sdio_disable_interrupt();
-   mutex_unlock(>hif_cs);
-#endif
+   if (!wl->dev_irq_num) {
+   mutex_lock(>hif_cs);
+   wilc_sdio_disable_interrupt();
+   mutex_unlock(>hif_cs);
+   }
if (>txq_event)
up(>txq_event);
 
@@ -760,14 +757,14 @@ void wilc1000_wlan_deinit(struct net_device *dev)
 
PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
wilc_wlan_cleanup(dev);
-#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
-  #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || 
defined(PLAT_ALLWINNER_A31)
-   PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
-
-   mutex_lock(>hif_cs);
-   wilc_sdio_disable_interrupt();
-   mutex_unlock(>hif_cs);
-  #endif
+#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || 

[PATCH 16/19] staging/wilc1000: remove WILC_SDIO/WILC_SPI macros

2015-11-16 Thread Arnd Bergmann
The last remaining user of WILC_SDIO macro checks for the correct
time to wait in an interrupt for the PLL to settle. We can
replace this with a runtime check and remove both WILC_SDIO and
WILC_SPI, as we no longer need conditional compilation based on
the hardware type.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/Makefile| 3 +--
 drivers/staging/wilc1000/wilc_wlan.c | 5 -
 drivers/staging/wilc1000/wilc_wlan.h | 7 ++-
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index fe480c76c521..dcba27bd3bce 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -1,7 +1,6 @@
 obj-$(CONFIG_WILC1000) += wilc1000.o
 
-ccflags-$(CONFIG_WILC1000_SDIO) += -DWILC_SDIO -DCOMPLEMENT_BOOT
-ccflags-$(CONFIG_WILC1000_SPI) += -DWILC_SPI
+ccflags-$(CONFIG_WILC1000_SDIO) += -DCOMPLEMENT_BOOT
 
 ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
-DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 5e37ec65d3bb..f72f976906cc 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1067,7 +1067,10 @@ static void wilc_pllupdate_isr_ext(u32 int_stats)
 
g_wlan.hif_func.hif_clear_int_ext(PLL_INT_CLR);
 
-   mdelay(WILC_PLL_TO);
+   if (g_wlan.io_type == HIF_SDIO)
+   mdelay(WILC_PLL_TO_SDIO);
+   else
+   mdelay(WILC_PLL_TO_SPI);
 
while (!(ISWILC1000(wilc_get_chipid(true)) && --trials)) {
PRINT_D(TX_DBG, "PLL update retrying\n");
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index 44a590f80def..90ef650e722d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -134,11 +134,8 @@
 #define WILC_CFG_RSP_STATUS2
 #define WILC_CFG_RSP_SCAN  3
 
-#ifdef WILC_SDIO
-#define WILC_PLL_TO4
-#else
-#define WILC_PLL_TO2
-#endif
+#define WILC_PLL_TO_SDIO   4
+#define WILC_PLL_TO_SPI2
 #define ABORT_INT  BIT(31)
 
 /***/
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/19] staging/wilc1000: pass io_type to wilc_netdev_init

2015-11-16 Thread Arnd Bergmann
In order to avoid some of the #ifdefs, this passes the io_type
and device pointer as an argument to wilc_netdev_init.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c | 18 --
 drivers/staging/wilc1000/linux_wlan_sdio.c|  4 ++--
 drivers/staging/wilc1000/linux_wlan_spi.c |  4 ++--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 4 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index faad01f6f2d1..b1707147aa7d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -25,11 +25,7 @@
 
 #include 
 
-#ifdef WILC_SDIO
 #include "linux_wlan_sdio.h"
-#else
-#include "linux_wlan_spi.h"
-#endif
 
 static int dev_state_ev_handler(struct notifier_block *this, unsigned long 
event, void *ptr);
 
@@ -884,11 +880,6 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
 
wlan_init_locks(dev);
 
-#ifdef WILC_SDIO
-   wl->io_type = HIF_SDIO;
-#else
-   wl->io_type = HIF_SPI;
-#endif
ret = wilc_wlan_init(dev);
if (ret < 0) {
PRINT_ER("Initializing WILC_Wlan FAILED\n");
@@ -1426,7 +1417,7 @@ void wilc_netdev_cleanup(struct wilc *wilc)
 #endif
 }
 
-int wilc_netdev_init(struct wilc **wilc)
+int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type)
 {
int i;
perInterface_wlan_t *nic;
@@ -1439,7 +1430,7 @@ int wilc_netdev_init(struct wilc **wilc)
return -ENOMEM;
 
*wilc = wilc_dev;
-
+   wilc_dev->io_type = io_type;
register_inetaddr_notifier(_dev_notifier);
 
for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
@@ -1468,9 +1459,8 @@ int wilc_netdev_init(struct wilc **wilc)
struct wireless_dev *wdev;
wdev = wilc_create_wiphy(ndev);
 
-   #ifdef WILC_SDIO
-   SET_NETDEV_DEV(ndev, _sdio_func->dev);
-   #endif
+   if (dev)
+   SET_NETDEV_DEV(ndev, dev);
 
if (!wdev) {
PRINT_ER("Can't register WILC Wiphy\n");
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 8df69b2aff2d..d2843b949a1b 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -1,4 +1,5 @@
 #include "wilc_wfi_netdevice.h"
+#include "linux_wlan_sdio.h"
 
 #include 
 #include 
@@ -113,7 +114,7 @@ static int linux_sdio_probe(struct sdio_func *func, const 
struct sdio_device_id
 
PRINT_D(INIT_DBG, "Initializing netdev\n");
wilc_sdio_func = func;
-   if (wilc_netdev_init()) {
+   if (wilc_netdev_init(, >dev, HIF_SDIO)) {
PRINT_ER("Couldn't initialize netdev\n");
return -1;
}
@@ -215,7 +216,6 @@ int wilc_sdio_set_default_speed(void)
return linux_sdio_set_speed(sdio_default_speed);
 }
 
-
 static int __init init_wilc_sdio_driver(void)
 {
return sdio_register_driver(_bus);
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index 29dd9d4e5ff0..a459c502a8a8 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -9,9 +9,9 @@
 #include 
 #include 
 
+#include "linux_wlan_spi.h"
 #include "wilc_wfi_netdevice.h"
 #include "linux_wlan_common.h"
-#include "linux_wlan_spi.h"
 #include "wilc_wlan_if.h"
 
 #define USE_SPI_DMA 0   /* johnny add */
@@ -404,7 +404,7 @@ static int __init init_wilc_spi_driver(void)
 
wilc_debugfs_init();
 
-   ret = wilc_netdev_init();
+   ret = wilc_netdev_init(, NULL, HIF_SPI);
if (ret) {
wilc_debugfs_remove();
return ret;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index a099f2877b6e..eae9ce175351 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -213,7 +213,7 @@ void linux_wlan_rx_complete(void);
 void linux_wlan_dbg(u8 *buff);
 int linux_wlan_lock_timeout(void *vp, u32 timeout);
 void wilc_netdev_cleanup(struct wilc *wilc);
-int wilc_netdev_init(struct wilc **wilc);
+int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type);
 void wilc1000_wlan_deinit(struct net_device *dev);
 void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
 u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value);
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/19] staging/wilc1000: unify device pointer

2015-11-16 Thread Arnd Bergmann
struct wilc has two pointers to store the device, one for sdio_func
and one for spi_device. By changing the pointer to a 'struct device',
we can simplify the logic and avoid a few #ifdefs.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c | 25 +++-
 drivers/staging/wilc1000/linux_wlan_sdio.c| 33 +--
 drivers/staging/wilc1000/linux_wlan_spi.c | 22 --
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  6 +
 4 files changed, 30 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 876bcfb3b546..faad01f6f2d1 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -453,19 +453,11 @@ int wilc_wlan_get_firmware(struct net_device *dev)
goto _fail_;
}
 
-#ifdef WILC_SDIO
-   if (request_firmware(_firmware, firmware, 
>wilc_sdio_func->dev) != 0) {
-   PRINT_ER("%s - firmare not available\n", firmware);
-   ret = -1;
-   goto _fail_;
-   }
-#else
-   if (request_firmware(_firmware, firmware, >wilc_spidev->dev) 
!= 0) {
+   if (request_firmware(_firmware, firmware, wilc->dev) != 0) {
PRINT_ER("%s - firmare not available\n", firmware);
ret = -1;
goto _fail_;
}
-#endif
wilc->firmware = wilc_firmware;
 
 _fail_:
@@ -1015,12 +1007,11 @@ int wilc_mac_open(struct net_device *ndev)
nic = netdev_priv(ndev);
wl = nic->wilc;
 
-#ifdef WILC_SPI
-   if (!wl || !wl->wilc_spidev) {
+   if (!wl|| !wl->dev) {
netdev_err(ndev, "wilc1000: SPI device not ready\n");
return -ENODEV;
}
-#endif
+
nic = netdev_priv(ndev);
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev);
@@ -1505,15 +1496,5 @@ int wilc_netdev_init(struct wilc **wilc)
nic->mac_opened = 0;
}
 
-   #ifndef WILC_SDIO
-   if (!wilc_spi_init()) {
-   PRINT_ER("Can't initialize SPI\n");
-   return -1;
-   }
-   wilc_dev->wilc_spidev = wilc_spi_dev;
-   #else
-   wilc_dev->wilc_sdio_func = wilc_sdio_func;
-   #endif
-
return 0;
 }
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 06fd0e600c2a..8df69b2aff2d 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -21,13 +21,7 @@
  #define MAX_SPEED (6 * 100) /* Max 50M */
 #endif
 
-struct wilc_sdio {
-   struct sdio_func *func;
-   struct wilc *wilc;
-};
-
 struct sdio_func *wilc_sdio_func;
-
 static unsigned int sdio_default_speed;
 
 #define SDIO_VENDOR_ID_WILC 0x0296
@@ -42,12 +36,8 @@ static const struct sdio_device_id wilc_sdio_ids[] = {
 #ifndef WILC_SDIO_IRQ_GPIO
 static void wilc_sdio_interrupt(struct sdio_func *func)
 {
-   struct wilc_sdio *wl_sdio;
-
-   wl_sdio = sdio_get_drvdata(func);
-
sdio_release_host(func);
-   wilc_handle_isr(wl_sdio->wilc);
+   wilc_handle_isr(sdio_get_drvdata(func));
sdio_claim_host(func);
 }
 #endif
@@ -55,7 +45,7 @@ static void wilc_sdio_interrupt(struct sdio_func *func)
 
 int wilc_sdio_cmd52(sdio_cmd52_t *cmd)
 {
-   struct sdio_func *func = wilc_dev->wilc_sdio_func;
+   struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, 
dev);
int ret;
u8 data;
 
@@ -87,7 +77,7 @@ int wilc_sdio_cmd52(sdio_cmd52_t *cmd)
 
 int wilc_sdio_cmd53(sdio_cmd53_t *cmd)
 {
-   struct sdio_func *func = wilc_dev->wilc_sdio_func;
+   struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, 
dev);
int size, ret;
 
sdio_claim_host(func);
@@ -118,24 +108,17 @@ int wilc_sdio_cmd53(sdio_cmd53_t *cmd)
 
 static int linux_sdio_probe(struct sdio_func *func, const struct 
sdio_device_id *id)
 {
-   struct wilc_sdio *wl_sdio;
struct wilc *wilc;
 
-   PRINT_D(INIT_DBG, "probe function\n");
-   wl_sdio = kzalloc(sizeof(struct wilc_sdio), GFP_KERNEL);
-   if (!wl_sdio)
-   return -ENOMEM;
 
PRINT_D(INIT_DBG, "Initializing netdev\n");
wilc_sdio_func = func;
if (wilc_netdev_init()) {
PRINT_ER("Couldn't initialize netdev\n");
-   kfree(wl_sdio);
return -1;
}
-   wl_sdio->func = func;
-   wl_sdio->wilc = wilc;
-   sdio_set_drvdata(func, wl_sdio);
+   sdio_set_drvdata(func, wilc);
+   wilc->dev = >dev;
 
printk("Driver Initializing success\n");
return 0;
@@ -143,11 +126,7 @@ static int linux_sdio_probe(struct sdio_func *func, const 
struct sdio_device_id
 
 static void linux_sdio_remove(struct sdio_func *func)
 {
-   struct wilc_sdio *wl_sdio;
-
-   wl_sdio = 

[PATCH 02/19] staging/wilc1000: make symbols static if possible

2015-11-16 Thread Arnd Bergmann
All symbols that are only referenced in the file that defines
them can be declared 'static' to avoid namespace pollution,
to produce better object code, and to make the source more
readable.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/Makefile |  3 +-
 drivers/staging/wilc1000/coreconfigurator.c   |  4 +-
 drivers/staging/wilc1000/host_interface.c | 35 --
 drivers/staging/wilc1000/host_interface.h |  8 
 drivers/staging/wilc1000/linux_mon.c  |  6 +--
 drivers/staging/wilc1000/linux_wlan.c | 19 
 drivers/staging/wilc1000/linux_wlan_sdio.c|  4 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 56 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  1 -
 drivers/staging/wilc1000/wilc_wlan.c  | 23 ++
 10 files changed, 81 insertions(+), 78 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index 650123df0b4c..9696f69bda48 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -8,8 +8,7 @@ ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
-DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \
-DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\"
 
-ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 \
-   -Wno-unused-function -DWILC_DEBUGFS
+ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 -DWILC_DEBUGFS
 #ccflags-y += -DTCP_ACK_FILTER
 
 ccflags-$(CONFIG_WILC1000_PREALLOCATE_AT_LOADING_DRIVER) += -DMEMORY_STATIC \
diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index fd7240c9da3e..eef06cdcc905 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -285,7 +285,7 @@ static inline u16 get_asoc_id(u8 *data)
return asoc_id;
 }
 
-u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
+static u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
 {
u16 u16index;
 
@@ -313,7 +313,7 @@ u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 
u16TagParamOffset)
 
 /* This function gets the current channel information from
  * the 802.11n beacon/probe response frame */
-u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
+static u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
 {
u16 index;
 
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 6c205b97293d..93bdb224f973 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -234,7 +234,7 @@ struct join_bss_param {
 static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1];
 struct host_if_drv *terminated_handle;
 bool g_obtainingIP;
-u8 P2P_LISTEN_STATE;
+static u8 P2P_LISTEN_STATE;
 static struct task_struct *hif_thread_handler;
 static WILC_MsgQueueHandle hif_msg_q;
 static struct semaphore hif_sema_thread;
@@ -259,10 +259,10 @@ static u8 del_beacon;
 static u32 clients_count;
 
 static u8 *join_req;
-u8 *info_element;
+static u8 *info_element;
 static u8 mode_11i;
-u8 auth_type;
-u32 join_req_size;
+static u8 auth_type;
+static u32 join_req_size;
 static u32 info_element_size;
 static struct host_if_drv *join_req_drv;
 #define REAL_JOIN_REQ 0
@@ -396,7 +396,9 @@ static s32 handle_set_operation_mode(struct host_if_drv 
*hif_drv,
return result;
 }
 
-s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx)
+static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, 
u8 idx);
+
+static s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 
idx)
 {
s32 result = 0;
struct wid wid;
@@ -430,7 +432,7 @@ s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 
*ip_addr, u8 idx)
return result;
 }
 
-s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx)
+static s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx)
 {
s32 result = 0;
struct wid wid;
@@ -817,6 +819,9 @@ static void Handle_wait_msg_q_empty(void)
up(_sema_wait_response);
 }
 
+static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
+  enum scan_event enuEvent);
+
 static s32 Handle_Scan(struct host_if_drv *hif_drv,
   struct scan_attr *pstrHostIFscanAttr)
 {
@@ -1483,6 +1488,11 @@ done:
return result;
 }
 
+static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
+  u8 *pu8AssocRespInfo,
+  u32 u32MaxAssocRespInfoLen,
+  u32 *pu32RcvdAssocRespInfoLen);
+
 static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,
struct rcvd_async_info 
*pstrRcvdGnrlAsyncInfo)
 {
@@ -2140,7 +2150,7 @@ static void 

[PATCH 00/19 v5] staging/wilc1000 cleanups

2015-11-16 Thread Arnd Bergmann
As suggested by Glen Lee, I'm sending the patches once more with the
two one-line fixes in "staging/wilc1000: pass hif operations through
initialization".

I have rebased on top of today's staging-testing, but no other changes
were necessary, so this is otherwise identical to the version that
Glen has successfully tested.

Please disregard the earlier version and apply this one.

Arnd

Arnd Bergmann (19):
  staging/wilc1000: remove unused functions
  staging/wilc1000: make symbols static if possible
  staging/wilc1000: use proper naming for global symbols
  staging/wilc1000: move extern declarations to headers
  staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT
  staging/wilc1000: avoid static definitions in header
  staging/wilc1000: remove linux_wlan_{device_power,device_detection}
  staging/wilc1000: move wilc_wlan_inp_t into struct wilc
  staging/wilc1000: move init/exit functions to driver files
  staging/wilc1000: unify device pointer
  staging/wilc1000: pass io_type to wilc_netdev_init
  staging/wilc1000: use device pointer for phy creation
  staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO
  staging/wilc1000: pass hif operations through initialization
  staging/wilc1000: turn enable_irq/disable_irq into callbacks
  staging/wilc1000: remove WILC_SDIO/WILC_SPI macros
  staging/wilc1000: split out bus specific modules
  staging/wilc1000: use more regular probing
  staging/wilc1000: pass struct wilc to most linux_wlan.c functions

 drivers/staging/wilc1000/Kconfig  |  66 +--
 drivers/staging/wilc1000/Makefile |  14 +-
 drivers/staging/wilc1000/coreconfigurator.c   |  14 +-
 drivers/staging/wilc1000/coreconfigurator.h   |  16 +-
 drivers/staging/wilc1000/host_interface.c | 591 ++
 drivers/staging/wilc1000/host_interface.h | 118 ++---
 drivers/staging/wilc1000/linux_mon.c  |  11 +-
 drivers/staging/wilc1000/linux_wlan.c | 374 +-
 drivers/staging/wilc1000/linux_wlan_common.h  |  22 +-
 drivers/staging/wilc1000/linux_wlan_sdio.c| 122 ++---
 drivers/staging/wilc1000/linux_wlan_sdio.h|  19 +-
 drivers/staging/wilc1000/linux_wlan_spi.c | 117 ++---
 drivers/staging/wilc1000/linux_wlan_spi.h |  14 +-
 drivers/staging/wilc1000/wilc_debugfs.c   |  26 +-
 drivers/staging/wilc1000/wilc_sdio.c  | 254 --
 drivers/staging/wilc1000/wilc_spi.c   | 293 ++-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 443 
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  87 +---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  40 +-
 drivers/staging/wilc1000/wilc_wlan.c  | 232 -
 drivers/staging/wilc1000/wilc_wlan.h  |  40 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  |   6 +-
 drivers/staging/wilc1000/wilc_wlan_if.h   |  11 +-
 23 files changed, 1047 insertions(+), 1883 deletions(-)

-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Matching crc32 checksums from kernel and user space

2015-11-16 Thread Kalle Valo
Hi,

I want ath10k to print a checksum for the firmware image and include
that to the firmware crash dump file as well. Then I want to print the
same checksum from user space scripts and verify it with the crash dump
file.

I thought that crc32 would be good enough for me but it wasn't that
simple as I can't seem to getting matching checksums, at least not with
the user space tools I found. For a test case I created a simple file:

$ xxd /lib/firmware/ath10k/crc-test.bin 
: 3132 3334 3536 3738 3930 0a  1234567890.

In kernel I get these checksums:

[  574.867724] crc32_le(0) 8916bc26
[  574.867739] crc32_le(~0) 1d6ef235
[  574.867743] crc32_be(0) b9346a4c
[  574.867746] crc32_be(~0) 71467465

And from python I got (value in parenthesis is the seed I used):

binascii.crc32() 0xe2910dcaL
binascii.crc32() 0x76e943d9L
binascii.crc32(edb88320) 0x8256622aL
binascii.crc32(82f63b78) 0xc291ff04L
binascii.crc32(04c11db7) 0x6d877563L
binascii.crc32(104c11db7) 0x6d877563L
binascii.crc32(edb88320) 0x8256622aL
binascii.crc32(82608edb) 0x7b5e5884L

Or with crc32 tool from libarchive-zip-perl:

$ crc32 /lib/firmware/ath10k/crc-test.bin 
e2910dca

So libarchive-zip-perl and python match, but the kernel checksums are
totally different.

I tried md5 the same file and I get the matching id
7c12772809c1c0c3deda6103b10fdfa0 both with md5sum tool in user space and
crypto_shash_update() in kernel. But md5sum is really overkill for me. I
just want to verify that the firmware image is not corrupted or
otherwise broken, the checksum does not need to be secure in any way.
And preferably the checksum would be short enough to make it easy to
print in logs etc.

Any ideas how to match kernel crc32 implementation with user space? Or
am I doing something wrong?

Here's the kernel code I used for testing:

  printk("crc32_le(0) %08x\n", crc32_le(0, fw->data, fw->size));
  printk("crc32_le(~0) %08x\n", crc32_le(~0, fw->data, fw->size));
  printk("crc32_be(0) %08x\n", crc32_be(0, fw->data, fw->size));
  printk("crc32_be(~0) %08x\n", crc32_be(~0, fw->data, fw->size));

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ath10k: poll HTT send completion when CE 5 is unused

2015-11-16 Thread Kalle Valo
Rajkumar Manoharan  writes:

> commit a70587b3389a ("ath10k: configure copy engine 5 for HTT messages")
> moved send completion polling under HTT Rx (CE 5) service routine. For
> QCA6174 based devices copy engine 1 (CE 1) is used for HTT Rx instead
> of CE 5. So send completion never be called. This is causing "failed to
> transmit packet, dropping: -105" errors. Fix this by processing send
> completion from CE 1 service routine instead of CE 5.
>
> Tested-by: Ryan Hsu 
> Signed-off-by: Rajkumar Manoharan 

Applied to ath-current, thanks. I had a trivial conflict, please review
carefully my changes:

https://git.kernel.org/cgit/linux/kernel/git/kvalo/ath.git/commit/?h=ath-current=6419fdbb6f90e147690f8833cba59d289d613da5

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


linux-wireless rebased (probably for the last time) on 4.4-rc1

2015-11-16 Thread John W. Linville
The wireless-testing tree has been rebased on top of 4.4-rc1.  The
current head of the tree is eced3b090878ddba643bbed599e6edea4ad90f49.
Please update any downstream trees accordingly!

It has been almost a year since I turned-over wireless maintenance
duties to Johannes and Kalle. At that time I agreed to continue
maintaining the wireless-testing tree for the duration of 2015 to help
those that were still relying on it. The end of 2015 is coming soon,
and with it I intend to stop maintaining wireless-testing.

If you are still relying on wireless-testing, then I implore you to
find another option to satisfy your needs. If someone would like to
continue maintaining wireless-testing yourself, then please contact
me and I will attempt to assist you in such a transition.

Thanks for all the fish!

John
-- 
John W. LinvilleSomeday the world will need a hero, and you
linvi...@tuxdriver.com  might be all we have.  Be ready.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ath10k: Fix the wrong RX rate idx report at 11G mode

2015-11-16 Thread Kalle Valo
Yanbo Li  writes:

> The RX rate idx is not correctly for 11G mode OFDM packet.
> Because the bitrate table start with CCK index instead of OFDM.
>
> Signed-off-by: Yanbo Li 

Applied, thanks.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ath10k: Adjust the RX packet pad offset at QCA99X0 4addr mode

2015-11-16 Thread Kalle Valo
"Li, Yanbo"  writes:

>> > +  /* The padding bytes's location is different on various chips */
>> > +  enum ath10k_loc_4addr_pad loc_4addr_pad;
>> 
>> I think that loc prefix is a bit misleading, it reminds me of
>> locationing/positioning etc. What about ath10k_hw_4addr_pad?
>> 
>
>
> There is already a FW feature defined as
> "ATH10K_FW_FEATURE_NO_NWIFI_DECAP_4ADDR_PADDIND" and the relative
> string is "no-4addr-pad", if we just remove the "loc" prefix, it may
> be confuse with this FW feature.
>
> How about we change the loc to offset in this case or any better suggestion?

I did some naming changes in the pending branch:

https://git.kernel.org/cgit/linux/kernel/git/kvalo/ath.git/commit/?h=pending=42cd3832cd7c78bfeabb639a4086c7838fda5b57

Please review and let me know what you think.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v1] wil6210: hold wil->mutex while managing vrings

2015-11-16 Thread Kalle Valo
Maya Erez  writes:

> From: Vladimir Kondratiev 
>
> To prevent race when connect flow may run in parallel with
> the disconnect event.
>
> Scenario leading to the bug is: while running connect flow on the AP,
> STA sends disconnect. log follows.
>
> <7>[  668.736269] wil6210 :01:00.0: wlan0: DBG[ WMI]Configure for 
> connection CID 1
> <7>[  668.736269] wil6210 :01:00.0: wlan0: DBG[MISC]wil_vring_init_tx() 
> max_mpdu_size 2048
> <7>[  668.736301] wil6210 :01:00.0: wlan0: DBG[MISC]wil_vring_alloc()
> <7>[  668.736363] wil6210 :01:00.0: wlan0: DBG[MISC]vring[1024] 
> 0xffbe8000:d962ce08 0xdb244000
> <7>[  668.736394] wil6210 :01:00.0: wlan0: DBG[ WMI]Head 0x00880300 -> 
> 0x00880308
> <7>[  668.736394] wil6210 :01:00.0: wlan0: DBG[ WMI]WMI command 0x0821 
> [28]
> <7>[  668.736426] DBG[ WMI]Cmd : 20 00 24 00 00 00 00 00 00 00 21 08 
> 00 00 00 00   .$...!.
> <7>[  668.736426] DBG[ WMI]cmd : 00 00 00 00 00 00 5f 5c 00 00 00 00 
> 00 04 00 08  .._\
> <7>[  668.736457] DBG[ WMI]cmd 0010: 01 01 00 00 00 00 00 00 00 00 ff 0f  
> 
> <7>[  668.736488] wil6210 :01:00.0: wlan0: DBG[ IRQ]Pseudo IRQ 0x0004
> <7>[  668.736519] wil6210 :01:00.0: wlan0: DBG[ WMI]Handle WMI 0x1824 
> (reply_id 0x1821)
> <7>[  668.736519] wil6210 :01:00.0: wlan0: DBG[ 
> IRQ]wil6210_mask_irq_pseudo()
> <7>[  668.736519] wil6210 :01:00.0: wlan0: DBG[ IRQ]ISR MISC 0x2000
> <7>[  668.736551] wil6210 :01:00.0: wlan0: DBG[ WMI]Handle WMI 0x1003 
> (reply_id 0x1821)
> <7>[  668.736551] wil6210 :01:00.0: wlan0: DBG[ WMI]Disconnect 
> 04:ce:14:00:07:70 reason [proto 3 wmi 4]
> <7>[  668.736582] wil6210 :01:00.0: wlan0: DBG[MISC]wil6210_disconnect()
> <7>[  668.736613] wil6210 :01:00.0: wlan0: DBG[ IRQ]Thread IRQ
> <7>[  668.736613] wil6210 :01:00.0: wlan0: DBG[ IRQ]Thread ISR MISC 
> 0x2000
> <7>[  668.736644] wil6210 :01:00.0: wlan0: DBG[ IRQ]MBOX event
> <7>[  668.736644] wil6210 :01:00.0: wlan0: DBG[ WMI]Mbox head 00880330 
> tail 00880328
> <7>[  668.736676] wil6210 :01:00.0: wlan0: DBG[ WMI]Mbox evt 001a 0010 
>  00
> <7>[  668.736676] wil6210 :01:00.0: wlan0: DBG[ WMI]WMI event 0x1821 MID 
> 0 @3255145 msec
> <7>[  668.736707] DBG[ WMI]evt : 1a 00 10 00 00 00 00 10 00 00 21 18 
> 69 ab 31 00  ..!.i.1.
> <7>[  668.736707] DBG[ WMI]evt 0010: 01 01 00 00 00 00 00 00  
> 
> <7>[  668.736738] wil6210 :01:00.0: wlan0: DBG[ WMI]queue_work -> 0
> <7>[  668.736738] wil6210 :01:00.0: wlan0: DBG[ WMI]wmi_recv_cmd -> 1 
> events queued
> <7>[  668.736769] wil6210 :01:00.0: wlan0: DBG[ 
> IRQ]wil6210_unmask_irq_pseudo()
> <7>[  668.736832] wil6210 :01:00.0: wlan0: DBG[MISC]Disconnect 
> 04:ce:14:00:07:70, CID=1, reason=3
> <7>[  668.736832] wil6210 :01:00.0: wlan0: 
> DBG[MISC]wil_disconnect_cid(CID 1, status 1)
> <7>[  668.736894] wil6210 :01:00.0: wlan0: DBG[MISC]wil_vring_fini_tx() 
> id=1
> <7>[  668.736894] wil6210 :01:00.0: wlan0: DBG[MISC]free Tx vring 1 
> [1024] 0xffbe8000:d962ce08 0xdb244000
> <7>[  668.736957] wil6210 :01:00.0: wlan0: DBG[ WMI]Handle WMI 0x1821 
> (reply_id 0x1821)
> <7>[  668.736988] wil6210 :01:00.0: wlan0: DBG[ WMI]Complete WMI 0x1821
> <7>[  668.737019] wil6210 :01:00.0: wlan0: DBG[ 
> WMI]wmi_call(0x0821->0x1821) completed in 0 msec
> <3>[  668.737019] wil6210 :01:00.0: wlan0: Tx config failed, status 0x01
> <7>[  668.739518] wil6210 :01:00.0: wlan0: 
> DBG[MISC]wil_cfg80211_del_station(04:ce:14:00:07:70, reason=2)
> <7>[  668.739550] wil6210 :01:00.0: wlan0: DBG[MISC]wil6210_disconnect()
> <7>[  668.739550] wil6210 :01:00.0: wlan0: 
> DBG[MISC]_wil6210_disconnect(bssid=04:ce:14:00:07:70, reason=2, ev-)
> <7>[  668.739581] wil6210 :01:00.0: wlan0: DBG[MISC]Disconnect 
> 04:ce:14:00:07:70, CID=-2, reason=2
> <7>[  668.742705] wil6210 :01:00.0: wlan0: DBG[MISC]free Tx vring 1 
> [1024] 0x  (null):d962ce08 0x  (null)
> <3>[  668.742736] __dma_free_remap: trying to free invalid coherent area:   
> (null)
>
> Signed-off-by: Vladimir Kondratiev 
> Signed-off-by: Maya Erez 

Applied to ath.git, thanks.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ath10k: poll HTT send completion when CE 5 is unused

2015-11-16 Thread Manoharan, Rajkumar
> > commit a70587b3389a ("ath10k: configure copy engine 5 for HTT messages")
> > moved send completion polling under HTT Rx (CE 5) service routine. For
> > QCA6174 based devices copy engine 1 (CE 1) is used for HTT Rx instead
> > of CE 5. So send completion never be called. This is causing "failed to
> > transmit packet, dropping: -105" errors. Fix this by processing send
> > completion from CE 1 service routine instead of CE 5.
> >
> > Tested-by: Ryan Hsu 
> > Signed-off-by: Rajkumar Manoharan 
> 
> Applied to ath-current, thanks. I had a trivial conflict, please review
> carefully my changes:
> 
> https://git.kernel.org/cgit/linux/kernel/git/kvalo/ath.git/commit/?h=ath-current=6419fdbb6f90e147690f8833cba59d289d613da5
> 
Looks good. Thanks for fixing conflicts.

-Rajkumar--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] ath6kl_sdio: add control of CHIP_PWD_L via GPIO

2015-11-16 Thread Steve deRosier
This set of two patches adds the ablity for ath6kl_sdio to control the
CHIP_PWD_L pin on startup and for suspend/wakeup. This is importaint because
on some platforms, this is the only way to achieve minimum power consumption.
The CHIP_PWD_L pin is used to hold the ath chip in reset and this is the
proper way to achieve its lowest power state (per QCA's datasheets).

This GPIO is controled by the kernel standard GPIOLIB and as such depends on
CONFIG_GPIOLIB. If this isn't enabled, then the various usages will generally
compile out. Even if enabled, by default the GPIO is set to an invalid number,
and each use will check: if not a valid GPIO, then behavior will be unchanged.

This adds a new module parameter to allow the user to set the GPIO to use.

To utilize:
modprobe ath6kl_sdio reset_pwd_gpio=28
Where "28" should be replaced by the GPIO id of the pin connected to the
CHIP_PWD_L pin on the wifi chip.


Steve deRosier (2):
  ath6kl_sdio: Add reset gpio module parameter for CHIP_PWD_L pin
  ath6kl_sdio: Add power gpio reset feature into sdio driver for suspend

 drivers/net/wireless/ath/ath6kl/sdio.c | 125 -
 1 file changed, 124 insertions(+), 1 deletion(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] ath6kl_sdio: Add reset gpio module parameter for CHIP_PWD_L pin

2015-11-16 Thread Steve deRosier
Many ath6k chips have a reset pin, usually labeled CHIP_PWD_L. This pin can
be pulled low by the host processor to hold the wifi chip in reset. By
holding the chip in reset, the lowest power consumption available can be
achieved.

This adds a module parameter so the ath6kl_sdio driver can control the
CHIP_PWD_L pin if the implementer so desires. This code is only available
if GPIOLIB is configured.

Signed-off-by: Steve deRosier 
---
 drivers/net/wireless/ath/ath6kl/sdio.c | 80 +-
 1 file changed, 79 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c 
b/drivers/net/wireless/ath/ath6kl/sdio.c
index eab0ab9..7a732f3 100644
--- a/drivers/net/wireless/ath/ath6kl/sdio.c
+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
@@ -67,8 +67,18 @@ struct ath6kl_sdio {
 
/* protects access to wr_asyncq */
spinlock_t wr_async_lock;
+
 };
 
+#ifdef CONFIG_GPIOLIB
+#include 
+#define NO_GPIO0x
+
+static unsigned int reset_pwd_gpio = NO_GPIO;
+module_param(reset_pwd_gpio, uint, 0644);
+MODULE_PARM_DESC(reset_pwd_gpio, "WIFI CHIP_PWD reset pin GPIO");
+#endif
+
 #define CMD53_ARG_READ  0
 #define CMD53_ARG_WRITE 1
 #define CMD53_ARG_BLOCK_BASIS   1
@@ -1414,20 +1424,88 @@ static struct sdio_driver ath6kl_sdio_driver = {
.drv.pm = ATH6KL_SDIO_PM_OPS,
 };
 
+static int __init ath6kl_sdio_init_gpio(void)
+{
+   int ret = 0;
+
+#ifdef CONFIG_GPIOLIB
+   if (!gpio_is_valid(reset_pwd_gpio))
+   return 0;
+
+   /* Request the reset GPIO, and assert it to make sure we get a 100%
+* clean boot in-case we had a floating input or other issue.
+*/
+   ret = gpio_request_one(reset_pwd_gpio,
+  GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED,
+  "WIFI_RESET");
+   if (ret) {
+   ath6kl_err("Unable to get WIFI power gpio: %d\n", ret);
+   return ret;
+   }
+
+   ath6kl_dbg(ATH6KL_DBG_SUSPEND, "Setup wifi gpio #%d\n", reset_pwd_gpio);
+   usleep_range(20, 50); /* Pin must be asserted at least 5 usec */
+   gpio_set_value(reset_pwd_gpio, 1); /* De-assert the pin for operation */
+
+   /* Delay to avoid the mmc driver calling the probe on the prior notice
+* of the chip, which we just killed. If this is missing, it results in
+* a spurious warning:
+* "ath6kl_sdio: probe of mmc0:0001:1 failed with error -110"
+*/
+   msleep(150); /* Time chosen experimentally, with padding */
+#endif
+
+   return ret;
+}
+
+static void __exit ath6kl_sdio_release_gpio(void)
+{
+#ifdef CONFIG_GPIOLIB
+   if (gpio_is_valid(reset_pwd_gpio)) {
+   /* Be sure we leave the chip in reset when we unload and also
+* release the GPIO
+*/
+   gpio_set_value(reset_pwd_gpio, 0);
+   gpio_free(reset_pwd_gpio);
+   }
+#endif
+}
+
 static int __init ath6kl_sdio_init(void)
 {
int ret;
 
-   ret = sdio_register_driver(_sdio_driver);
+   ret = ath6kl_sdio_init_gpio();
if (ret)
+   goto err_gpio;
+
+   ret = sdio_register_driver(_sdio_driver);
+   if (ret) {
ath6kl_err("sdio driver registration failed: %d\n", ret);
+   goto err_register;
+   }
+
+   return ret;
+
+err_register:
+   ath6kl_sdio_release_gpio();
 
+err_gpio:
return ret;
 }
 
 static void __exit ath6kl_sdio_exit(void)
 {
sdio_unregister_driver(_sdio_driver);
+
+#ifdef CONFIG_GPIOLIB
+   /* Delay to avoid pulling the plug on the chip when an irq is pending
+* and then getting a spurious message:
+* "ath6kl: failed to get pending recv messages: -125"
+*/
+   msleep(300);
+   ath6kl_sdio_release_gpio();
+#endif
 }
 
 module_init(ath6kl_sdio_init);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2] ath6kl_sdio: add control of CHIP_PWD_L via GPIO

2015-11-16 Thread Julian Calaby
Hi Steve,

On Tue, Nov 17, 2015 at 4:32 PM, Steve deRosier  wrote:
> This set of two patches adds the ablity for ath6kl_sdio to control the
> CHIP_PWD_L pin on startup and for suspend/wakeup. This is importaint because
> on some platforms, this is the only way to achieve minimum power consumption.
> The CHIP_PWD_L pin is used to hold the ath chip in reset and this is the
> proper way to achieve its lowest power state (per QCA's datasheets).
>
> This GPIO is controled by the kernel standard GPIOLIB and as such depends on
> CONFIG_GPIOLIB. If this isn't enabled, then the various usages will generally
> compile out. Even if enabled, by default the GPIO is set to an invalid number,
> and each use will check: if not a valid GPIO, then behavior will be unchanged.
>
> This adds a new module parameter to allow the user to set the GPIO to use.

I want to say that this should go in DeviceTree or equivalent, however
ath6kl doesn't have DeviceTree support, so...

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] ath6kl_sdio: Add reset gpio module parameter for CHIP_PWD_L pin

2015-11-16 Thread Julian Calaby
Hi Steve,

On Tue, Nov 17, 2015 at 4:32 PM, Steve deRosier  wrote:
> Many ath6k chips have a reset pin, usually labeled CHIP_PWD_L. This pin can
> be pulled low by the host processor to hold the wifi chip in reset. By
> holding the chip in reset, the lowest power consumption available can be
> achieved.
>
> This adds a module parameter so the ath6kl_sdio driver can control the
> CHIP_PWD_L pin if the implementer so desires. This code is only available
> if GPIOLIB is configured.

linux/gpio.h is built so that the exported functions are no-ops when
GPIOLIB isn't defined. Providing you include linux/gpio.h
unconditionally, all of your #ifdefs except the one around the module
parameter can be removed and the code will be optimised away by the
compiler.

> Signed-off-by: Steve deRosier 
> ---
>  drivers/net/wireless/ath/ath6kl/sdio.c | 80 
> +-
>  1 file changed, 79 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c 
> b/drivers/net/wireless/ath/ath6kl/sdio.c
> index eab0ab9..7a732f3 100644
> --- a/drivers/net/wireless/ath/ath6kl/sdio.c
> +++ b/drivers/net/wireless/ath/ath6kl/sdio.c
> @@ -67,8 +67,18 @@ struct ath6kl_sdio {
>
> /* protects access to wr_asyncq */
> spinlock_t wr_async_lock;
> +
>  };
>
> +#ifdef CONFIG_GPIOLIB
> +#include 
> +#define NO_GPIO0x

ARCH_NR_GPIOS could be used here instead of defining NO_GPIO.

> +
> +static unsigned int reset_pwd_gpio = NO_GPIO;
> +module_param(reset_pwd_gpio, uint, 0644);
> +MODULE_PARM_DESC(reset_pwd_gpio, "WIFI CHIP_PWD reset pin GPIO");
> +#endif
> +
>  #define CMD53_ARG_READ  0
>  #define CMD53_ARG_WRITE 1
>  #define CMD53_ARG_BLOCK_BASIS   1
> @@ -1414,20 +1424,88 @@ static struct sdio_driver ath6kl_sdio_driver = {
> .drv.pm = ATH6KL_SDIO_PM_OPS,
>  };
>
> +static int __init ath6kl_sdio_init_gpio(void)
> +{
> +   int ret = 0;
> +
> +#ifdef CONFIG_GPIOLIB
> +   if (!gpio_is_valid(reset_pwd_gpio))
> +   return 0;
> +
> +   /* Request the reset GPIO, and assert it to make sure we get a 100%
> +* clean boot in-case we had a floating input or other issue.
> +*/
> +   ret = gpio_request_one(reset_pwd_gpio,
> +  GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED,
> +  "WIFI_RESET");
> +   if (ret) {
> +   ath6kl_err("Unable to get WIFI power gpio: %d\n", ret);
> +   return ret;
> +   }
> +
> +   ath6kl_dbg(ATH6KL_DBG_SUSPEND, "Setup wifi gpio #%d\n", 
> reset_pwd_gpio);
> +   usleep_range(20, 50); /* Pin must be asserted at least 5 usec */
> +   gpio_set_value(reset_pwd_gpio, 1); /* De-assert the pin for operation 
> */
> +
> +   /* Delay to avoid the mmc driver calling the probe on the prior notice
> +* of the chip, which we just killed. If this is missing, it results 
> in
> +* a spurious warning:
> +* "ath6kl_sdio: probe of mmc0:0001:1 failed with error -110"
> +*/
> +   msleep(150); /* Time chosen experimentally, with padding */

Should this be in a #define?

> +#endif
> +
> +   return ret;

ret is always zero here. You should just return 0 here.

> +}
> +
> +static void __exit ath6kl_sdio_release_gpio(void)
> +{
> +#ifdef CONFIG_GPIOLIB
> +   if (gpio_is_valid(reset_pwd_gpio)) {
> +   /* Be sure we leave the chip in reset when we unload and also
> +* release the GPIO
> +*/
> +   gpio_set_value(reset_pwd_gpio, 0);
> +   gpio_free(reset_pwd_gpio);
> +   }
> +#endif
> +}
> +
>  static int __init ath6kl_sdio_init(void)
>  {
> int ret;
>
> -   ret = sdio_register_driver(_sdio_driver);
> +   ret = ath6kl_sdio_init_gpio();
> if (ret)
> +   goto err_gpio;
> +
> +   ret = sdio_register_driver(_sdio_driver);
> +   if (ret) {
> ath6kl_err("sdio driver registration failed: %d\n", ret);
> +   goto err_register;
> +   }
> +
> +   return ret;
> +
> +err_register:
> +   ath6kl_sdio_release_gpio();
>
> +err_gpio:
> return ret;
>  }
>
>  static void __exit ath6kl_sdio_exit(void)
>  {
> sdio_unregister_driver(_sdio_driver);
> +
> +#ifdef CONFIG_GPIOLIB
> +   /* Delay to avoid pulling the plug on the chip when an irq is pending
> +* and then getting a spurious message:
> +* "ath6kl: failed to get pending recv messages: -125"
> +*/
> +   msleep(300);

Is there some actual synchronisation you can do here against the IRQ?
300msec isn't a long time to wait, but it seems wrong here.

> +   ath6kl_sdio_release_gpio();
> +#endif
>  }
>
>  module_init(ath6kl_sdio_init);

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
To unsubscribe from this list: send the line 

Re: [PATCH] wireless: change cfg80211 regulatory domain info as debug messages

2015-11-16 Thread Johannes Berg

> So maybe add some wrapper that does a pr_info then
> a pr_debug for the second and subsequent uses like:
> 

That seems like a bad idea - one might be tricked into think that one
saw the current data, but the actually current data is later hidden.

johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] ath6kl_sdio: Add reset gpio module parameter for CHIP_PWD_L pin

2015-11-16 Thread kbuild test robot
Hi Steve,

[auto build test WARNING on wireless-drivers/master]
[also build test WARNING on v4.4-rc1 next-20151117]

url:
https://github.com/0day-ci/linux/commits/Steve-deRosier/ath6kl_sdio-add-control-of-CHIP_PWD_L-via-GPIO/20151117-133751
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git 
master
config: i386-allyesconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

>> WARNING: drivers/net/wireless/built-in.o(.init.text+0x22f3): Section 
>> mismatch in reference from the function ath6kl_sdio_init() to the function 
>> .exit.text:ath6kl_sdio_release_gpio()
   The function __init ath6kl_sdio_init() references
   a function __exit ath6kl_sdio_release_gpio().
   This is often seen when error handling in the init function
   uses functionality in the exit path.
   The fix is often to remove the __exit annotation of
   ath6kl_sdio_release_gpio() so it may be used outside an exit section.

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data