Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1266859 > unrolled thread

[PATCH 00/20] staging/wilc1000: cleanups once again

Started byArnd Bergmann <arnd@arndb.de>
First post2015-11-11 00:50 +0100
Last post2015-11-11 01:00 +0100
Articles 20 on this page of 27 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/20] staging/wilc1000: cleanups once again Arnd Bergmann <arnd@arndb.de> - 2015-11-11 00:50 +0100
    [PATCH 07/20] staging/wilc1000: avoid static definitions in header Arnd Bergmann <arnd@arndb.de> - 2015-11-11 00:50 +0100
    [PATCH 01/20] staging/wilc1000: add struct net_device declaration Arnd Bergmann <arnd@arndb.de> - 2015-11-11 00:50 +0100
      Re: [PATCH 01/20] staging/wilc1000: add struct net_device  declaration Joe Perches <joe@perches.com> - 2015-11-11 00:50 +0100
        Re: [PATCH 01/20] staging/wilc1000: add struct net_device declaration Arnd Bergmann <arnd@arndb.de> - 2015-11-11 01:00 +0100
      Re: [PATCH 01/20] staging/wilc1000: add struct net_device declaration Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-11-11 01:10 +0100
        Re: [PATCH 01/20] staging/wilc1000: add struct net_device declaration Arnd Bergmann <arnd@arndb.de> - 2015-11-11 01:20 +0100
          Re: [PATCH 01/20] staging/wilc1000: add struct net_device declaration Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-11-11 01:40 +0100
    [PATCH 17/20] staging/wilc1000: remove WILC_SDIO/WILC_SPI macros Arnd Bergmann <arnd@arndb.de> - 2015-11-11 00:50 +0100
    [PATCH 10/20] staging/wilc1000: move init/exit functions to driver files Arnd Bergmann <arnd@arndb.de> - 2015-11-11 00:50 +0100
    [PATCH 06/20] staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT Arnd Bergmann <arnd@arndb.de> - 2015-11-11 00:50 +0100
    [PATCH 15/20] staging/wilc1000: pass hif operations through initialization Arnd Bergmann <arnd@arndb.de> - 2015-11-11 00:50 +0100
      Re: [PATCH 15/20] staging/wilc1000: pass hif operations through initialization glen lee <glen.lee@atmel.com> - 2015-11-12 11:10 +0100
        Re: [PATCH 15/20] staging/wilc1000: pass hif operations through initialization Arnd Bergmann <arnd@arndb.de> - 2015-11-12 12:40 +0100
          Re: [PATCH 15/20] staging/wilc1000: pass hif operations through initialization glen lee <glen.lee@atmel.com> - 2015-11-13 08:50 +0100
            Re: [PATCH 15/20] staging/wilc1000: pass hif operations through initialization Arnd Bergmann <arnd@arndb.de> - 2015-11-13 10:20 +0100
              Re: [PATCH 15/20] staging/wilc1000: pass hif operations through initialization glen lee <glen.lee@atmel.com> - 2015-11-16 02:40 +0100
    [PATCH 19/20] staging/wilc1000: use more regular probing Arnd Bergmann <arnd@arndb.de> - 2015-11-11 00:50 +0100
      Re: [PATCH 19/20] staging/wilc1000: use more regular probing Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-11 09:00 +0100
        Re: [PATCH 19/20] staging/wilc1000: use more regular probing Arnd Bergmann <arnd@arndb.de> - 2015-11-11 10:00 +0100
    [PATCH 09/20] staging/wilc1000: move wilc_wlan_inp_t into struct wilc Arnd Bergmann <arnd@arndb.de> - 2015-11-11 00:50 +0100
    [PATCH 20/20] staging/wilc1000: pass struct wilc to most linux_wlan.c functions Arnd Bergmann <arnd@arndb.de> - 2015-11-11 00:50 +0100
    [PATCH 13/20] staging/wilc1000: use device pointer for phy creation Arnd Bergmann <arnd@arndb.de> - 2015-11-11 00:50 +0100
    [PATCH 08/20] staging/wilc1000: remove linux_wlan_{device_power,device_detection} Arnd Bergmann <arnd@arndb.de> - 2015-11-11 00:50 +0100
    [PATCH 11/20] staging/wilc1000: unify device pointer Arnd Bergmann <arnd@arndb.de> - 2015-11-11 00:50 +0100
    [PATCH 14/20] staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO Arnd Bergmann <arnd@arndb.de> - 2015-11-11 00:50 +0100
    [PATCH 02/20] staging/wilc1000: remove unused functions Arnd Bergmann <arnd@arndb.de> - 2015-11-11 01:00 +0100

Page 1 of 2  [1] 2  Next page →


#1266859 — [PATCH 00/20] staging/wilc1000: cleanups once again

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-11 00:50 +0100
Subject[PATCH 00/20] staging/wilc1000: cleanups once again
Message-ID<qtqPL-3lH-3@gated-at.bofh.it>
I have rebased the patches once more on top of a lot of renames,
and would prefer not to rebase them again. This is the series of
fixups that I've posted before, now for today's staging-testing
branch.

Please apply.

Arnd Bergmann (20):
  staging/wilc1000: add struct net_device declaration
  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         | 119 ++---
 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, 1048 insertions(+), 1883 deletions(-)

-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1266860 — [PATCH 07/20] staging/wilc1000: avoid static definitions in header

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-11 00:50 +0100
Subject[PATCH 07/20] staging/wilc1000: avoid static definitions in header
Message-ID<qtqPM-3lH-15@gated-at.bofh.it>
In reply to#1266859
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 <arnd@arndb.de>
---
 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 <linux/errno.h>
 
+/* The following macros describe the bitfield map used by the firmware to determine its 11i mode */
+#define NO_ENCRYPT		0
+#define ENCRYPT_ENABLED		BIT(0)
+#define WEP			BIT(1)
+#define WEP_EXTENDED		BIT(2)
+#define WPA			BIT(3)
+#define WPA2			BIT(4)
+#define AES			BIT(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_ID			0xdd
+
+/*Public action subtype values*/
+#define GO_NEG_REQ			0x00
+#define GO_NEG_RSP			0x01
+#define GO_NEG_CONF			0x02
+#define P2P_INV_REQ			0x03
+#define P2P_INV_RSP			0x04
+#define PUBLIC_ACT_VENDORSPEC		0x09
+#define GAS_INTIAL_REQ			0x0a
+#define GAS_INTIAL_RSP			0x0b
+
+#define INVALID_CHANNEL			0
+
+#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 = 0xffff,
+		.rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+			BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
+	},
+	[NL80211_IFTYPE_AP] = {
+		.tx = 0xffff,
+		.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 = 0xffff,
+		.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_CALLBACK			0x080
 #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_ENABLED		BIT(0)
-#define WEP			BIT(1)
-#define WEP_EXTENDED		BIT(2)
-#define WPA			BIT(3)
-#define WPA2			BIT(4)
-#define AES			BIT(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_ID			0xdd
-
-/*Public action subtype values*/
-#define GO_NEG_REQ			0x00
-#define GO_NEG_RSP			0x01
-#define GO_NEG_CONF			0x02
-#define P2P_INV_REQ			0x03
-#define P2P_INV_RSP			0x04
-#define PUBLIC_ACT_VENDORSPEC		0x09
-#define GAS_INTIAL_REQ			0x0a
-#define GAS_INTIAL_RSP			0x0b
-
-#define INVALID_CHANNEL			0
-
-#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 = 0xffff,
-		.rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
-			BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
-	},
-	[NL80211_IFTYPE_AP] = {
-		.tx = 0xffff,
-		.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 = 0xffff,
-		.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
-
 struct wireless_dev *wilc_create_wiphy(struct net_device *net);
 void wilc_free_wiphy(struct net_device *net);
 int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed);
@@ -101,7 +21,4 @@ struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_devi
 void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
 			      u16 frame_type, bool reg);
 
-#define TCP_ACK_FILTER_LINK_SPEED_THRESH	54
-#define DEFAULT_LINK_SPEED			72
-
 #endif
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266861 — [PATCH 01/20] staging/wilc1000: add struct net_device declaration

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-11 00:50 +0100
Subject[PATCH 01/20] staging/wilc1000: add struct net_device declaration
Message-ID<qtqPM-3lH-19@gated-at.bofh.it>
In reply to#1266859
A recent cleanup added a reference to struct net_device, but
that structure is not always visible in the context of the
declaration, so we may get a compile-time error:

In file included from wilc1000/host_interface.c:5:0:
wilc1000/host_interface.h:705:46: warning: 'struct net_device' declared inside parameter list
 s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv);

This adds a forward-declaration for the structure name to avoid
that error.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: d5382219138d ("staging: wilc1000: host_int_init: add argument net_device")
---
 drivers/staging/wilc1000/host_interface.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 57e1d424afdc..29a92d690384 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -369,6 +369,7 @@ s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource,
 s32 hif_set_cfg(struct host_if_drv *hWFIDrv,
 		struct cfg_param_val *pstrCfgParamVal);
 s32 hif_get_cfg(struct host_if_drv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value);
+struct net_device;
 s32 host_int_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
 s32 host_int_deinit(struct host_if_drv *hWFIDrv);
 s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval,
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266866 — Re: [PATCH 01/20] staging/wilc1000: add struct net_device declaration

FromJoe Perches <joe@perches.com>
Date2015-11-11 00:50 +0100
SubjectRe: [PATCH 01/20] staging/wilc1000: add struct net_device declaration
Message-ID<qtqPM-3lH-35@gated-at.bofh.it>
In reply to#1266861
On Wed, 2015-11-11 at 00:42 +0100, Arnd Bergmann wrote:
> A recent cleanup added a reference to struct net_device, but
> that structure is not always visible in the context of the
> declaration, so we may get a compile-time error:
> 
> In file included from wilc1000/host_interface.c:5:0:
> wilc1000/host_interface.h:705:46: warning: 'struct net_device' declared inside parameter list
>  s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
> 
> This adds a forward-declaration for the structure name to avoid
> that error.

why not #include <linux/netdevice.h> ?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266878 — Re: [PATCH 01/20] staging/wilc1000: add struct net_device declaration

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-11 01:00 +0100
SubjectRe: [PATCH 01/20] staging/wilc1000: add struct net_device declaration
Message-ID<qtqZr-3pr-13@gated-at.bofh.it>
In reply to#1266866
On Tuesday 10 November 2015 15:47:02 Joe Perches wrote:
> On Wed, 2015-11-11 at 00:42 +0100, Arnd Bergmann wrote:
> > A recent cleanup added a reference to struct net_device, but
> > that structure is not always visible in the context of the
> > declaration, so we may get a compile-time error:
> > 
> > In file included from wilc1000/host_interface.c:5:0:
> > wilc1000/host_interface.h:705:46: warning: 'struct net_device' declared inside parameter list
> >  s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
> > 
> > This adds a forward-declaration for the structure name to avoid
> > that error.
> 
> why not #include <linux/netdevice.h> ?
> 

The headers in this driver are still a bit fragile, better not
add in too many other headers, especially before the rest of my
series is applied.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266881 — Re: [PATCH 01/20] staging/wilc1000: add struct net_device declaration

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2015-11-11 01:10 +0100
SubjectRe: [PATCH 01/20] staging/wilc1000: add struct net_device declaration
Message-ID<qtr97-3J0-3@gated-at.bofh.it>
In reply to#1266861
On Wed, Nov 11, 2015 at 12:42:21AM +0100, Arnd Bergmann wrote:
> A recent cleanup added a reference to struct net_device, but
> that structure is not always visible in the context of the
> declaration, so we may get a compile-time error:
> 
> In file included from wilc1000/host_interface.c:5:0:
> wilc1000/host_interface.h:705:46: warning: 'struct net_device' declared inside parameter list
>  s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
> 
> This adds a forward-declaration for the structure name to avoid
> that error.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: d5382219138d ("staging: wilc1000: host_int_init: add argument net_device")
> ---
>  drivers/staging/wilc1000/host_interface.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
> index 57e1d424afdc..29a92d690384 100644
> --- a/drivers/staging/wilc1000/host_interface.h
> +++ b/drivers/staging/wilc1000/host_interface.h
> @@ -369,6 +369,7 @@ s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource,
>  s32 hif_set_cfg(struct host_if_drv *hWFIDrv,
>  		struct cfg_param_val *pstrCfgParamVal);
>  s32 hif_get_cfg(struct host_if_drv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value);
> +struct net_device;

I think this is already fixed in my staging-testing branch, right?

and as Joe said, a #include would be nicer.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266882 — Re: [PATCH 01/20] staging/wilc1000: add struct net_device declaration

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-11 01:20 +0100
SubjectRe: [PATCH 01/20] staging/wilc1000: add struct net_device declaration
Message-ID<qtriN-3Mi-1@gated-at.bofh.it>
In reply to#1266881
On Tuesday 10 November 2015 16:02:48 Greg Kroah-Hartman wrote:
> On Wed, Nov 11, 2015 at 12:42:21AM +0100, Arnd Bergmann wrote:
> I think this is already fixed in my staging-testing branch, right?

Ah right. I only got it with some rare randconfig builds, and assumed
the problem was still there because I did not see a patch that fixed
it. However, the config that originally failed is now fine, so it's
probably fixed.

The other patches won't apply cleanly without this one unfortunately.
Let me know if I should re-send them without this patch, as I don't
want to spam everyone unnecessarily.

You can also find my patches (now rebased with patch 1 dropped) in

git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git wilc1000

if that helps.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266895 — Re: [PATCH 01/20] staging/wilc1000: add struct net_device declaration

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2015-11-11 01:40 +0100
SubjectRe: [PATCH 01/20] staging/wilc1000: add struct net_device declaration
Message-ID<qtrCa-3Ub-3@gated-at.bofh.it>
In reply to#1266882
On Wed, Nov 11, 2015 at 01:13:33AM +0100, Arnd Bergmann wrote:
> On Tuesday 10 November 2015 16:02:48 Greg Kroah-Hartman wrote:
> > On Wed, Nov 11, 2015 at 12:42:21AM +0100, Arnd Bergmann wrote:
> > I think this is already fixed in my staging-testing branch, right?
> 
> Ah right. I only got it with some rare randconfig builds, and assumed
> the problem was still there because I did not see a patch that fixed
> it. However, the config that originally failed is now fine, so it's
> probably fixed.
> 
> The other patches won't apply cleanly without this one unfortunately.
> Let me know if I should re-send them without this patch, as I don't
> want to spam everyone unnecessarily.


Let me see how well they apply if I skip this, I can always hand-edit
patches (do it all the time...)

But give me a week or so to catch up on things, these are in my queue,
not lost.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266862 — [PATCH 17/20] staging/wilc1000: remove WILC_SDIO/WILC_SPI macros

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-11 00:50 +0100
Subject[PATCH 17/20] staging/wilc1000: remove WILC_SDIO/WILC_SPI macros
Message-ID<qtqPL-3lH-13@gated-at.bofh.it>
In reply to#1266859
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 <arnd@arndb.de>
---
 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_STATUS	2
 #define WILC_CFG_RSP_SCAN	3
 
-#ifdef WILC_SDIO
-#define WILC_PLL_TO		4
-#else
-#define WILC_PLL_TO		2
-#endif
+#define WILC_PLL_TO_SDIO	4
+#define WILC_PLL_TO_SPI		2
 #define ABORT_INT		BIT(31)
 
 /*******************************************/
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266863 — [PATCH 10/20] staging/wilc1000: move init/exit functions to driver files

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-11 00:50 +0100
Subject[PATCH 10/20] staging/wilc1000: move init/exit functions to driver files
Message-ID<qtqPM-3lH-17@gated-at.bofh.it>
In reply to#1266859
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 <arnd@arndb.de>
---
 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(&wilc_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(&wilc))
-		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(&wilc_bus);
-#else
-	PRINT_D(INIT_DBG, "SDIO unregister...\n");
-	sdio_unregister_driver(&wilc_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(&wilc_bus);
+}
+late_initcall(init_wilc_sdio_driver);
+
+static void __exit exit_wilc_sdio_driver(void)
+{
+	sdio_unregister_driver(&wilc_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 <linux/mmc/sdio_func.h>
 
+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 b/drivers/staging/wilc1000/linux_wlan_spi.c
index 790128f6d034..f279a434c4c2 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -11,6 +11,7 @@
 
 #include "linux_wlan_common.h"
 #include "linux_wlan_spi.h"
+#include "wilc_wfi_netdevice.h"
 
 #define USE_SPI_DMA     0       /* johnny add */
 
@@ -68,7 +69,7 @@ static const struct of_device_id wilc1000_of_match[] = {
 MODULE_DEVICE_TABLE(of, wilc1000_of_match);
 #endif
 
-struct spi_driver wilc_bus __refdata = {
+static struct spi_driver wilc_bus __refdata = {
 	.driver = {
 		.name = MODALIAS,
 #ifdef CONFIG_OF
@@ -393,3 +394,23 @@ int wilc_spi_set_max_speed(void)
 	PRINT_INFO(BUS_DBG, "@@@@@@@@@@@@ change SPI speed to %d @@@@@@@@@\n", SPEED);
 	return 1;
 }
+
+static struct wilc *wilc;
+
+static int __init init_wilc_spi_driver(void)
+{
+	wilc_debugfs_init();
+	return wilc_netdev_init(&wilc);
+}
+late_initcall(init_wilc_spi_driver);
+
+static void __exit exit_wilc_spi_driver(void)
+{
+	if (wilc)
+		wilc_netdev_cleanup(wilc);
+	spi_unregister_driver(&wilc_bus);
+	wilc_debugfs_remove();
+}
+module_exit(exit_wilc_spi_driver);
+
+MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h
index aecb522ff56d..f434f79913ab 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.h
+++ b/drivers/staging/wilc1000/linux_wlan_spi.h
@@ -2,12 +2,11 @@
 #define LINUX_WLAN_SPI_H
 
 #include <linux/spi/spi.h>
-extern struct spi_device *wilc_spi_dev;
-extern struct spi_driver wilc_bus;
 
 int wilc_spi_init(void);
 int wilc_spi_write(u8 *b, u32 len);
 int wilc_spi_read(u8 *rb, u32 rlen);
 int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen);
 int wilc_spi_set_max_speed(void);
+
 #endif
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 0c608d73a22e..9adac5c781ee 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -216,7 +216,7 @@ void linux_wlan_mac_indicate(struct wilc *wilc, int flag);
 void linux_wlan_rx_complete(void);
 void linux_wlan_dbg(u8 *buff);
 int linux_wlan_lock_timeout(void *vp, u32 timeout);
-void wl_wlan_cleanup(struct wilc *wilc);
+void wilc_netdev_cleanup(struct wilc *wilc);
 int wilc_netdev_init(struct wilc **wilc);
 void wilc1000_wlan_deinit(struct net_device *dev);
 void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266864 — [PATCH 06/20] staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-11 00:50 +0100
Subject[PATCH 06/20] staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT
Message-ID<qtqPM-3lH-21@gated-at.bofh.it>
In reply to#1266859
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 <arnd@arndb.de>
---
 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-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266867 — [PATCH 15/20] staging/wilc1000: pass hif operations through initialization

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-11 00:50 +0100
Subject[PATCH 15/20] staging/wilc1000: pass hif operations through initialization
Message-ID<qtqPM-3lH-25@gated-at.bofh.it>
In reply to#1266859
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 <arnd@arndb.de>
---
 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(&g_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(&wilc, &func->dev, HIF_SDIO, gpio)) {
+	if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio,
+			     &wilc_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(&wilc, NULL, HIF_SPI, GPIO_NUM);
+	ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_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 8441fcccccc4..0a9b5a71772e 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_rx_ext = sdio_write,
+	.hif_block_tx_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..0433e2b5f80a 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,
-	wilc_spi_write_reg,
-	_wilc_spi_read,
-	_wilc_spi_write,
-	wilc_spi_sync,
-	wilc_spi_clear_int,
-	wilc_spi_read_int,
-	wilc_spi_clear_int_ext,
-	wilc_spi_read_size,
-	_wilc_spi_write,
-	_wilc_spi_read,
-	wilc_spi_sync_ext,
-	wilc_spi_max_bus_speed,
-	wilc_spi_default_bus_speed,
+const struct wilc_hif_func wilc_hif_spi = {
+	.hif_init = _wilc_spi_init,
+	.hif_deinit = _wilc_spi_deinit,
+	.hif_read_reg = wilc_spi_read_reg,
+	.hif_write_reg = wilc_spi_write_reg,
+	.hif_block_rx = _wilc_spi_read,
+	.hif_block_tx = _wilc_spi_write,
+	.hif_sync = wilc_spi_sync,
+	.hif_clear_int = wilc_spi_clear_int,
+	.hif_read_int = wilc_spi_read_int,
+	.hif_clear_int_ext = wilc_spi_clear_int_ext,
+	.hif_read_size = wilc_spi_read_size,
+	.hif_block_rx_ext = _wilc_spi_write,
+	.hif_block_rx_ext = _wilc_spi_read,
+	.hif_sync_ext = wilc_spi_sync_ext,
+	.hif_set_max_bus_speed = wilc_spi_max_bus_speed,
+	.hif_set_default_bus_speed = wilc_spi_default_bus_speed,
 };
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 92f4cb71608d..761bc3f59138 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 {
+	const struct wilc_hif_func *ops;
 	int io_type;
 	int mac_status;
 	int gpio;
@@ -212,7 +213,8 @@ 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, struct device *, int io_type, int gpio);
+int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type, int gpio,
+		     const struct wilc_hif_func *ops);
 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);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 3d53550149fb..5e37ec65d3bb 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1657,22 +1657,11 @@ int wilc_wlan_init(struct net_device *dev)
 
 	memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t));
 	g_wlan.io_type = wilc->io_type;
-
-#ifdef WILC_SDIO
-	if (!wilc_hif_sdio.hif_init(wilc, wilc_debug)) {
-		ret = -EIO;
-		goto _fail_;
-	}
-	memcpy((void *)&g_wlan.hif_func, &wilc_hif_sdio,
-	       sizeof(struct wilc_hif_func));
-#else
-	if (!wilc_hif_spi.hif_init(wilc, wilc_debug)) {
+	g_wlan.hif_func = *wilc->ops;
+	if (!g_wlan.hif_func.hif_init(wilc, wilc_debug)) {
 		ret = -EIO;
 		goto _fail_;
 	}
-	memcpy((void *)&g_wlan.hif_func, &wilc_hif_spi,
-	       sizeof(struct wilc_hif_func));
-#endif
 
 	if (!wilc_wlan_cfg_init(wilc_debug)) {
 		ret = -ENOBUFS;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 326d71bf91df..c0a5a955b1d4 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -258,8 +258,8 @@ struct wilc_hif_func {
 	void (*hif_set_default_bus_speed)(void);
 };
 
-extern struct wilc_hif_func wilc_hif_spi;
-extern struct wilc_hif_func wilc_hif_sdio;
+extern const struct wilc_hif_func wilc_hif_spi;
+extern const struct wilc_hif_func wilc_hif_sdio;
 
 /********************************************
  *
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


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

Fromglen lee <glen.lee@atmel.com>
Date2015-11-12 11:10 +0100
SubjectRe: [PATCH 15/20] staging/wilc1000: pass hif operations through initialization
Message-ID<qtWZm-7yp-53@gated-at.bofh.it>
In reply to#1266867
Hi arnd,

I appreciate the patches.
I did test this patch series on h/w which is arm based MCU.
 From this patch wilc is not working properly. After downloading firmware, the firmware cannot start and it fails.
I double check this patch and the previous one(14/20) which works fine.
I cannot find the problem in this patch at the moment. I will see if I can find something,
and I'd appreciate if you would help with it.

regards,
glen lee


On 2015년 11월 11일 08:42, Arnd Bergmann wrote:
> 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 <arnd@arndb.de>
> ---
>   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(&g_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(&wilc, &func->dev, HIF_SDIO, gpio)) {
> +	if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio,
> +			     &wilc_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(&wilc, NULL, HIF_SPI, GPIO_NUM);
> +	ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_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 8441fcccccc4..0a9b5a71772e 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_rx_ext = sdio_write,
> +	.hif_block_tx_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..0433e2b5f80a 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,
> -	wilc_spi_write_reg,
> -	_wilc_spi_read,
> -	_wilc_spi_write,
> -	wilc_spi_sync,
> -	wilc_spi_clear_int,
> -	wilc_spi_read_int,
> -	wilc_spi_clear_int_ext,
> -	wilc_spi_read_size,
> -	_wilc_spi_write,
> -	_wilc_spi_read,
> -	wilc_spi_sync_ext,
> -	wilc_spi_max_bus_speed,
> -	wilc_spi_default_bus_speed,
> +const struct wilc_hif_func wilc_hif_spi = {
> +	.hif_init = _wilc_spi_init,
> +	.hif_deinit = _wilc_spi_deinit,
> +	.hif_read_reg = wilc_spi_read_reg,
> +	.hif_write_reg = wilc_spi_write_reg,
> +	.hif_block_rx = _wilc_spi_read,
> +	.hif_block_tx = _wilc_spi_write,
> +	.hif_sync = wilc_spi_sync,
> +	.hif_clear_int = wilc_spi_clear_int,
> +	.hif_read_int = wilc_spi_read_int,
> +	.hif_clear_int_ext = wilc_spi_clear_int_ext,
> +	.hif_read_size = wilc_spi_read_size,
> +	.hif_block_rx_ext = _wilc_spi_write,
> +	.hif_block_rx_ext = _wilc_spi_read,
> +	.hif_sync_ext = wilc_spi_sync_ext,
> +	.hif_set_max_bus_speed = wilc_spi_max_bus_speed,
> +	.hif_set_default_bus_speed = wilc_spi_default_bus_speed,
>   };
> diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
> index 92f4cb71608d..761bc3f59138 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 {
> +	const struct wilc_hif_func *ops;
>   	int io_type;
>   	int mac_status;
>   	int gpio;
> @@ -212,7 +213,8 @@ 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, struct device *, int io_type, int gpio);
> +int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type, int gpio,
> +		     const struct wilc_hif_func *ops);
>   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);
> diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
> index 3d53550149fb..5e37ec65d3bb 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.c
> +++ b/drivers/staging/wilc1000/wilc_wlan.c
> @@ -1657,22 +1657,11 @@ int wilc_wlan_init(struct net_device *dev)
>   
>   	memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t));
>   	g_wlan.io_type = wilc->io_type;
> -
> -#ifdef WILC_SDIO
> -	if (!wilc_hif_sdio.hif_init(wilc, wilc_debug)) {
> -		ret = -EIO;
> -		goto _fail_;
> -	}
> -	memcpy((void *)&g_wlan.hif_func, &wilc_hif_sdio,
> -	       sizeof(struct wilc_hif_func));
> -#else
> -	if (!wilc_hif_spi.hif_init(wilc, wilc_debug)) {
> +	g_wlan.hif_func = *wilc->ops;
> +	if (!g_wlan.hif_func.hif_init(wilc, wilc_debug)) {
>   		ret = -EIO;
>   		goto _fail_;
>   	}
> -	memcpy((void *)&g_wlan.hif_func, &wilc_hif_spi,
> -	       sizeof(struct wilc_hif_func));
> -#endif
>   
>   	if (!wilc_wlan_cfg_init(wilc_debug)) {
>   		ret = -ENOBUFS;
> diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
> index 326d71bf91df..c0a5a955b1d4 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.h
> +++ b/drivers/staging/wilc1000/wilc_wlan.h
> @@ -258,8 +258,8 @@ struct wilc_hif_func {
>   	void (*hif_set_default_bus_speed)(void);
>   };
>   
> -extern struct wilc_hif_func wilc_hif_spi;
> -extern struct wilc_hif_func wilc_hif_sdio;
> +extern const struct wilc_hif_func wilc_hif_spi;
> +extern const struct wilc_hif_func wilc_hif_sdio;
>   
>   /********************************************
>    *

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


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

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-12 12:40 +0100
SubjectRe: [PATCH 15/20] staging/wilc1000: pass hif operations through initialization
Message-ID<qtYoq-8hK-19@gated-at.bofh.it>
In reply to#1267780
On Thursday 12 November 2015 19:05:41 glen lee wrote:
> Hi arnd,
> 
> I appreciate the patches.
> I did test this patch series on h/w which is arm based MCU.
>  From this patch wilc is not working properly. After downloading firmware, the firmware cannot start and it fails.
> I double check this patch and the previous one(14/20) which works fine.
> I cannot find the problem in this patch at the moment. I will see if I can find something,
> and I'd appreciate if you would help with it.
> 

I've looked at it some more, but didn't find anything obvious, here are some
possible things I found:


> > -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_rx_ext = sdio_write,
> > +	.hif_block_tx_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,
> >   };

If the callbacks are not in the same order here, something could
in theory go wrong. I've tried to verify them by inspection and
could not find anything here, but you can try reverting this part.

> >   	memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t));
> >   	g_wlan.io_type = wilc->io_type;
> > -
> > -#ifdef WILC_SDIO
> > -	if (!wilc_hif_sdio.hif_init(wilc, wilc_debug)) {
> > -		ret = -EIO;
> > -		goto _fail_;
> > -	}
> > -	memcpy((void *)&g_wlan.hif_func, &wilc_hif_sdio,
> > -	       sizeof(struct wilc_hif_func));
> > -#else
> > -	if (!wilc_hif_spi.hif_init(wilc, wilc_debug)) {
> > +	g_wlan.hif_func = *wilc->ops;
> > +	if (!g_wlan.hif_func.hif_init(wilc, wilc_debug)) {
> >   		ret = -EIO;
> >   		goto _fail_;
> >   	}
> > -	memcpy((void *)&g_wlan.hif_func, &wilc_hif_spi,
> > -	       sizeof(struct wilc_hif_func));
> > -#endif

This is the most likely part I found:

doing an assigment instead of memcpy should not make a difference,
but my new version also called init after copying over the
operations rather than before. This seemed to be the correct
order when I did it, but it is a change in behavior that might
cause problems if some code relies on the hif_func structure
to be empty at the time that hif_init is called.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


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

Fromglen lee <glen.lee@atmel.com>
Date2015-11-13 08:50 +0100
SubjectRe: [PATCH 15/20] staging/wilc1000: pass hif operations through initialization
Message-ID<quhho-3uW-9@gated-at.bofh.it>
In reply to#1267836

On 2015년 11월 12일 20:39, Arnd Bergmann wrote:
> On Thursday 12 November 2015 19:05:41 glen lee wrote:
>> Hi arnd,
>>
>> I appreciate the patches.
>> I did test this patch series on h/w which is arm based MCU.
>>   From this patch wilc is not working properly. After downloading firmware, the firmware cannot start and it fails.
>> I double check this patch and the previous one(14/20) which works fine.
>> I cannot find the problem in this patch at the moment. I will see if I can find something,
>> and I'd appreciate if you would help with it.
>>
> I've looked at it some more, but didn't find anything obvious, here are some
> possible things I found:
>
>
>>> -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_rx_ext = sdio_write,
>>> +	.hif_block_tx_ext = sdio_read,

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.

regards,
glen lee

>>> +	.hif_sync_ext = sdio_sync_ext,
>>> +	.hif_set_max_bus_speed = sdio_set_max_speed,
>>> +	.hif_set_default_bus_speed = sdio_set_default_speed,
>>>    };
> If the callbacks are not in the same order here, something could
> in theory go wrong. I've tried to verify them by inspection and
> could not find anything here, but you can try reverting this part.
>
>>>    	memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t));
>>>    	g_wlan.io_type = wilc->io_type;
>>> -
>>> -#ifdef WILC_SDIO
>>> -	if (!wilc_hif_sdio.hif_init(wilc, wilc_debug)) {
>>> -		ret = -EIO;
>>> -		goto _fail_;
>>> -	}
>>> -	memcpy((void *)&g_wlan.hif_func, &wilc_hif_sdio,
>>> -	       sizeof(struct wilc_hif_func));
>>> -#else
>>> -	if (!wilc_hif_spi.hif_init(wilc, wilc_debug)) {
>>> +	g_wlan.hif_func = *wilc->ops;
>>> +	if (!g_wlan.hif_func.hif_init(wilc, wilc_debug)) {
>>>    		ret = -EIO;
>>>    		goto _fail_;
>>>    	}
>>> -	memcpy((void *)&g_wlan.hif_func, &wilc_hif_spi,
>>> -	       sizeof(struct wilc_hif_func));
>>> -#endif
> This is the most likely part I found:
>
> doing an assigment instead of memcpy should not make a difference,
> but my new version also called init after copying over the
> operations rather than before. This seemed to be the correct
> order when I did it, but it is a change in behavior that might
> cause problems if some code relies on the hif_func structure
> to be empty at the time that hif_init is called.
>
> 	Arnd

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


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

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-13 10:20 +0100
SubjectRe: [PATCH 15/20] staging/wilc1000: pass hif operations through initialization
Message-ID<quiGt-4vC-3@gated-at.bofh.it>
In reply to#1268669
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?

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


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

Fromglen lee <glen.lee@atmel.com>
Date2015-11-16 02:40 +0100
SubjectRe: [PATCH 15/20] staging/wilc1000: pass hif operations through initialization
Message-ID<qvgVX-M3-13@gated-at.bofh.it>
In reply to#1268709
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.

regards,
glen lee.

> 	Arnd

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266868 — [PATCH 19/20] staging/wilc1000: use more regular probing

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-11 00:50 +0100
Subject[PATCH 19/20] staging/wilc1000: use more regular probing
Message-ID<qtqPM-3lH-31@gated-at.bofh.it>
In reply to#1266859
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 <arnd@arndb.de>
---
 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 *)&ios, (void *)&wilc_sdio_func->card->host->ios, sizeof(struct mmc_ios));
-	wilc_sdio_func->card->host->ios.clock = speed;
+	memcpy((void *)&ios, (void *)&func->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, &ios);
-	sdio_release_host(wilc_sdio_func);
+	func->card->host->ops->set_ios(func->card->host, &ios);
+	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(&wilc_bus);
-}
-late_initcall(init_wilc_sdio_driver);
-
-static void __exit exit_wilc_sdio_driver(void)
-{
-	sdio_unregister_driver(&wilc_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
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -8,6 +8,7 @@
 #include <linux/uaccess.h>
 #include <linux/device.h>
 #include <linux/spi/spi.h>
+#include <linux/of_gpio.h>
 
 #include "linux_wlan_spi.h"
 #include "wilc_wfi_netdevice.h"
@@ -43,59 +44,53 @@
 
 static u32 SPEED = MIN_SPEED;
 
-struct spi_device *wilc_spi_dev;
+static const struct wilc1000_ops wilc1000_spi_ops;
 
-static int __init wilc_bus_probe(struct spi_device *spi)
+static int wilc_bus_probe(struct spi_device *spi)
 {
+	int ret, gpio;
+	struct wilc *wilc;
 
-	PRINT_D(BUS_DBG, "spiModalias: %s\n", spi->modalias);
-	PRINT_D(BUS_DBG, "spiMax-Speed: %d\n", spi->max_speed_hz);
-	wilc_spi_dev = spi;
+	gpio = of_get_gpio(spi->dev.of_node, 0);
+	if (gpio < 0)
+		gpio = GPIO_NUM;
+
+	ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_hif_spi);
+	if (ret)
+		return ret;
+
+	spi_set_drvdata(spi, wilc);
+	wilc->dev = &spi->dev;
 
-	printk("Driver Initializing success\n");
 	return 0;
 }
 
-static int __exit wilc_bus_remove(struct spi_device *spi)
+static int wilc_bus_remove(struct spi_device *spi)
 {
-
+	wilc_netdev_cleanup(spi_get_drvdata(spi));
 	return 0;
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id wilc1000_of_match[] = {
 	{ .compatible = "atmel,wilc_spi", },
 	{}
 };
 MODULE_DEVICE_TABLE(of, wilc1000_of_match);
-#endif
 
-static struct spi_driver wilc_bus __refdata = {
+struct spi_driver wilc1000_spi_driver = {
 	.driver = {
 		.name = MODALIAS,
-#ifdef CONFIG_OF
 		.of_match_table = wilc1000_of_match,
-#endif
 	},
 	.probe =  wilc_bus_probe,
-	.remove = __exit_p(wilc_bus_remove),
+	.remove = wilc_bus_remove,
 };
+module_spi_driver(wilc1000_spi_driver);
+MODULE_LICENSE("GPL");
 
 int wilc_spi_init(void)
 {
-	int ret = 1;
-	static int called;
-
-
-	if (called == 0) {
-		called++;
-		ret = spi_register_driver(&wilc_bus);
-	}
-
-	/* change return value to match WILC interface */
-	(ret < 0) ? (ret = 0) : (ret = 1);
-
-	return ret;
+	return 1;
 }
 
 #if defined(PLAT_WMS8304)
@@ -106,6 +101,7 @@ int wilc_spi_init(void)
 
 int wilc_spi_write(u8 *b, u32 len)
 {
+	struct spi_device *spi = to_spi_device(wilc_dev->dev);
 	int ret;
 
 	if (len > 0 && b != NULL) {
@@ -132,11 +128,11 @@ int wilc_spi_write(u8 *b, u32 len)
 
 				memset(&msg, 0, sizeof(msg));
 				spi_message_init(&msg);
-				msg.spi = wilc_spi_dev;
+				msg.spi = spi;
 				msg.is_dma_mapped = USE_SPI_DMA;
 
 				spi_message_add_tail(&tr, &msg);
-				ret = spi_sync(wilc_spi_dev, &msg);
+				ret = spi_sync(spi, &msg);
 				if (ret < 0) {
 					PRINT_ER("SPI transaction failed\n");
 				}
@@ -157,11 +153,11 @@ int wilc_spi_write(u8 *b, u32 len)
 
 			memset(&msg, 0, sizeof(msg));
 			spi_message_init(&msg);
-			msg.spi = wilc_spi_dev;
+			msg.spi = spi;
 			msg.is_dma_mapped = USE_SPI_DMA;                                /* rachel */
 
 			spi_message_add_tail(&tr, &msg);
-			ret = spi_sync(wilc_spi_dev, &msg);
+			ret = spi_sync(spi, &msg);
 			if (ret < 0) {
 				PRINT_ER("SPI transaction failed\n");
 			}
@@ -183,7 +179,7 @@ int wilc_spi_write(u8 *b, u32 len)
 #else
 int wilc_spi_write(u8 *b, u32 len)
 {
-
+	struct spi_device *spi = to_spi_device(wilc_dev->dev);
 	int ret;
 	struct spi_message msg;
 
@@ -204,12 +200,12 @@ int wilc_spi_write(u8 *b, u32 len)
 		memset(&msg, 0, sizeof(msg));
 		spi_message_init(&msg);
 /* [[johnny add */
-		msg.spi = wilc_spi_dev;
+		msg.spi = spi;
 		msg.is_dma_mapped = USE_SPI_DMA;
 /* ]] */
 		spi_message_add_tail(&tr, &msg);
 
-		ret = spi_sync(wilc_spi_dev, &msg);
+		ret = spi_sync(spi, &msg);
 		if (ret < 0) {
 			PRINT_ER("SPI transaction failed\n");
 		}
@@ -234,6 +230,7 @@ int wilc_spi_write(u8 *b, u32 len)
 
 int wilc_spi_read(u8 *rb, u32 rlen)
 {
+	struct spi_device *spi = to_spi_device(wilc_dev->dev);
 	int ret;
 
 	if (rlen > 0) {
@@ -260,11 +257,11 @@ int wilc_spi_read(u8 *rb, u32 rlen)
 
 				memset(&msg, 0, sizeof(msg));
 				spi_message_init(&msg);
-				msg.spi = wilc_spi_dev;
+				msg.spi = spi;
 				msg.is_dma_mapped = USE_SPI_DMA;
 
 				spi_message_add_tail(&tr, &msg);
-				ret = spi_sync(wilc_spi_dev, &msg);
+				ret = spi_sync(spi, &msg);
 				if (ret < 0) {
 					PRINT_ER("SPI transaction failed\n");
 				}
@@ -284,11 +281,11 @@ int wilc_spi_read(u8 *rb, u32 rlen)
 
 			memset(&msg, 0, sizeof(msg));
 			spi_message_init(&msg);
-			msg.spi = wilc_spi_dev;
+			msg.spi = spi;
 			msg.is_dma_mapped = USE_SPI_DMA;                                /* rachel */
 
 			spi_message_add_tail(&tr, &msg);
-			ret = spi_sync(wilc_spi_dev, &msg);
+			ret = spi_sync(spi, &msg);
 			if (ret < 0) {
 				PRINT_ER("SPI transaction failed\n");
 			}
@@ -308,7 +305,7 @@ int wilc_spi_read(u8 *rb, u32 rlen)
 #else
 int wilc_spi_read(u8 *rb, u32 rlen)
 {
-
+	struct spi_device *spi = to_spi_device(wilc_dev->dev);
 	int ret;
 
 	if (rlen > 0) {
@@ -329,12 +326,12 @@ int wilc_spi_read(u8 *rb, u32 rlen)
 		memset(&msg, 0, sizeof(msg));
 		spi_message_init(&msg);
 /* [[ johnny add */
-		msg.spi = wilc_spi_dev;
+		msg.spi = spi;
 		msg.is_dma_mapped = USE_SPI_DMA;
 /* ]] */
 		spi_message_add_tail(&tr, &msg);
 
-		ret = spi_sync(wilc_spi_dev, &msg);
+		ret = spi_sync(spi, &msg);
 		if (ret < 0) {
 			PRINT_ER("SPI transaction failed\n");
 		}
@@ -353,7 +350,7 @@ int wilc_spi_read(u8 *rb, u32 rlen)
 
 int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
 {
-
+	struct spi_device *spi = to_spi_device(wilc_dev->dev);
 	int ret;
 
 	if (rlen > 0) {
@@ -370,11 +367,11 @@ int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
 
 		memset(&msg, 0, sizeof(msg));
 		spi_message_init(&msg);
-		msg.spi = wilc_spi_dev;
+		msg.spi = spi;
 		msg.is_dma_mapped = USE_SPI_DMA;
 
 		spi_message_add_tail(&tr, &msg);
-		ret = spi_sync(wilc_spi_dev, &msg);
+		ret = spi_sync(spi, &msg);
 		if (ret < 0) {
 			PRINT_ER("SPI transaction failed\n");
 		}
@@ -395,40 +392,3 @@ int wilc_spi_set_max_speed(void)
 	PRINT_INFO(BUS_DBG, "@@@@@@@@@@@@ change SPI speed to %d @@@@@@@@@\n", SPEED);
 	return 1;
 }
-
-static struct wilc *wilc;
-
-static int __init init_wilc_spi_driver(void)
-{
-	int ret;
-
-	wilc_debugfs_init();
-
-	ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_hif_spi);
-	if (ret) {
-		wilc_debugfs_remove();
-		return ret;
-	}
-
-	if (!wilc_spi_init() || !wilc_spi_dev) {
-		PRINT_ER("Can't initialize SPI\n");
-		wilc_netdev_cleanup(wilc);
-		wilc_debugfs_remove();
-		return -ENXIO;
-	}
-	wilc_dev->dev = &wilc_spi_dev->dev;
-
-	return ret;
-}
-late_initcall(init_wilc_spi_driver);
-
-static void __exit exit_wilc_spi_driver(void)
-{
-	if (wilc)
-		wilc_netdev_cleanup(wilc);
-	spi_unregister_driver(&wilc_bus);
-	wilc_debugfs_remove();
-}
-module_exit(exit_wilc_spi_driver);
-
-MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c
index 158a1df17195..27c653a0cdf9 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -138,7 +138,7 @@ static struct wilc_debugfs_info_t debugfs_info[] = {
 	{ "wilc_debug_region",	0666,	(INIT_DBG | GENERIC_DBG | CFG80211_DBG), FOPS(NULL, wilc_debug_region_read, wilc_debug_region_write, NULL), },
 };
 
-int wilc_debugfs_init(void)
+static int __init wilc_debugfs_init(void)
 {
 	int i;
 
@@ -173,11 +173,13 @@ int wilc_debugfs_init(void)
 	}
 	return 0;
 }
+module_init(wilc_debugfs_init);
 
-void wilc_debugfs_remove(void)
+static void __exit wilc_debugfs_remove(void)
 {
 	debugfs_remove_recursive(wilc_dir);
 }
+module_exit(wilc_debugfs_remove);
 
 #endif
 
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1267019 — Re: [PATCH 19/20] staging/wilc1000: use more regular probing

FromAndy Shevchenko <andy.shevchenko@gmail.com>
Date2015-11-11 09:00 +0100
SubjectRe: [PATCH 19/20] staging/wilc1000: use more regular probing
Message-ID<qtytX-8jJ-3@gated-at.bofh.it>
In reply to#1266868
On Wed, Nov 11, 2015 at 1:42 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> 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 <arnd@arndb.de>
> ---
>  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)

if this is still in use?
Is it about DEBUG or 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);

Macro for specific container_of?

>
> -       sdio_claim_host(wilc_sdio_func);
> +       sdio_claim_host(func);
>
> -       memcpy((void *)&ios, (void *)&wilc_sdio_func->card->host->ios, sizeof(struct mmc_ios));
> -       wilc_sdio_func->card->host->ios.clock = speed;
> +       memcpy((void *)&ios, (void *)&func->card->host->ios, sizeof(struct mmc_ios));

Hm... Do we need to explicitly cast pointers to void*?

> +       func->card->host->ios.clock = speed;
>         ios.clock = speed;
> -       wilc_sdio_func->card->host->ops->set_ios(wilc_sdio_func->card->host, &ios);
> -       sdio_release_host(wilc_sdio_func);
> +       func->card->host->ops->set_ios(func->card->host, &ios);
> +       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(&wilc_bus);
> -}
> -late_initcall(init_wilc_sdio_driver);
> -
> -static void __exit exit_wilc_sdio_driver(void)
> -{
> -       sdio_unregister_driver(&wilc_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
> +++ b/drivers/staging/wilc1000/linux_wlan_spi.c
> @@ -8,6 +8,7 @@
>  #include <linux/uaccess.h>
>  #include <linux/device.h>
>  #include <linux/spi/spi.h>
> +#include <linux/of_gpio.h>
>
>  #include "linux_wlan_spi.h"
>  #include "wilc_wfi_netdevice.h"
> @@ -43,59 +44,53 @@
>
>  static u32 SPEED = MIN_SPEED;
>
> -struct spi_device *wilc_spi_dev;
> +static const struct wilc1000_ops wilc1000_spi_ops;
>
> -static int __init wilc_bus_probe(struct spi_device *spi)
> +static int wilc_bus_probe(struct spi_device *spi)
>  {
> +       int ret, gpio;
> +       struct wilc *wilc;
>
> -       PRINT_D(BUS_DBG, "spiModalias: %s\n", spi->modalias);
> -       PRINT_D(BUS_DBG, "spiMax-Speed: %d\n", spi->max_speed_hz);
> -       wilc_spi_dev = spi;
> +       gpio = of_get_gpio(spi->dev.of_node, 0);
> +       if (gpio < 0)
> +               gpio = GPIO_NUM;
> +
> +       ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_hif_spi);
> +       if (ret)
> +               return ret;
> +
> +       spi_set_drvdata(spi, wilc);
> +       wilc->dev = &spi->dev;
>
> -       printk("Driver Initializing success\n");
>         return 0;
>  }
>
> -static int __exit wilc_bus_remove(struct spi_device *spi)
> +static int wilc_bus_remove(struct spi_device *spi)
>  {
> -
> +       wilc_netdev_cleanup(spi_get_drvdata(spi));
>         return 0;
>  }
>
> -#ifdef CONFIG_OF
>  static const struct of_device_id wilc1000_of_match[] = {
>         { .compatible = "atmel,wilc_spi", },
>         {}
>  };
>  MODULE_DEVICE_TABLE(of, wilc1000_of_match);
> -#endif
>
> -static struct spi_driver wilc_bus __refdata = {
> +struct spi_driver wilc1000_spi_driver = {
>         .driver = {
>                 .name = MODALIAS,
> -#ifdef CONFIG_OF
>                 .of_match_table = wilc1000_of_match,
> -#endif
>         },
>         .probe =  wilc_bus_probe,
> -       .remove = __exit_p(wilc_bus_remove),
> +       .remove = wilc_bus_remove,
>  };
> +module_spi_driver(wilc1000_spi_driver);
> +MODULE_LICENSE("GPL");
>
>  int wilc_spi_init(void)
>  {
> -       int ret = 1;
> -       static int called;
> -
> -
> -       if (called == 0) {
> -               called++;
> -               ret = spi_register_driver(&wilc_bus);
> -       }
> -
> -       /* change return value to match WILC interface */
> -       (ret < 0) ? (ret = 0) : (ret = 1);
> -
> -       return ret;
> +       return 1;
>  }
>
>  #if defined(PLAT_WMS8304)
> @@ -106,6 +101,7 @@ int wilc_spi_init(void)
>
>  int wilc_spi_write(u8 *b, u32 len)
>  {
> +       struct spi_device *spi = to_spi_device(wilc_dev->dev);
>         int ret;
>
>         if (len > 0 && b != NULL) {
> @@ -132,11 +128,11 @@ int wilc_spi_write(u8 *b, u32 len)
>
>                                 memset(&msg, 0, sizeof(msg));
>                                 spi_message_init(&msg);
> -                               msg.spi = wilc_spi_dev;
> +                               msg.spi = spi;
>                                 msg.is_dma_mapped = USE_SPI_DMA;
>
>                                 spi_message_add_tail(&tr, &msg);
> -                               ret = spi_sync(wilc_spi_dev, &msg);
> +                               ret = spi_sync(spi, &msg);
>                                 if (ret < 0) {
>                                         PRINT_ER("SPI transaction failed\n");
>                                 }
> @@ -157,11 +153,11 @@ int wilc_spi_write(u8 *b, u32 len)
>
>                         memset(&msg, 0, sizeof(msg));
>                         spi_message_init(&msg);
> -                       msg.spi = wilc_spi_dev;
> +                       msg.spi = spi;
>                         msg.is_dma_mapped = USE_SPI_DMA;                                /* rachel */
>
>                         spi_message_add_tail(&tr, &msg);
> -                       ret = spi_sync(wilc_spi_dev, &msg);
> +                       ret = spi_sync(spi, &msg);
>                         if (ret < 0) {
>                                 PRINT_ER("SPI transaction failed\n");
>                         }
> @@ -183,7 +179,7 @@ int wilc_spi_write(u8 *b, u32 len)
>  #else
>  int wilc_spi_write(u8 *b, u32 len)
>  {
> -
> +       struct spi_device *spi = to_spi_device(wilc_dev->dev);
>         int ret;
>         struct spi_message msg;
>
> @@ -204,12 +200,12 @@ int wilc_spi_write(u8 *b, u32 len)
>                 memset(&msg, 0, sizeof(msg));
>                 spi_message_init(&msg);
>  /* [[johnny add */
> -               msg.spi = wilc_spi_dev;
> +               msg.spi = spi;
>                 msg.is_dma_mapped = USE_SPI_DMA;
>  /* ]] */
>                 spi_message_add_tail(&tr, &msg);
>
> -               ret = spi_sync(wilc_spi_dev, &msg);
> +               ret = spi_sync(spi, &msg);
>                 if (ret < 0) {
>                         PRINT_ER("SPI transaction failed\n");
>                 }
> @@ -234,6 +230,7 @@ int wilc_spi_write(u8 *b, u32 len)
>
>  int wilc_spi_read(u8 *rb, u32 rlen)
>  {
> +       struct spi_device *spi = to_spi_device(wilc_dev->dev);
>         int ret;
>
>         if (rlen > 0) {
> @@ -260,11 +257,11 @@ int wilc_spi_read(u8 *rb, u32 rlen)
>
>                                 memset(&msg, 0, sizeof(msg));
>                                 spi_message_init(&msg);
> -                               msg.spi = wilc_spi_dev;
> +                               msg.spi = spi;
>                                 msg.is_dma_mapped = USE_SPI_DMA;
>
>                                 spi_message_add_tail(&tr, &msg);
> -                               ret = spi_sync(wilc_spi_dev, &msg);
> +                               ret = spi_sync(spi, &msg);
>                                 if (ret < 0) {
>                                         PRINT_ER("SPI transaction failed\n");
>                                 }
> @@ -284,11 +281,11 @@ int wilc_spi_read(u8 *rb, u32 rlen)
>
>                         memset(&msg, 0, sizeof(msg));
>                         spi_message_init(&msg);
> -                       msg.spi = wilc_spi_dev;
> +                       msg.spi = spi;
>                         msg.is_dma_mapped = USE_SPI_DMA;                                /* rachel */
>
>                         spi_message_add_tail(&tr, &msg);
> -                       ret = spi_sync(wilc_spi_dev, &msg);
> +                       ret = spi_sync(spi, &msg);
>                         if (ret < 0) {
>                                 PRINT_ER("SPI transaction failed\n");
>                         }
> @@ -308,7 +305,7 @@ int wilc_spi_read(u8 *rb, u32 rlen)
>  #else
>  int wilc_spi_read(u8 *rb, u32 rlen)
>  {
> -
> +       struct spi_device *spi = to_spi_device(wilc_dev->dev);
>         int ret;
>
>         if (rlen > 0) {
> @@ -329,12 +326,12 @@ int wilc_spi_read(u8 *rb, u32 rlen)
>                 memset(&msg, 0, sizeof(msg));
>                 spi_message_init(&msg);
>  /* [[ johnny add */
> -               msg.spi = wilc_spi_dev;
> +               msg.spi = spi;
>                 msg.is_dma_mapped = USE_SPI_DMA;
>  /* ]] */
>                 spi_message_add_tail(&tr, &msg);
>
> -               ret = spi_sync(wilc_spi_dev, &msg);
> +               ret = spi_sync(spi, &msg);
>                 if (ret < 0) {
>                         PRINT_ER("SPI transaction failed\n");
>                 }
> @@ -353,7 +350,7 @@ int wilc_spi_read(u8 *rb, u32 rlen)
>
>  int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
>  {
> -
> +       struct spi_device *spi = to_spi_device(wilc_dev->dev);
>         int ret;
>
>         if (rlen > 0) {
> @@ -370,11 +367,11 @@ int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
>
>                 memset(&msg, 0, sizeof(msg));
>                 spi_message_init(&msg);
> -               msg.spi = wilc_spi_dev;
> +               msg.spi = spi;
>                 msg.is_dma_mapped = USE_SPI_DMA;
>
>                 spi_message_add_tail(&tr, &msg);
> -               ret = spi_sync(wilc_spi_dev, &msg);
> +               ret = spi_sync(spi, &msg);
>                 if (ret < 0) {
>                         PRINT_ER("SPI transaction failed\n");
>                 }
> @@ -395,40 +392,3 @@ int wilc_spi_set_max_speed(void)
>         PRINT_INFO(BUS_DBG, "@@@@@@@@@@@@ change SPI speed to %d @@@@@@@@@\n", SPEED);
>         return 1;
>  }
> -
> -static struct wilc *wilc;
> -
> -static int __init init_wilc_spi_driver(void)
> -{
> -       int ret;
> -
> -       wilc_debugfs_init();
> -
> -       ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_hif_spi);
> -       if (ret) {
> -               wilc_debugfs_remove();
> -               return ret;
> -       }
> -
> -       if (!wilc_spi_init() || !wilc_spi_dev) {
> -               PRINT_ER("Can't initialize SPI\n");
> -               wilc_netdev_cleanup(wilc);
> -               wilc_debugfs_remove();
> -               return -ENXIO;
> -       }
> -       wilc_dev->dev = &wilc_spi_dev->dev;
> -
> -       return ret;
> -}
> -late_initcall(init_wilc_spi_driver);
> -
> -static void __exit exit_wilc_spi_driver(void)
> -{
> -       if (wilc)
> -               wilc_netdev_cleanup(wilc);
> -       spi_unregister_driver(&wilc_bus);
> -       wilc_debugfs_remove();
> -}
> -module_exit(exit_wilc_spi_driver);
> -
> -MODULE_LICENSE("GPL");
> diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c
> index 158a1df17195..27c653a0cdf9 100644
> --- a/drivers/staging/wilc1000/wilc_debugfs.c
> +++ b/drivers/staging/wilc1000/wilc_debugfs.c
> @@ -138,7 +138,7 @@ static struct wilc_debugfs_info_t debugfs_info[] = {
>         { "wilc_debug_region",  0666,   (INIT_DBG | GENERIC_DBG | CFG80211_DBG), FOPS(NULL, wilc_debug_region_read, wilc_debug_region_write, NULL), },
>  };
>
> -int wilc_debugfs_init(void)
> +static int __init wilc_debugfs_init(void)
>  {
>         int i;
>
> @@ -173,11 +173,13 @@ int wilc_debugfs_init(void)
>         }
>         return 0;
>  }
> +module_init(wilc_debugfs_init);
>
> -void wilc_debugfs_remove(void)
> +static void __exit wilc_debugfs_remove(void)
>  {
>         debugfs_remove_recursive(wilc_dir);
>  }
> +module_exit(wilc_debugfs_remove);
>
>  #endif
>
> --
> 2.1.0.rc2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1267043 — Re: [PATCH 19/20] staging/wilc1000: use more regular probing

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-11 10:00 +0100
SubjectRe: [PATCH 19/20] staging/wilc1000: use more regular probing
Message-ID<qtzq1-t6-3@gated-at.bofh.it>
In reply to#1267019
On Wednesday 11 November 2015 09:54:57 Andy Shevchenko wrote:
> > 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)
> 
> if this is still in use?
> Is it about DEBUG or DEBUGFS?

It's DEBUGFS, and it's currently set unconditionally by the Makefile.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | linux.kernel


csiph-web