Skip to contentSkip to conversation

staging/wilc1000 cleanups

PATCH In review Arnd Bergmann 4 participants 29 messages Oct 20, 2015 – Nov 2, 2015 Staging

lore
Share & tools
lore
#0 lore raw

cover staging/wilc1000 cleanups

After I screwed up two or three times trying to get the dependencies with the SPI and SDIO backends right, I ended up taking the time to do the real fix and make both coexist.

This is a series of patches that address various issues with the driver, but is mainly targetted at splitting out the spi and sdio backends into separate drivers that can be built independent of one another.

The last patch is more experimental than the others, hence the [RFC] annotation.

Please review and test.

Arnd

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

 drivers/staging/wilc1000/Kconfig                  |  66 +-
 drivers/staging/wilc1000/Makefile                 |  16 +-
 drivers/staging/wilc1000/coreconfigurator.c       |  12 +-
 drivers/staging/wilc1000/coreconfigurator.h       |  12 +-
 drivers/staging/wilc1000/host_interface.c         | 501 +++-------------
 drivers/staging/wilc1000/host_interface.h         | 349 ++---------
 drivers/staging/wilc1000/linux_mon.c              |  11 +-
 drivers/staging/wilc1000/linux_wlan.c             | 695 +++++++---------------
 drivers/staging/wilc1000/linux_wlan_common.h      |  18 +-
 drivers/staging/wilc1000/linux_wlan_sdio.c        | 202 +++++--
 drivers/staging/wilc1000/linux_wlan_sdio.h        |  14 -
 drivers/staging/wilc1000/linux_wlan_spi.c         | 119 ++--
 drivers/staging/wilc1000/linux_wlan_spi.h         |   8 -
 drivers/staging/wilc1000/wilc_debugfs.c           |  20 +-
 drivers/staging/wilc1000/wilc_sdio.c              | 213 +++----
 drivers/staging/wilc1000/wilc_spi.c               | 276 +--------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 495 +++++++--------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  87 +--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |  21 +-
 drivers/staging/wilc1000/wilc_wlan.c              | 180 +++---
 drivers/staging/wilc1000/wilc_wlan.h              |  49 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c          |   6 +-
 drivers/staging/wilc1000/wilc_wlan_if.h           |  23 +-
 23 files changed, 1171 insertions(+), 2222 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.h
Signature · 1 line
2.1.0.rc2
#1 lore raw

PATCH 1/19 staging/wilc1000: remove unused functions

A number of symbols in the wilc1000 driver are completely unused and can be removed.
This includes two variables that are only written but not read.

---
 drivers/staging/wilc1000/host_interface.c         | 311 ----------------------
 drivers/staging/wilc1000/host_interface.h         | 208 +--------------
 drivers/staging/wilc1000/wilc_sdio.c              |  56 ----
 drivers/staging/wilc1000/wilc_spi.c               | 225 ----------------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  35 ---
 drivers/staging/wilc1000/wilc_wlan.c              |   4 -
 6 files changed, 1 insertion(+), 838 deletions(-)
drivers/staging/wilc1000/host_interface.c +0 -311
index 38fead44cce0..194ca3d3e920 100644
@@ -3421,36 +3421,6 @@ s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_at
 	return s32Error;
 }
 
-s32 host_int_get_pmkid_info(struct host_if_drv *hif_drv,
-			    u8 *pu8PmkidInfoArray,
-			    u32 u32PmkidInfoLen)
-{
-	struct wid strWID;
-
-	strWID.id = (u16)WID_PMKID_INFO;
-	strWID.type = WID_STR;
-	strWID.size = u32PmkidInfoLen;
-	strWID.val = pu8PmkidInfoArray;
-
-	return 0;
-}
-
-s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv,
-					 u8 *pu8PassPhrase,
-					 u8 u8Psklength)
-{
-	struct wid strWID;
-
-	if ((u8Psklength > 7) && (u8Psklength < 65)) {
-		strWID.id = (u16)WID_11I_PSK;
-		strWID.type = WID_STR;
-		strWID.val = pu8PassPhrase;
-		strWID.size = u8Psklength;
-	}
-
-	return 0;
-}
-
 s32 host_int_get_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
 {
 	s32 s32Error = 0;
@@ -3492,19 +3462,6 @@ s32 host_int_set_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
 
 }
 
-s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv,
-					 u8 *pu8PassPhrase, u8 u8Psklength)
-{
-	struct wid strWID;
-
-	strWID.id = (u16)WID_11I_PSK;
-	strWID.type = WID_STR;
-	strWID.size = u8Psklength;
-	strWID.val = pu8PassPhrase;
-
-	return 0;
-}
-
 s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource)
 {
 	struct wid strWID;
@@ -3517,18 +3474,6 @@ s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource)
 	return 0;
 }
 
-s32 host_int_get_start_scan_req(struct host_if_drv *hif_drv, u8 *pu8ScanSource)
-{
-	struct wid strWID;
-
-	strWID.id = (u16)WID_START_SCAN_REQ;
-	strWID.type = WID_CHAR;
-	strWID.val = (s8 *)pu8ScanSource;
-	strWID.size = sizeof(char);
-
-	return 0;
-}
-
 s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid,
 			  const u8 *pu8ssid, size_t ssidLen,
 			  const u8 *pu8IEs, size_t IEsLen,
@@ -3649,31 +3594,6 @@ s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode)
 	return s32Error;
 }
 
-s32 host_int_disconnect_station(struct host_if_drv *hif_drv, u8 assoc_id)
-{
-	struct wid strWID;
-
-	strWID.id = (u16)WID_DISCONNECT;
-	strWID.type = WID_CHAR;
-	strWID.val = (s8 *)&assoc_id;
-	strWID.size = sizeof(char);
-
-	return 0;
-}
-
-s32 host_int_get_assoc_req_info(struct host_if_drv *hif_drv, u8 *pu8AssocReqInfo,
-					u32 u32AssocReqInfoLen)
-{
-	struct wid strWID;
-
-	strWID.id = (u16)WID_ASSOC_REQ_INFO;
-	strWID.type = WID_STR;
-	strWID.val = pu8AssocReqInfo;
-	strWID.size = u32AssocReqInfoLen;
-
-	return 0;
-}
-
 s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8AssocRespInfo,
 					u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen)
 {
@@ -3703,19 +3623,6 @@ s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8AssocRespInf
 	return s32Error;
 }
 
-s32 host_int_get_rx_power_level(struct host_if_drv *hif_drv, u8 *pu8RxPowerLevel,
-					u32 u32RxPowerLevelLen)
-{
-	struct wid strWID;
-
-	strWID.id = (u16)WID_RX_POWER_LEVEL;
-	strWID.type = WID_STR;
-	strWID.val = pu8RxPowerLevel;
-	strWID.size = u32RxPowerLevelLen;
-
-	return 0;
-}
-
 int host_int_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel)
 {
 	int result;
@@ -3796,33 +3703,6 @@ int host_int_set_operation_mode(struct host_if_drv *hif_drv, u32 mode)
 	return result;
 }
 
-s32 host_int_get_host_chnl_num(struct host_if_drv *hif_drv, u8 *pu8ChNo)
-{
-	s32 s32Error = 0;
-	struct host_if_msg msg;
-
-	if (!hif_drv) {
-		PRINT_ER("driver is null\n");
-		return -EFAULT;
-	}
-
-	memset(&msg, 0, sizeof(struct host_if_msg));
-
-	msg.id = HOST_IF_MSG_GET_CHNL;
-	msg.drv = hif_drv;
-
-	s32Error = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
-	if (s32Error)
-		PRINT_ER("wilc mq send fail\n");
-	down(&hif_drv->hSemGetCHNL);
-
-	*pu8ChNo = ch_no;
-
-	return s32Error;
-
-
-}
-
 s32 host_int_get_inactive_time(struct host_if_drv *hif_drv,
 			       const u8 *mac, u32 *pu32InactiveTime)
 {
@@ -3854,36 +3734,6 @@ s32 host_int_get_inactive_time(struct host_if_drv *hif_drv,
 	return s32Error;
 }
 
-s32 host_int_test_get_int_wid(struct host_if_drv *hif_drv, u32 *pu32TestMemAddr)
-{
-
-	s32 s32Error = 0;
-	struct wid strWID;
-
-	if (!hif_drv) {
-		PRINT_ER("driver is null\n");
-		return -EFAULT;
-	}
-
-	strWID.id = (u16)WID_MEMORY_ADDRESS;
-	strWID.type = WID_INT;
-	strWID.val = (s8 *)pu32TestMemAddr;
-	strWID.size = sizeof(u32);
-
-	s32Error = send_config_pkt(GET_CFG, &strWID, 1,
-				   get_id_from_handler(hif_drv));
-
-	if (s32Error) {
-		PRINT_ER("Failed to get wid value\n");
-		return -EINVAL;
-	} else {
-		PRINT_D(HOSTINF_DBG, "Successfully got wid value\n");
-
-	}
-
-	return s32Error;
-}
-
 s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi)
 {
 	s32 s32Error = 0;
@@ -3912,34 +3762,6 @@ s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi)
 	return s32Error;
 }
 
-s32 host_int_get_link_speed(struct host_if_drv *hif_drv, s8 *ps8lnkspd)
-{
-	struct host_if_msg msg;
-	s32 s32Error = 0;
-	memset(&msg, 0, sizeof(struct host_if_msg));
-
-	msg.id = HOST_IF_MSG_GET_LINKSPEED;
-	msg.drv = hif_drv;
-
-	s32Error = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
-	if (s32Error) {
-		PRINT_ER("Failed to send GET_LINKSPEED to message queue ");
-		return -EFAULT;
-	}
-
-	down(&hif_drv->hSemGetLINKSPEED);
-
-
-	if (ps8lnkspd == NULL) {
-		PRINT_ER("LINKSPEED pointer value is null");
-		return -EFAULT;
-	}
-
-	*ps8lnkspd = link_speed;
-
-	return s32Error;
-}
-
 s32 host_int_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
 {
 	s32 s32Error = 0;
@@ -4038,106 +3860,6 @@ s32 hif_set_cfg(struct host_if_drv *hif_drv,
 
 }
 
-s32 hif_get_cfg(struct host_if_drv *hif_drv, u16 u16WID, u16 *pu16WID_Value)
-{
-	s32 s32Error = 0;
-
-	down(&hif_drv->gtOsCfgValuesSem);
-
-	if (!hif_drv) {
-		PRINT_ER("hif_drv NULL\n");
-		return -EFAULT;
-	}
-	PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n");
-	switch (u16WID)	{
-
-	case WID_BSS_TYPE:
-		*pu16WID_Value = (u16)hif_drv->strCfgValues.bss_type;
-		break;
-
-	case WID_AUTH_TYPE:
-		*pu16WID_Value = (u16)hif_drv->strCfgValues.auth_type;
-		break;
-
-	case WID_AUTH_TIMEOUT:
-		*pu16WID_Value = hif_drv->strCfgValues.auth_timeout;
-		break;
-
-	case WID_POWER_MANAGEMENT:
-		*pu16WID_Value = (u16)hif_drv->strCfgValues.power_mgmt_mode;
-		break;
-
-	case WID_SHORT_RETRY_LIMIT:
-		*pu16WID_Value =       hif_drv->strCfgValues.short_retry_limit;
-		break;
-
-	case WID_LONG_RETRY_LIMIT:
-		*pu16WID_Value = hif_drv->strCfgValues.long_retry_limit;
-		break;
-
-	case WID_FRAG_THRESHOLD:
-		*pu16WID_Value = hif_drv->strCfgValues.frag_threshold;
-		break;
-
-	case WID_RTS_THRESHOLD:
-		*pu16WID_Value = hif_drv->strCfgValues.rts_threshold;
-		break;
-
-	case WID_PREAMBLE:
-		*pu16WID_Value = (u16)hif_drv->strCfgValues.preamble_type;
-		break;
-
-	case WID_SHORT_SLOT_ALLOWED:
-		*pu16WID_Value = (u16) hif_drv->strCfgValues.short_slot_allowed;
-		break;
-
-	case WID_11N_TXOP_PROT_DISABLE:
-		*pu16WID_Value = (u16)hif_drv->strCfgValues.txop_prot_disabled;
-		break;
-
-	case WID_BEACON_INTERVAL:
-		*pu16WID_Value = hif_drv->strCfgValues.beacon_interval;
-		break;
-
-	case WID_DTIM_PERIOD:
-		*pu16WID_Value = (u16)hif_drv->strCfgValues.dtim_period;
-		break;
-
-	case WID_SITE_SURVEY:
-		*pu16WID_Value = (u16)hif_drv->strCfgValues.site_survey_enabled;
-		break;
-
-	case WID_SITE_SURVEY_SCAN_TIME:
-		*pu16WID_Value = hif_drv->strCfgValues.site_survey_scan_time;
-		break;
-
-	case WID_ACTIVE_SCAN_TIME:
-		*pu16WID_Value = hif_drv->strCfgValues.active_scan_time;
-		break;
-
-	case WID_PASSIVE_SCAN_TIME:
-		*pu16WID_Value = hif_drv->strCfgValues.passive_scan_time;
-		break;
-
-	case WID_CURRENT_TX_RATE:
-		*pu16WID_Value = hif_drv->strCfgValues.curr_tx_rate;
-		break;
-
-	default:
-		break;
-	}
-
-	up(&hif_drv->gtOsCfgValuesSem);
-
-	return s32Error;
-
-}
-
-void host_int_send_join_leave_info_to_host
-	(u16 assocId, u8 *stationAddr, bool joining)
-{
-}
-
 static void GetPeriodicRSSI(unsigned long arg)
 {
 	struct host_if_drv *hif_drv = (struct host_if_drv *)arg;
@@ -4167,11 +3889,6 @@ static void GetPeriodicRSSI(unsigned long arg)
 }
 
 
-void host_int_send_network_info_to_host
-	(u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi)
-{
-}
-
 static u32 clients_count;
 
 s32 host_int_init(struct host_if_drv **hif_drv_handler)
@@ -5018,34 +4735,6 @@ void host_int_freeJoinParams(void *pJoinParams)
 		PRINT_ER("Unable to FREE null pointer\n");
 }
 
-s32 host_int_delBASession(struct host_if_drv *hif_drv, char *pBSSID, char TID)
-{
-	s32 s32Error = 0;
-	struct host_if_msg msg;
-	struct ba_session_info *pBASessionInfo = &msg.body.session_info;
-
-	if (!hif_drv) {
-		PRINT_ER("driver is null\n");
-		return -EFAULT;
-	}
-
-	memset(&msg, 0, sizeof(struct host_if_msg));
-
-	msg.id = HOST_IF_MSG_DEL_BA_SESSION;
-
-	memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN);
-	pBASessionInfo->u8Ted = TID;
-	msg.drv = hif_drv;
-
-	s32Error = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
-	if (s32Error)
-		PRINT_ER("wilc_mq_send fail\n");
-
-	down(&hif_sema_wait_response);
-
-	return s32Error;
-}
-
 s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv,
 				  char *pBSSID,
 				  char TID)
drivers/staging/wilc1000/host_interface.h +1 -207

259 lines not on this page · raw message

drivers/staging/wilc1000/wilc_sdio.c +0 -56

67 lines not on this page · raw message

drivers/staging/wilc1000/wilc_spi.c +0 -225

237 lines not on this page · raw message

drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +0 -35
index bcbf1bd29a50..18e40e515a48 100644
@@ -473,41 +473,6 @@ static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo *pstrNet
 }
 
 
-/**
- *  @brief      WILC_WFI_Set_PMKSA
- *  @details  Check if pmksa is cached and set it.
- *  @param[in]
- *  @return     int : Return 0 on Success
- *  @author	mdaftedar
- *  @date	01 MAR 2012
- *  @version	1.0
- */
-int WILC_WFI_Set_PMKSA(u8 *bssid, struct wilc_priv *priv)
-{
-	u32 i;
-	s32 s32Error = 0;
-
-
-	for (i = 0; i < priv->pmkid_list.numpmkid; i++)	{
-
-		if (!memcmp(bssid, priv->pmkid_list.pmkidlist[i].bssid,
-				 ETH_ALEN)) {
-			PRINT_D(CFG80211_DBG, "PMKID successful comparison");
-
-			/*If bssid is found, set the values*/
-			s32Error = host_int_set_pmkid_info(priv->hWILCWFIDrv, &priv->pmkid_list);
-
-			if (s32Error != 0)
-				PRINT_ER("Error in pmkid\n");
-
-			break;
-		}
-	}
-
-	return s32Error;
-
-
-}
 int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID);
 
 
drivers/staging/wilc1000/wilc_wlan.c +0 -4
index c73164165323..c8564249092c 100644
@@ -254,8 +254,6 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe)
 
 }
 
-u32 Statisitcs_totalAcks = 0, Statisitcs_DroppedAcks = 0;
-
 #ifdef	TCP_ACK_FILTER
 struct Ack_session_info;
 struct Ack_session_info {
@@ -319,7 +317,6 @@ static inline int Update_TCP_track_session(u32 index, u32 Ack)
 }
 static inline int add_TCP_Pending_Ack(u32 Ack, u32 Session_index, struct txq_entry_t  *txqe)
 {
-	Statisitcs_totalAcks++;
 	if (Pending_Acks < MAX_PENDING_ACKS) {
 		Pending_Acks_info[PendingAcks_arrBase + Pending_Acks].ack_num = Ack;
 		Pending_Acks_info[PendingAcks_arrBase + Pending_Acks].txqe = txqe;
@@ -422,7 +419,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)
 			tqe = Pending_Acks_info[i].txqe;
 			if (tqe) {
 				wilc_wlan_txq_remove(tqe);
-				Statisitcs_DroppedAcks++;
 				tqe->status = 1;                                /* mark the packet send */
 				if (tqe->tx_complete_func)
 					tqe->tx_complete_func(tqe->priv, tqe->status);
Signature · 1 line
2.1.0.rc2
maintainer
#2 lore raw

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

Quoted 5 lines · Arnd Bergmann

A number of symbols in the wilc1000 driver are completely unused and can be removed.
This includes two variables that are only written but not read.

Due to other patches that were sent before yours for this driver, this patch doesn't apply :(

Watch out, I'm getting about 50 patches a week for this driver, it's under _heavy_ development, you will get merge issues...

Can you rebase the series on my staging-testing branch and resend?

thanks,

greg k-h

#3 lore raw

PATCH 2/19 staging/wilc1000: make symbols static if possible

In reply to Arnd Bergmann

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

---
 drivers/staging/wilc1000/Makefile                 |  3 +-
 drivers/staging/wilc1000/coreconfigurator.c       |  6 +--
 drivers/staging/wilc1000/host_interface.c         | 28 +++++++----
 drivers/staging/wilc1000/host_interface.h         | 29 ------------
 drivers/staging/wilc1000/linux_mon.c              |  6 +--
 drivers/staging/wilc1000/linux_wlan.c             | 25 +++++-----
 drivers/staging/wilc1000/linux_wlan_sdio.c        |  4 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 58 +++++++++++------------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  1 -
 drivers/staging/wilc1000/wilc_wlan.c              | 26 ++++++----
 10 files changed, 85 insertions(+), 101 deletions(-)
drivers/staging/wilc1000/Makefile +1 -2
index 64c2f1b83dfb..55b2ac2b15a8 100644
@@ -8,8 +8,7 @@ ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
 		-DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \
 		-DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\"
 
-ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 \
-		-Wno-unused-function -DWILC_DEBUGFS
+ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 -DWILC_DEBUGFS
 #ccflags-y += -DTCP_ACK_FILTER
 
 ccflags-$(CONFIG_WILC1000_PREALLOCATE_AT_LOADING_DRIVER) += -DMEMORY_STATIC \
drivers/staging/wilc1000/coreconfigurator.c +3 -3
index 427adfd295da..28ab89b3a65d 100644
@@ -287,7 +287,7 @@ static inline u16 get_asoc_id(u8 *data)
 	return asoc_id;
 }
 
-u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
+static u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
 {
 	u16 u16index;
 
@@ -315,7 +315,7 @@ u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
 
 /* This function gets the current channel information from
  * the 802.11n beacon/probe response frame */
-u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
+static u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
 {
 	u16 index;
 
@@ -333,7 +333,7 @@ u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
 	return 0;  /* no MIB here */
 }
 
-u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
+static u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
 {
 	/* Extract current channel information from */
 	/* the beacon/probe response frame          */
drivers/staging/wilc1000/host_interface.c +19 -9
index 194ca3d3e920..4e9dfb493b9f 100644
@@ -232,7 +232,7 @@ struct join_bss_param {
 static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1];
 struct host_if_drv *terminated_handle;
 bool g_obtainingIP;
-u8 P2P_LISTEN_STATE;
+static u8 P2P_LISTEN_STATE;
 static struct task_struct *hif_thread_handler;
 static WILC_MsgQueueHandle hif_msg_q;
 static struct semaphore hif_sema_thread;
@@ -256,10 +256,10 @@ static u32 inactive_time;
 static u8 del_beacon;
 
 static u8 *join_req;
-u8 *info_element;
+static u8 *info_element;
 static u8 mode_11i;
-u8 auth_type;
-u32 join_req_size;
+static u8 auth_type;
+static u32 join_req_size;
 static u32 info_element_size;
 static struct host_if_drv *join_req_drv;
 #define REAL_JOIN_REQ 0
@@ -398,7 +398,9 @@ static s32 Handle_SetOperationMode(struct host_if_drv *hif_drv,
 	return s32Error;
 }
 
-s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
+static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx);
+
+static s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
 {
 
 	s32 s32Error = 0;
@@ -433,7 +435,7 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
 	return s32Error;
 }
 
-s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
+static s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
 {
 
 	s32 s32Error = 0;
@@ -812,6 +814,9 @@ static s32 Handle_wait_msg_q_empty(void)
 	return 0;
 }
 
+static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
+			   enum scan_event enuEvent);
+
 static s32 Handle_Scan(struct host_if_drv *hif_drv,
 		       struct scan_attr *pstrHostIFscanAttr)
 {
@@ -1484,6 +1489,11 @@ done:
 	return s32Error;
 }
 
+static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
+				       u8 *pu8AssocRespInfo,
+				       u32 u32MaxAssocRespInfoLen,
+				       u32 *pu32RcvdAssocRespInfoLen);
+
 static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,
 				    struct rcvd_async_info *pstrRcvdGnrlAsyncInfo)
 {
@@ -2178,7 +2188,7 @@ static void Handle_GetLinkspeed(struct host_if_drv *hif_drv)
 
 }
 
-s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
+static s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
 {
 	struct wid strWIDList[5];
 	u32 u32WidsCount = 0, s32Error = 0;
@@ -3594,7 +3604,7 @@ s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode)
 	return s32Error;
 }
 
-s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8AssocRespInfo,
+static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8AssocRespInfo,
 					u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen)
 {
 	s32 s32Error = 0;
@@ -4794,7 +4804,7 @@ s32 host_int_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
 
 }
 
-s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
+static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
 {
 	s32 s32Error = 0;
 	struct host_if_msg msg;
drivers/staging/wilc1000/host_interface.h +0 -29
index 3df74f1bf9ff..1661eeb0a2e7 100644
@@ -622,21 +622,6 @@ s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv);
 s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode);
 
 /**
- *  @brief              gets a Association Response info
- *  @details
- *  @param[in,out] handle to the wifi driver,
- *                              Message containg assoc. resp info
- *  @return             Error code indicating success/failure
- *  @note
- *  @author		zsalah
- *  @date		8 March 2012
- *  @version		1.0
- */
-
-s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocRespInfo,
-					u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen);
-
-/**
  *  @brief              sets a channel
  *  @details
  *  @param[in,out] handle to the wifi driver,
@@ -887,18 +872,6 @@ s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx)
  */
 s32 host_int_del_All_Rx_BASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID);
 
-
-/**
- *  @brief           host_int_get_ipaddress
- *  @details       get IP address on firmware
- *  @param[in]
- *  @return         Error code.
- *  @author		Abdelrahman Sobhy
- *  @date
- *  @version	1.0
- */
-s32 host_int_get_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
-
 /**
  *  @brief           host_int_remain_on_channel
  *  @details
@@ -948,8 +921,6 @@ s32 host_int_frame_register(struct host_if_drv *hWFIDrv, u16 u16FrameType, bool
 int host_int_set_wfi_drv_handler(struct host_if_drv *address);
 int host_int_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode);
 
-static s32 Handle_ScanDone(struct host_if_drv *drvHandler, enum scan_event enuEvent);
-
 void host_int_freeJoinParams(void *pJoinParams);
 
 s32 host_int_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info *pstrStatistics);
drivers/staging/wilc1000/linux_mon.c +3 -3
index 450af1b77f99..d93594474a2d 100644
@@ -29,9 +29,9 @@ static struct net_device *wilc_wfi_mon; /* global monitor netdev */
 extern int  mac_xmit(struct sk_buff *skb, struct net_device *dev);
 
 
-u8 srcAdd[6];
-u8 bssid[6];
-u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+static u8 srcAdd[6];
+static u8 bssid[6];
+static u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 /**
  *  @brief      WILC_WFI_monitor_rx
  *  @details
drivers/staging/wilc1000/linux_wlan.c +12 -13
index b879b8be0f3f..1b496e84100e 100644
@@ -239,9 +239,8 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
 	}
 	return IRQ_WAKE_THREAD;
 }
-#endif
 
-irqreturn_t isr_bh_routine(int irq, void *userdata)
+static irqreturn_t isr_bh_routine(int irq, void *userdata)
 {
 	struct wilc *nic;
 
@@ -259,7 +258,6 @@ irqreturn_t isr_bh_routine(int irq, void *userdata)
 	return IRQ_HANDLED;
 }
 
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
 static int init_irq(struct wilc *p_nic)
 {
 	int ret = 0;
@@ -358,7 +356,7 @@ void linux_wlan_mac_indicate(int flag)
 
 }
 
-struct net_device *GetIfHandler(u8 *pMacHeader)
+static struct net_device *GetIfHandler(u8 *pMacHeader)
 {
 	u8 *Bssid, *Bssid1;
 	int i = 0;
@@ -551,7 +549,7 @@ _fail_:
 }
 
 #ifdef COMPLEMENT_BOOT
-int repeat_power_cycle(perInterface_wlan_t *nic);
+static int repeat_power_cycle(perInterface_wlan_t *nic);
 #endif
 
 static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
@@ -944,7 +942,7 @@ void wilc1000_wlan_deinit(struct wilc *nic)
 	}
 }
 
-int wlan_init_locks(struct wilc *p_nic)
+static int wlan_init_locks(struct wilc *p_nic)
 {
 
 	PRINT_D(INIT_DBG, "Initializing Locks ...\n");
@@ -977,7 +975,8 @@ static int wlan_deinit_locks(struct wilc *nic)
 
 	return 0;
 }
-void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
+
+static void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
 {
 
 	PRINT_D(INIT_DBG, "Linux to Wlan services ...\n");
@@ -1003,7 +1002,7 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
 #endif
 }
 
-int wlan_initialize_threads(perInterface_wlan_t *nic)
+static int wlan_initialize_threads(perInterface_wlan_t *nic)
 {
 
 	int ret = 0;
@@ -1053,7 +1052,7 @@ extern u8 core_11b_ready(void);
 
 #define READY_CHECK_THRESHOLD		30
 extern void wilc_wlan_global_reset(void);
-u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
+static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
 {
 	u8 trials = 0;
 
@@ -1086,7 +1085,7 @@ u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
 
 }
 
-int repeat_power_cycle(perInterface_wlan_t *nic)
+static int repeat_power_cycle(perInterface_wlan_t *nic)
 {
 	int ret = 0;
 	wilc_wlan_inp_t nwi;
@@ -1265,7 +1264,7 @@ _fail_locks_:
  *      - this function will be called automatically by OS when module inserted.
  */
 
-int mac_init_fn(struct net_device *ndev)
+static int mac_init_fn(struct net_device *ndev)
 {
 
 	/*Why we do this !!!*/
@@ -1351,7 +1350,7 @@ _err_:
 	return ret;
 }
 
-struct net_device_stats *mac_stats(struct net_device *dev)
+static struct net_device_stats *mac_stats(struct net_device *dev)
 {
 	perInterface_wlan_t *nic = netdev_priv(dev);
 
@@ -1554,7 +1553,7 @@ int mac_close(struct net_device *ndev)
 	return 0;
 }
 
-int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
+static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
 {
 
 	u8 *buff = NULL;
drivers/staging/wilc1000/linux_wlan_sdio.c +2 -2
index ebacd297abca..96558accf877 100644
@@ -37,14 +37,14 @@ static const struct sdio_device_id wilc_sdio_ids[] = {
 };
 
 
+#ifndef WILC_SDIO_IRQ_GPIO
 static void wilc_sdio_interrupt(struct sdio_func *func)
 {
-#ifndef WILC_SDIO_IRQ_GPIO
 	sdio_release_host(func);
 	wilc_handle_isr();
 	sdio_claim_host(func);
-#endif
 }
+#endif
 
 
 int linux_sdio_cmd52(sdio_cmd52_t *cmd)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +29 -29

143 lines not on this page · raw message

drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +0 -1
index 39cd8e1b5675..e7ea397644de 100644
@@ -90,7 +90,6 @@ static const struct ieee80211_txrx_stypes
 #define WILC_WFI_DWELL_PASSIVE 100
 #define WILC_WFI_DWELL_ACTIVE  40
 
-struct wireless_dev *WILC_WFI_CfgAlloc(void);
 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);
drivers/staging/wilc1000/wilc_wlan.c +16 -10
index c8564249092c..83fd41a4f521 100644
@@ -82,7 +82,9 @@ typedef struct {
 
 static wilc_wlan_dev_t g_wlan;
 
+#ifdef WILC_OPTIMIZE_SLEEP_INT
 static inline void chip_allow_sleep(void);
+#endif
 static inline void chip_wakeup(void);
 /********************************************
  *
@@ -138,6 +140,7 @@ static inline void release_bus(BUS_RELEASE_T release)
  *
  ********************************************/
 
+#ifdef TCP_ACK_FILTER
 static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
 {
 
@@ -160,6 +163,7 @@ static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
 	p->txq_entries -= 1;
 
 }
+#endif
 
 static struct txq_entry_t *wilc_wlan_txq_remove_from_head(void)
 {
@@ -273,19 +277,19 @@ typedef struct {
 
 
 
-struct Ack_session_info *Free_head;
-struct Ack_session_info *Alloc_head;
+static struct Ack_session_info *Free_head;
+static struct Ack_session_info *Alloc_head;
 
 #define NOT_TCP_ACK			(-1)
 
 #define MAX_TCP_SESSION		25
 #define MAX_PENDING_ACKS		256
-struct Ack_session_info Acks_keep_track_info[2 * MAX_TCP_SESSION];
-Pending_Acks_info_t Pending_Acks_info[MAX_PENDING_ACKS];
+static struct Ack_session_info Acks_keep_track_info[2 * MAX_TCP_SESSION];
+static Pending_Acks_info_t Pending_Acks_info[MAX_PENDING_ACKS];
 
-u32 PendingAcks_arrBase;
-u32 Opened_TCP_session;
-u32 Pending_Acks;
+static u32 PendingAcks_arrBase;
+static u32 Opened_TCP_session;
+static u32 Pending_Acks;
 
 
 
@@ -449,17 +453,19 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)
 }
 #endif
 
-bool EnableTCPAckFilter = false;
+static bool EnableTCPAckFilter = false;
 
 void Enable_TCP_ACK_Filter(bool value)
 {
 	EnableTCPAckFilter = value;
 }
 
-bool is_TCP_ACK_Filter_Enabled(void)
+#ifdef TCP_ACK_FILTER
+static bool is_TCP_ACK_Filter_Enabled(void)
 {
 	return EnableTCPAckFilter;
 }
+#endif
 
 static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size)
 {
@@ -1834,7 +1840,7 @@ void wilc_bus_set_default_speed(void)
 	/* Restore bus speed to default.  */
 	g_wlan.hif_func.hif_set_default_bus_speed();
 }
-u32 init_chip(void)
+static u32 init_chip(void)
 {
 	u32 chipid;
 	u32 reg, ret = 0;
Signature · 1 line
2.1.0.rc2
#4 lore raw

PATCH 3/19 staging/wilc1000: use proper naming for global symbols

In reply to Arnd Bergmann

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

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

---
 drivers/staging/wilc1000/coreconfigurator.c       |   6 +-
 drivers/staging/wilc1000/coreconfigurator.h       |  12 +-
 drivers/staging/wilc1000/host_interface.c         | 162 ++++-----
 drivers/staging/wilc1000/host_interface.h         | 104 +++---
 drivers/staging/wilc1000/linux_mon.c              |   4 +-
 drivers/staging/wilc1000/linux_wlan.c             | 406 +++++++++++-----------
 drivers/staging/wilc1000/linux_wlan_common.h      |  18 +-
 drivers/staging/wilc1000/linux_wlan_sdio.c        |  62 ++--
 drivers/staging/wilc1000/linux_wlan_sdio.h        |  18 +-
 drivers/staging/wilc1000/linux_wlan_spi.c         |  18 +-
 drivers/staging/wilc1000/linux_wlan_spi.h         |  12 +-
 drivers/staging/wilc1000/wilc_debugfs.c           |  18 +-
 drivers/staging/wilc1000/wilc_sdio.c              |   2 +-
 drivers/staging/wilc1000/wilc_spi.c               |   2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 312 ++++++++---------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |   2 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |   2 +-
 drivers/staging/wilc1000/wilc_wlan.c              |  94 ++---
 drivers/staging/wilc1000/wilc_wlan_cfg.c          |   6 +-
 19 files changed, 630 insertions(+), 630 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +3 -3
index 28ab89b3a65d..905fd3e03bfa 100644
@@ -469,7 +469,7 @@ s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
  *  @date		1 Mar 2012
  *  @version		1.0
  */
-s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
+s32 wilc1000_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
 {
 	s32 s32Error = 0;
 
@@ -502,7 +502,7 @@ s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
  *  @date			2 Apr 2012
  *  @version		1.0
  */
-s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
+s32 wilc1000_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
 			       tstrConnectRespInfo **ppstrConnectRespInfo)
 {
 	s32 s32Error = 0;
@@ -554,7 +554,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
  *  @date			2 Apr 2012
  *  @version		1.0
  */
-s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo)
+s32 wilc1000_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo)
 {
 	s32 s32Error = 0;
 
drivers/staging/wilc1000/coreconfigurator.h +6 -6
index 6294d929a800..46476f9872a0 100644
@@ -129,14 +129,14 @@ typedef struct {
 
 s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv);
 s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
-s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo);
+s32 wilc1000_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
 
-s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
+s32 wilc1000_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
 		       tstrConnectRespInfo **ppstrConnectRespInfo);
-s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo);
+s32 wilc1000_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo);
 
-void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length);
-void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length);
-void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length);
+void wilc1000_network_info_received(u8 *pu8Buffer, u32 u32Length);
+void wilc1000_egnrl_async_info_received(u8 *pu8Buffer, u32 u32Length);
+void wilc1000_scan_complete_received(u8 *pu8Buffer, u32 u32Length);
 
 #endif
drivers/staging/wilc1000/host_interface.c +81 -81

588 lines not on this page · raw message

drivers/staging/wilc1000/host_interface.h +52 -52

348 lines not on this page · raw message

drivers/staging/wilc1000/linux_mon.c +2 -2
index d93594474a2d..52443f039a43 100644
@@ -26,7 +26,7 @@ struct wilc_wfi_radiotap_cb_hdr {
 
 static struct net_device *wilc_wfi_mon; /* global monitor netdev */
 
-extern int  mac_xmit(struct sk_buff *skb, struct net_device *dev);
+extern int  wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
 
 
 static u8 srcAdd[6];
@@ -298,7 +298,7 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb,
 		mon_mgmt_tx(mon_priv->real_ndev, skb->data, skb->len);
 		dev_kfree_skb(skb);
 	} else
-		ret = mac_xmit(skb, mon_priv->real_ndev);
+		ret = wilc1000_mac_xmit(skb, mon_priv->real_ndev);
 
 	return ret;
 }
drivers/staging/wilc1000/linux_wlan.c +203 -203

969 lines not on this page · raw message

drivers/staging/wilc1000/linux_wlan_common.h +9 -9
index 2b76e41ebd4d..7bd626196e10 100644
@@ -41,8 +41,8 @@ enum debug_region {
 int wilc_debugfs_init(void);
 void wilc_debugfs_remove(void);
 
-extern atomic_t REGION;
-extern atomic_t DEBUG_LEVEL;
+extern atomic_t WILC1000_REGION;
+extern atomic_t WILC1000_DEBUG_LEVEL;
 
 #define DEBUG           BIT(0)
 #define INFO            BIT(1)
@@ -51,8 +51,8 @@ extern atomic_t DEBUG_LEVEL;
 
 #define PRINT_D(region, ...)						\
 	do {								\
-		if ((atomic_read(&DEBUG_LEVEL) & DEBUG) &&		\
-		   ((atomic_read(&REGION)) & (region))) {		\
+		if ((atomic_read(&WILC1000_DEBUG_LEVEL) & DEBUG) &&	\
+		   ((atomic_read(&WILC1000_REGION)) & (region))) {	\
 			printk("DBG [%s: %d]", __func__, __LINE__);	\
 			printk(__VA_ARGS__);				\
 		}							\
@@ -60,8 +60,8 @@ extern atomic_t DEBUG_LEVEL;
 
 #define PRINT_INFO(region, ...)						\
 	do {								\
-		if ((atomic_read(&DEBUG_LEVEL) & INFO) &&		\
-		   ((atomic_read(&REGION)) & (region))) {		\
+		if ((atomic_read(&WILC1000_DEBUG_LEVEL) & INFO) &&	\
+		   ((atomic_read(&WILC1000_REGION)) & (region))) {	\
 			printk("INFO [%s]", __func__);			\
 			printk(__VA_ARGS__);				\
 		}							\
@@ -69,8 +69,8 @@ extern atomic_t DEBUG_LEVEL;
 
 #define PRINT_WRN(region, ...)						\
 	do {								\
-		if ((atomic_read(&DEBUG_LEVEL) & WRN) &&		\
-		   ((atomic_read(&REGION)) & (region))) {		\
+		if ((atomic_read(&WILC1000_DEBUG_LEVEL) & WRN) &&	\
+		   ((atomic_read(&WILC1000_REGION)) & (region))) {	\
 			printk("WRN [%s: %d]", __func__, __LINE__);	\
 			printk(__VA_ARGS__);				\
 		}							\
@@ -78,7 +78,7 @@ extern atomic_t DEBUG_LEVEL;
 
 #define PRINT_ER(...)							\
 	do {								\
-		if ((atomic_read(&DEBUG_LEVEL) & ERR)) {		\
+		if ((atomic_read(&WILC1000_DEBUG_LEVEL) & ERR)) {	\
 			printk("ERR [%s: %d]", __func__, __LINE__);	\
 			printk(__VA_ARGS__);				\
 		}							\
drivers/staging/wilc1000/linux_wlan_sdio.c +31 -31

155 lines not on this page · raw message

drivers/staging/wilc1000/linux_wlan_sdio.h +9 -9
index 4b515f5108e7..ff0a37b880c2 100644
@@ -1,14 +1,14 @@
-extern struct sdio_func *local_sdio_func;
+extern struct sdio_func *wilc1000_sdio_func;
 extern struct sdio_driver wilc_bus;
 
 #include <linux/mmc/sdio_func.h>
 
-int linux_sdio_init(void *);
-void linux_sdio_deinit(void *);
-int linux_sdio_cmd52(sdio_cmd52_t *cmd);
-int linux_sdio_cmd53(sdio_cmd53_t *cmd);
-int enable_sdio_interrupt(void);
-void disable_sdio_interrupt(void);
-int linux_sdio_set_max_speed(void);
-int linux_sdio_set_default_speed(void);
+int wilc1000_sdio_init(void *);
+void wilc1000_sdio_deinit(void *);
+int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd);
+int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd);
+int wilc1000_sdio_enable_interrupt(void);
+void wilc1000_sdio_disable_interrupt(void);
+int wilc1000_sdio_set_max_speed(void);
+int wilc1000_sdio_set_default_speed(void);
 
drivers/staging/wilc1000/linux_wlan_spi.c +9 -9
index 039d06192d6b..8d8310681658 100644
@@ -42,7 +42,7 @@
 static u32 SPEED = MIN_SPEED;
 
 struct spi_device *wilc_spi_dev;
-void linux_spi_deinit(void *vp);
+void wilc1000_spi_deinit(void *vp);
 
 static int __init wilc_bus_probe(struct spi_device *spi)
 {
@@ -81,7 +81,7 @@ struct spi_driver wilc_bus __refdata = {
 };
 
 
-void linux_spi_deinit(void *vp)
+void wilc1000_spi_deinit(void *vp)
 {
 
 	spi_unregister_driver(&wilc_bus);
@@ -93,7 +93,7 @@ void linux_spi_deinit(void *vp)
 
 
 
-int linux_spi_init(void *vp)
+int wilc1000_spi_init(void *vp)
 {
 	int ret = 1;
 	static int called;
@@ -116,7 +116,7 @@ int linux_spi_init(void *vp)
 
 #if defined(TXRX_PHASE_SIZE)
 
-int linux_spi_write(u8 *b, u32 len)
+int wilc1000_spi_write(u8 *b, u32 len)
 {
 	int ret;
 
@@ -193,7 +193,7 @@ int linux_spi_write(u8 *b, u32 len)
 }
 
 #else
-int linux_spi_write(u8 *b, u32 len)
+int wilc1000_spi_write(u8 *b, u32 len)
 {
 
 	int ret;
@@ -244,7 +244,7 @@ int linux_spi_write(u8 *b, u32 len)
 
 #if defined(TXRX_PHASE_SIZE)
 
-int linux_spi_read(u8 *rb, u32 rlen)
+int wilc1000_spi_read(u8 *rb, u32 rlen)
 {
 	int ret;
 
@@ -318,7 +318,7 @@ int linux_spi_read(u8 *rb, u32 rlen)
 }
 
 #else
-int linux_spi_read(u8 *rb, u32 rlen)
+int wilc1000_spi_read(u8 *rb, u32 rlen)
 {
 
 	int ret;
@@ -363,7 +363,7 @@ int linux_spi_read(u8 *rb, u32 rlen)
 
 #endif
 
-int linux_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
+int wilc1000_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
 {
 
 	int ret;
@@ -400,7 +400,7 @@ int linux_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
 	return ret;
 }
 
-int linux_spi_set_max_speed(void)
+int wilc1000_spi_set_max_speed(void)
 {
 	SPEED = MAX_SPEED;
 
drivers/staging/wilc1000/linux_wlan_spi.h +6 -6
index 7356785296f9..efa95e3e8bfe 100644
@@ -5,10 +5,10 @@
 extern struct spi_device *wilc_spi_dev;
 extern struct spi_driver wilc_bus;
 
-int linux_spi_init(void *vp);
-void linux_spi_deinit(void *vp);
-int linux_spi_write(u8 *b, u32 len);
-int linux_spi_read(u8 *rb, u32 rlen);
-int linux_spi_write_read(u8 *wb, u8 *rb, u32 rlen);
-int linux_spi_set_max_speed(void);
+int wilc1000_spi_init(void *vp);
+void wilc1000_spi_deinit(void *vp);
+int wilc1000_spi_write(u8 *b, u32 len);
+int wilc1000_spi_read(u8 *rb, u32 rlen);
+int wilc1000_spi_write_read(u8 *wb, u8 *rb, u32 rlen);
+int wilc1000_spi_set_max_speed(void);
 #endif
drivers/staging/wilc1000/wilc_debugfs.c +9 -9
index ae111862e7a9..c22f0ca10250 100644
@@ -26,8 +26,8 @@ static struct dentry *wilc_dir;
 
 #define DBG_REGION_ALL	(GENERIC_DBG | HOSTAPD_DBG | HOSTINF_DBG | CORECONFIG_DBG | CFG80211_DBG | INT_DBG | TX_DBG | RX_DBG | LOCK_DBG | INIT_DBG | BUS_DBG | MEM_DBG)
 #define DBG_LEVEL_ALL	(DEBUG | INFO | WRN | ERR)
-atomic_t REGION = ATOMIC_INIT(INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG);
-atomic_t DEBUG_LEVEL = ATOMIC_INIT(ERR);
+atomic_t WILC1000_REGION = ATOMIC_INIT(INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG);
+atomic_t WILC1000_DEBUG_LEVEL = ATOMIC_INIT(ERR);
 
 /*
  * --------------------------------------------------------------------------------
@@ -43,7 +43,7 @@ static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf, si
 	if (*ppos > 0)
 		return 0;
 
-	res = scnprintf(buf, sizeof(buf), "Debug Level: %x\n", atomic_read(&DEBUG_LEVEL));
+	res = scnprintf(buf, sizeof(buf), "Debug Level: %x\n", atomic_read(&WILC1000_DEBUG_LEVEL));
 
 	return simple_read_from_buffer(userbuf, count, ppos, buf, res);
 }
@@ -59,11 +59,11 @@ static ssize_t wilc_debug_level_write(struct file *filp, const char __user *buf,
 		return ret;
 
 	if (flag > DBG_LEVEL_ALL) {
-		printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&DEBUG_LEVEL));
+		printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&WILC1000_DEBUG_LEVEL));
 		return -EINVAL;
 	}
 
-	atomic_set(&DEBUG_LEVEL, (int)flag);
+	atomic_set(&WILC1000_DEBUG_LEVEL, (int)flag);
 
 	if (flag == 0)
 		printk("Debug-level disabled\n");
@@ -82,7 +82,7 @@ static ssize_t wilc_debug_region_read(struct file *file, char __user *userbuf, s
 	if (*ppos > 0)
 		return 0;
 
-	res = scnprintf(buf, sizeof(buf), "Debug region: %x\n", atomic_read(&REGION));
+	res = scnprintf(buf, sizeof(buf), "Debug region: %x\n", atomic_read(&WILC1000_REGION));
 
 	return simple_read_from_buffer(userbuf, count, ppos, buf, res);
 }
@@ -102,12 +102,12 @@ static ssize_t wilc_debug_region_write(struct file *filp, const char *buf, size_
 	flag = buffer[0] - '0';
 
 	if (flag > DBG_REGION_ALL) {
-		printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&REGION));
+		printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&WILC1000_REGION));
 		return -EFAULT;
 	}
 
-	atomic_set(&REGION, (int)flag);
-	printk("new debug-region is %x\n", atomic_read(&REGION));
+	atomic_set(&WILC1000_REGION, (int)flag);
+	printk("new debug-region is %x\n", atomic_read(&WILC1000_REGION));
 
 	return count;
 }
drivers/staging/wilc1000/wilc_sdio.c +1 -1
index 4425b5f369e0..91b626ac8797 100644
@@ -936,7 +936,7 @@ static int sdio_sync_ext(int nint /*  how mant interrupts to enable. */)
  *
  ********************************************/
 
-wilc_hif_func_t hif_sdio = {
+wilc_hif_func_t wilc1000_hif_sdio = {
 	sdio_init,
 	sdio_deinit,
 	sdio_read_reg,
drivers/staging/wilc1000/wilc_spi.c +1 -1
index 732c3f8c7f32..bb7ee37171ce 100644
@@ -1031,7 +1031,7 @@ static int spi_sync_ext(int nint /*  how mant interrupts to enable. */)
  *      Global spi HIF function table
  *
  ********************************************/
-wilc_hif_func_t hif_spi = {
+wilc_hif_func_t wilc1000_hif_spi = {
 	spi_init,
 	spi_deinit,
 	spi_read_reg,
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +156 -156

651 lines not on this page · raw message

drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +1 -1
index e7ea397644de..a87982cfcd4b 100644

Lines of this file are not shown. View the raw message.

drivers/staging/wilc1000/wilc_wfi_netdevice.h +1 -1
index c5061fd07312..700f6f343b52 100644

Lines of this file are not shown. View the raw message.

drivers/staging/wilc1000/wilc_wlan.c +47 -47

94 lines not on this page · raw message

drivers/staging/wilc1000/wilc_wlan_cfg.c +3 -3
index a34a81cdeb5e..d3e3ad617dfb 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.1.0.rc2

Part of the diff is not shown here. View the raw message.

#5 lore raw

PATCH 4/19 staging/wilc1000: move extern declarations to headers

In reply to Arnd Bergmann

'extern' declarations belong into a header file rather than a .c file, to ensure that the definition matches the declaration.

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

---
 drivers/staging/wilc1000/host_interface.c         | 10 +-------
 drivers/staging/wilc1000/host_interface.h         | 10 ++++++++
 drivers/staging/wilc1000/linux_mon.c              |  3 ---
 drivers/staging/wilc1000/linux_wlan.c             | 16 -------------
 drivers/staging/wilc1000/linux_wlan_sdio.c        |  3 ---
 drivers/staging/wilc1000/linux_wlan_spi.c         |  1 -
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 15 +-----------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  1 -
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |  4 ++++
 drivers/staging/wilc1000/wilc_wlan.c              |  9 +------
 drivers/staging/wilc1000/wilc_wlan.h              | 29 ++++++++++++++++++++++-
 11 files changed, 45 insertions(+), 56 deletions(-)
drivers/staging/wilc1000/host_interface.c +1 -9
index c8c5f5c602c7..99c78d395653 100644
@@ -4,16 +4,11 @@
 #include <linux/delay.h>
 #include "host_interface.h"
 #include "coreconfigurator.h"
+#include "wilc_wlan.h"
 #include "wilc_wlan_if.h"
 #include "wilc_msgqueue.h"
 #include <linux/etherdevice.h>
 
-extern u8 wilc1000_connecting;
-
-extern struct timer_list wilc1000_during_ip_timer;
-
-extern u8 wilc1000_initialized;
-
 #define HOST_IF_MSG_SCAN                        0
 #define HOST_IF_MSG_CONNECT                     1
 #define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO        2
@@ -268,9 +263,6 @@ static struct host_if_drv *join_req_drv;
 
 static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo);
 
-extern void wilc1000_chip_sleep_manually(u32 u32SleepTime);
-extern int wilc1000_wlan_get_num_conn_ifcs(void);
-
 static int add_handler_in_list(struct host_if_drv *handler)
 {
 	int i;
drivers/staging/wilc1000/host_interface.h +10 -0
index 826ed0f30615..1f537ed9d7f3 100644
@@ -925,4 +925,14 @@ void wilc1000_free_join_params(void *pJoinParams);
 
 s32 wilc1000_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info *pstrStatistics);
 
+void wilc1000_resolve_disconnect_aberration(struct host_if_drv *drvHandler);
+
+extern bool wilc1000_optaining_ip;
+extern u8 wilc1000_connected_SSID[6];
+extern u8 wilc1000_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
+
+extern int wilc1000_connecting;
+extern u8 wilc1000_initialized;
+extern struct timer_list wilc1000_during_ip_timer;
+
 #endif
drivers/staging/wilc1000/linux_mon.c +0 -3
index 52443f039a43..50196c3aa61d 100644
@@ -26,9 +26,6 @@ struct wilc_wfi_radiotap_cb_hdr {
 
 static struct net_device *wilc_wfi_mon; /* global monitor netdev */
 
-extern int  wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-
-
 static u8 srcAdd[6];
 static u8 bssid[6];
 static u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
drivers/staging/wilc1000/linux_wlan.c +0 -16
index be4b1b1199f8..50477d70eb24 100644
@@ -45,13 +45,6 @@
  #define _linux_wlan_device_removal()		{}
 #endif
 
-extern bool wilc1000_optaining_ip;
-extern u16 wilc1000_set_machw_change_vir_if(bool bValue);
-extern void wilc1000_resolve_disconnect_aberration(void *drvHandler);
-extern u8 wilc1000_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
-void wilc1000_wlan_deinit(struct wilc *nic);
-extern struct timer_list wilc1000_during_ip_timer;
-
 static int linux_wlan_device_power(int on_off)
 {
 	PRINT_D(INIT_DBG, "linux_wlan_device_power.. (%d)\n", on_off);
@@ -98,14 +91,9 @@ static struct semaphore close_exit_sync;
 
 static int wlan_deinit_locks(struct wilc *nic);
 static void wlan_deinitialize_threads(struct wilc *nic);
-extern void WILC_WFI_monitor_rx(u8 *buff, u32 size);
-extern void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
 
 static void linux_wlan_tx_complete(void *priv, int status);
 static int  mac_init_fn(struct net_device *ndev);
-int  wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-int  wilc1000_mac_open(struct net_device *ndev);
-int  wilc1000_mac_close(struct net_device *ndev);
 static struct net_device_stats *mac_stats(struct net_device *dev);
 static int  mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd);
 static void wilc_set_multicast_list(struct net_device *dev);
@@ -1047,11 +1035,7 @@ static void wlan_deinitialize_threads(struct wilc *nic)
 
 #ifdef COMPLEMENT_BOOT
 
-extern volatile int wilc1000_probe;
-extern u8 wilc1000_core_11b_ready(void);
-
 #define READY_CHECK_THRESHOLD		30
-extern void wilc_wlan_global_reset(void);
 static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
 {
 	u8 trials = 0;
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -3
index 470f4bf372f1..4e8c4e6d499e 100644
@@ -23,9 +23,6 @@
 
 
 struct sdio_func *wilc1000_sdio_func;
-extern int wilc_netdev_init(void);
-extern void wilc_handle_isr(void);
-
 static unsigned int sdio_default_speed;
 
 #define SDIO_VENDOR_ID_WILC 0x0296
drivers/staging/wilc1000/linux_wlan_spi.c +0 -1
index 8d8310681658..43cfeda97030 100644
@@ -42,7 +42,6 @@
 static u32 SPEED = MIN_SPEED;
 
 struct spi_device *wilc_spi_dev;
-void wilc1000_spi_deinit(void *vp);
 
 static int __init wilc_bus_probe(struct spi_device *spi)
 {
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +1 -14
index 672741632f85..0ed05aafa5bf 100644
@@ -14,6 +14,7 @@
 #ifdef WILC_SDIO
 #include "linux_wlan_sdio.h"
 #endif
+#include "host_interface.h"
 #include <linux/errno.h>
 
 #define IS_MANAGMEMENT				0x100
@@ -21,21 +22,13 @@
 #define IS_MGMT_STATUS_SUCCES			0x040
 #define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
 
-extern int wilc1000_wlan_get_firmware(perInterface_wlan_t *p_nic);
-extern u16 wilc1000_set_machw_change_vir_if(bool bValue);
-
-extern int wilc1000_mac_open(struct net_device *ndev);
-extern int wilc1000_mac_close(struct net_device *ndev);
-
 static tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
 static u32 u32LastScannedNtwrksCountShadow;
 struct timer_list wilc1000_during_ip_timer;
 static struct timer_list hAgingTimer;
 static u8 op_ifcs;
-extern u8 wilc1000_connected_SSID[6];
 
 u8 wilc1000_initialized = 1;
-extern bool wilc1000_optaining_ip;
 
 #define CHAN2G(_channel, _freq, _flags) {	 \
 		.band             = IEEE80211_BAND_2GHZ, \
@@ -473,8 +466,6 @@ static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo *pstrNet
 }
 
 
-int wilc1000_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID);
-
 
 /**
  *  @brief      CfgConnectResult
@@ -2156,7 +2147,6 @@ static void WILC_WFI_add_wilcvendorspec(u8 *buff)
  *  @date	01 JUL 2012
  *  @version
  */
-extern bool wilc1000_enable_ps;
 static int mgmt_tx(struct wiphy *wiphy,
 		   struct wireless_dev *wdev,
 		   struct cfg80211_mgmt_tx_params *params,
@@ -2488,9 +2478,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
  *  @date	01 MAR 2012
  *  @version	1.0
  */
-void wilc1000_wlan_deinit(struct wilc *nic);
-int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic);
-
 static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 			       enum nl80211_iftype type, u32 *flags, struct vif_params *params)
 {
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +0 -1
index a87982cfcd4b..ae2aaea508db 100644
@@ -103,6 +103,5 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
 
 #define TCP_ACK_FILTER_LINK_SPEED_THRESH	54
 #define DEFAULT_LINK_SPEED			72
-void wilc1000_enable_tcp_ack_filter(bool value);
 
 #endif
drivers/staging/wilc1000/wilc_wfi_netdevice.h +4 -0
index 700f6f343b52..28610d889c0c 100644
@@ -206,6 +206,10 @@ struct WILC_WFI_mon_priv {
 	struct net_device *real_ndev;
 };
 
+int wilc1000_wlan_get_firmware(perInterface_wlan_t *p_nic);
+void wilc1000_wlan_deinit(struct wilc *nic);
+int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic);
+
 extern struct wilc *wilc1000_dev;
 extern struct net_device *WILC_WFI_devs[];
 void frmw_to_linux(u8 *buff, u32 size, u32 pkt_offset);
drivers/staging/wilc1000/wilc_wlan.c +1 -8
index 140778d8aab5..a147547fb66e 100644
@@ -8,6 +8,7 @@
 /* //////////////////////////////////////////////////////////////////////////// */
 
 #include "wilc_wlan_if.h"
+#include "wilc_wlan.h"
 #include "wilc_wfi_netdevice.h"
 #include "wilc_wlan_cfg.h"
 
@@ -16,14 +17,6 @@
  *      Global
  *
  ********************************************/
-extern wilc_hif_func_t wilc1000_hif_sdio;
-extern wilc_hif_func_t wilc1000_hif_spi;
-extern void WILC_WFI_mgmt_rx(u8 *buff, u32 size);
-u32 wilc_get_chipid(u8 update);
-u16 wilc1000_set_machw_change_vir_if(bool bValue);
-
-
-
 typedef struct {
 	int quit;
 
drivers/staging/wilc1000/wilc_wlan.h +28 -1
index bd89689fbf10..64295a664ea9 100644
@@ -1,7 +1,7 @@
 #ifndef WILC_WLAN_H
 #define WILC_WLAN_H
 
-
+#include <linux/types.h>
 
 #define ISWILC1000(id)   (((id & 0xfffff000) == 0x100000) ? 1 : 0)
 
@@ -270,6 +270,9 @@ typedef struct {
 	void (*hif_set_default_bus_speed)(void);
 } wilc_hif_func_t;
 
+extern wilc_hif_func_t wilc1000_hif_spi;
+extern wilc_hif_func_t wilc1000_hif_sdio;
+
 /********************************************
  *
  *      Configuration Structure
@@ -309,4 +312,28 @@ int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler);
 int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size);
 int wilc_wlan_txq_add_mgmt_pkt(void *priv, u8 *buffer, u32 buffer_size,
 			       wilc_tx_complete_func_t func);
+extern void wilc_wlan_global_reset(void);
+
+void wilc1000_enable_tcp_ack_filter(bool value);
+void wilc1000_chip_sleep_manually(u32 u32SleepTime);
+int wilc1000_wlan_get_num_conn_ifcs(void);
+int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
+int wilc_netdev_init(void);
+void wilc_handle_isr(void);
+
+u16 wilc1000_set_machw_change_vir_if(bool bValue);
+
+int wilc1000_mac_open(struct net_device *ndev);
+int wilc1000_mac_close(struct net_device *ndev);
+
+void WILC_WFI_mgmt_rx(u8 *buff, u32 size);
+
+int wilc1000_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID);
+void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
+u8 wilc1000_core_11b_ready(void);
+
+extern bool wilc1000_enable_ps;
+extern volatile int wilc1000_probe;
+
+
 #endif
Signature · 1 line
2.1.0.rc2
#6 lore raw

PATCH 5/19 staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT

In reply to Arnd Bergmann

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

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

---
 drivers/staging/wilc1000/linux_wlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/linux_wlan.c +1 -1
index 50477d70eb24..d3cc255cd91b 100644
@@ -701,7 +701,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; /* NO_ENCRYPT, 0x79 */
+	c_val[0] = NO_SECURITY; /* NO_ENCRYPT, 0x79 */
 	if (!wilc_wlan_cfg_set(0, WID_11I_MODE, c_val, 1, 0, 0))
 		goto _fail_;
 
Signature · 1 line
2.1.0.rc2
#7 lore raw

PATCH 6/19 staging/wilc1000: avoid static definitions in header

In reply to Arnd Bergmann

The wilc_wfi_cfgoperations.h header defines the ieee80211_txrx_stypes and cipher_suites variables that are only used in wilc_wfi_cfgoperations.c and should not be shared in a header file.

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

---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 84 +++++++++++++++++++++++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 83 ----------------------
 2 files changed, 84 insertions(+), 83 deletions(-)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +84 -0
index 0ed05aafa5bf..702c40c1df4b 100644
@@ -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
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +0 -83

93 lines not on this page · raw message

Signature · 1 line
2.1.0.rc2
#8 lore raw

PATCH 7/19 staging/wilc1000: remove linux_wlan_{device_power,device_detection}

In reply to Arnd Bergmann

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

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

This removes the empty stubs.

---
 drivers/staging/wilc1000/linux_wlan.c | 62 -----------------------------------
 1 file changed, 62 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +0 -62
index d3cc255cd91b..eb4c6cba4575 100644
@@ -32,47 +32,6 @@
 #include "linux_wlan_spi.h"
 #endif
 
-#if defined(CUSTOMER_PLATFORM)
-/*
- TODO : Write power control functions as customer platform.
- */
-#else
-
- #define _linux_wlan_device_power_on()		{}
- #define _linux_wlan_device_power_off()		{}
-
- #define _linux_wlan_device_detection()		{}
- #define _linux_wlan_device_removal()		{}
-#endif
-
-static int linux_wlan_device_power(int on_off)
-{
-	PRINT_D(INIT_DBG, "linux_wlan_device_power.. (%d)\n", on_off);
-
-	if (on_off) {
-		_linux_wlan_device_power_on();
-	} else {
-		_linux_wlan_device_power_off();
-	}
-
-	return 0;
-}
-
-static int linux_wlan_device_detection(int on_off)
-{
-	PRINT_D(INIT_DBG, "linux_wlan_device_detection.. (%d)\n", on_off);
-
-#ifdef WILC_SDIO
-	if (on_off) {
-		_linux_wlan_device_detection();
-	} else {
-		_linux_wlan_device_removal();
-	}
-#endif
-
-	return 0;
-}
-
 static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr);
 
 static struct notifier_block g_dev_notifier = {
@@ -1046,12 +1005,6 @@ static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
 		wilc_wlan_global_reset();
 		sdio_unregister_driver(&wilc_bus);
 
-		linux_wlan_device_detection(0);
-
-		mdelay(100);
-
-		linux_wlan_device_detection(1);
-
 		sdio_register_driver(&wilc_bus);
 
 		while (!wilc1000_probe)
@@ -1076,14 +1029,6 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
 
 	sdio_unregister_driver(&wilc_bus);
 
-	linux_wlan_device_detection(0);
-	linux_wlan_device_power(0);
-	msleep(100);
-	linux_wlan_device_power(1);
-	msleep(80);
-	linux_wlan_device_detection(1);
-	msleep(20);
-
 	sdio_register_driver(&wilc_bus);
 
 	/* msleep(1000); */
@@ -1794,10 +1739,6 @@ static int __init init_wilc_driver(void)
 	printk("IN INIT FUNCTION\n");
 	printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
 
-	linux_wlan_device_power(1);
-	msleep(100);
-	linux_wlan_device_detection(1);
-
 #ifdef WILC_SDIO
 	{
 		int ret;
@@ -1877,9 +1818,6 @@ static void __exit exit_wilc_driver(void)
 #if defined(WILC_DEBUGFS)
 	wilc_debugfs_remove();
 #endif
-
-	linux_wlan_device_detection(0);
-	linux_wlan_device_power(0);
 }
 module_exit(exit_wilc_driver);
 
Signature · 1 line
2.1.0.rc2
#9 lore raw

PATCH 8/19 staging/wilc1000: move wilc_wlan_inp_t into struct wilc

In reply to Arnd Bergmann

wilc_wlan_inp_t is an unnecessary indirection and requires linux_wlan.c to have knowledge of the specific sdio and spi front-ends. This removes the structure and places the members with a constant 'struct wilc1000_ops' pointer inside of 'struct wilc'.

---
 drivers/staging/wilc1000/linux_wlan.c         | 67 +++++++++++++--------------
 drivers/staging/wilc1000/wilc_sdio.c          | 17 +++----
 drivers/staging/wilc1000/wilc_spi.c           | 17 +++----
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 drivers/staging/wilc1000/wilc_wlan.c          | 22 ++++-----
 drivers/staging/wilc1000/wilc_wlan.h          |  4 +-
 drivers/staging/wilc1000/wilc_wlan_if.h       | 16 ++-----
 7 files changed, 70 insertions(+), 74 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +33 -34
index eb4c6cba4575..53cecb892a84 100644
@@ -923,31 +923,29 @@ static int wlan_deinit_locks(struct wilc *nic)
 	return 0;
 }
 
-static void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
-{
-
-	PRINT_D(INIT_DBG, "Linux to Wlan services ...\n");
-
-	nwi->os_context.os_private = (void *)nic;
-
 #ifdef WILC_SDIO
-	nwi->io_func.io_type = HIF_SDIO;
-	nwi->io_func.io_init = wilc1000_sdio_init;
-	nwi->io_func.io_deinit = wilc1000_sdio_deinit;
-	nwi->io_func.u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52;
-	nwi->io_func.u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53;
-	nwi->io_func.u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed;
-	nwi->io_func.u.sdio.sdio_set_default_speed = wilc1000_sdio_set_default_speed;
-#else
-	nwi->io_func.io_type = HIF_SPI;
-	nwi->io_func.io_init = wilc1000_spi_init;
-	nwi->io_func.io_deinit = wilc1000_spi_deinit;
-	nwi->io_func.u.spi.spi_tx = wilc1000_spi_write;
-	nwi->io_func.u.spi.spi_rx = wilc1000_spi_read;
-	nwi->io_func.u.spi.spi_trx = wilc1000_spi_write_read;
-	nwi->io_func.u.spi.spi_max_speed = wilc1000_spi_set_max_speed;
+static const struct wilc1000_ops wilc1000_sdio_ops = {
+	.io_type = HIF_SDIO,
+	.io_init = wilc1000_sdio_init,
+	.io_deinit = wilc1000_sdio_deinit,
+	.u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52,
+	.u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53,
+	.u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed,
+	.u.sdio.sdio_set_default_speed = wilc1000_sdio_set_default_speed,
+};
+#endif
+
+#ifdef WILC_SPI
+static const struct wilc1000_ops wilc1000_spi_ops = {
+	.io_type = HIF_SPI,
+	.io_init = wilc1000_spi_init,
+	.io_deinit = wilc1000_spi_deinit,
+	.u.spi.spi_tx = wilc1000_spi_write,
+	.u.spi.spi_rx = wilc1000_spi_read,
+	.u.spi.spi_trx = wilc1000_spi_write_read,
+	.u.spi.spi_max_speed = wilc1000_spi_set_max_speed,
+};
 #endif
-}
 
 static int wlan_initialize_threads(perInterface_wlan_t *nic)
 {
@@ -995,7 +993,7 @@ static void wlan_deinitialize_threads(struct wilc *nic)
 #ifdef COMPLEMENT_BOOT
 
 #define READY_CHECK_THRESHOLD		30
-static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
+static u8 wilc1000_prepare_11b_core(struct wilc *nic)
 {
 	u8 trials = 0;
 
@@ -1011,8 +1009,8 @@ static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
 			msleep(100);
 		wilc1000_probe = 0;
 		wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
-		linux_to_wlan(nwi, nic);
-		wilc_wlan_init(nwi);
+		nic->ops = &wilc1000_sdio_ops;
+		wilc_wlan_init(nic);
 	}
 
 	if (READY_CHECK_THRESHOLD <= trials)
@@ -1025,8 +1023,6 @@ static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
 static int repeat_power_cycle(perInterface_wlan_t *nic)
 {
 	int ret = 0;
-	wilc_wlan_inp_t nwi;
-
 	sdio_unregister_driver(&wilc_bus);
 
 	sdio_register_driver(&wilc_bus);
@@ -1036,8 +1032,8 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
 		msleep(100);
 	wilc1000_probe = 0;
 	wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
-	linux_to_wlan(&nwi, wilc1000_dev);
-	ret = wilc_wlan_init(&nwi);
+	wilc1000_dev->ops = &wilc1000_sdio_ops;
+	ret = wilc_wlan_init(wilc1000_dev);
 
 	wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
 	#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
@@ -1067,7 +1063,6 @@ __fail__:
 
 int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 {
-	wilc_wlan_inp_t nwi;
 	perInterface_wlan_t *nic = p_nic;
 	int ret = 0;
 
@@ -1078,9 +1073,13 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 
 		wlan_init_locks(wilc1000_dev);
 
-		linux_to_wlan(&nwi, wilc1000_dev);
+#ifdef WILC_SDIO
+		wilc1000_dev->ops = &wilc1000_sdio_ops;
+#else
+		wilc1000_dev->ops = &wilc1000_spi_ops;
+#endif
 
-		ret = wilc_wlan_init(&nwi);
+		ret = wilc_wlan_init(wilc1000_dev);
 		if (ret < 0) {
 			PRINT_ER("Initializing WILC_Wlan FAILED\n");
 			ret = -EIO;
@@ -1095,7 +1094,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 		}
 
 #if (defined WILC_SDIO) && (defined COMPLEMENT_BOOT)
-		if (wilc1000_prepare_11b_core(&nwi, wilc1000_dev)) {
+		if (wilc1000_prepare_11b_core(wilc1000_dev)) {
 			PRINT_ER("11b Core is not ready\n");
 			ret = -EIO;
 			goto _fail_threads_;
drivers/staging/wilc1000/wilc_sdio.c +9 -8
index 91b626ac8797..2d39a5386718 100644
@@ -8,6 +8,7 @@
 /* //////////////////////////////////////////////////////////////////////////// */
 
 #include <linux/string.h>
+#include "wilc_wfi_netdevice.h"
 #include "wilc_wlan_if.h"
 #include "wilc_wlan.h"
 
@@ -498,7 +499,7 @@ static int sdio_sync(void)
 	return 1;
 }
 
-static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
+static int sdio_init(struct wilc *inp, wilc_debug_func func)
 {
 	sdio_cmd52_t cmd;
 	int loop;
@@ -507,10 +508,10 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
 	memset(&g_sdio, 0, sizeof(wilc_sdio_t));
 
 	g_sdio.dPrint = func;
-	g_sdio.os_context = inp->os_context.os_private;
+	g_sdio.os_context = inp;
 
-	if (inp->io_func.io_init) {
-		if (!inp->io_func.io_init(g_sdio.os_context)) {
+	if (inp->ops->io_init) {
+		if (!inp->ops->io_init(g_sdio.os_context)) {
 			g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n");
 			return 0;
 		}
@@ -518,10 +519,10 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
 		return 0;
 	}
 
-	g_sdio.sdio_cmd52	= inp->io_func.u.sdio.sdio_cmd52;
-	g_sdio.sdio_cmd53	= inp->io_func.u.sdio.sdio_cmd53;
-	g_sdio.sdio_set_max_speed	= inp->io_func.u.sdio.sdio_set_max_speed;
-	g_sdio.sdio_set_default_speed	= inp->io_func.u.sdio.sdio_set_default_speed;
+	g_sdio.sdio_cmd52	= inp->ops->u.sdio.sdio_cmd52;
+	g_sdio.sdio_cmd53	= inp->ops->u.sdio.sdio_cmd53;
+	g_sdio.sdio_set_max_speed	= inp->ops->u.sdio.sdio_set_max_speed;
+	g_sdio.sdio_set_default_speed	= inp->ops->u.sdio.sdio_set_default_speed;
 
 	/**
 	 *      function 0 csa enable
drivers/staging/wilc1000/wilc_spi.c +9 -8
index bb7ee37171ce..4c5659b72f29 100644
@@ -8,6 +8,7 @@
 /* //////////////////////////////////////////////////////////////////////////// */
 
 #include <linux/string.h>
+#include "wilc_wfi_netdevice.h"
 #include "wilc_wlan_if.h"
 #include "wilc_wlan.h"
 
@@ -724,7 +725,7 @@ static int spi_sync(void)
 	return 1;
 }
 
-static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
+static int spi_init(struct wilc *inp, wilc_debug_func func)
 {
 	u32 reg;
 	u32 chipid;
@@ -743,19 +744,19 @@ static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
 	memset(&g_spi, 0, sizeof(wilc_spi_t));
 
 	g_spi.dPrint = func;
-	g_spi.os_context = inp->os_context.os_private;
-	if (inp->io_func.io_init) {
-		if (!inp->io_func.io_init(g_spi.os_context)) {
+	g_spi.os_context = inp;
+	if (inp->ops->io_init) {
+		if (!inp->ops->io_init(g_spi.os_context)) {
 			PRINT_ER("[wilc spi]: Failed io init bus...\n");
 			return 0;
 		}
 	} else {
 		return 0;
 	}
-	g_spi.spi_tx = inp->io_func.u.spi.spi_tx;
-	g_spi.spi_rx = inp->io_func.u.spi.spi_rx;
-	g_spi.spi_trx = inp->io_func.u.spi.spi_trx;
-	g_spi.spi_max_speed = inp->io_func.u.spi.spi_max_speed;
+	g_spi.spi_tx = inp->ops->u.spi.spi_tx;
+	g_spi.spi_rx = inp->ops->u.spi.spi_rx;
+	g_spi.spi_trx = inp->ops->u.spi.spi_trx;
+	g_spi.spi_max_speed = inp->ops->u.spi.spi_max_speed;
 
 	/**
 	 *      configure protocol
drivers/staging/wilc1000/wilc_wfi_netdevice.h +1 -0
index 28610d889c0c..485df4768e78 100644
@@ -156,6 +156,7 @@ struct wilc_vif {
 };
 
 struct wilc {
+	const struct wilc1000_ops *ops;
 	int mac_status;
 	int wilc1000_initialized;
 	#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
drivers/staging/wilc1000/wilc_wlan.c +11 -11
index a147547fb66e..7e1b892f721d 100644
@@ -23,7 +23,7 @@ typedef struct {
 	/**
 	 *      input interface functions
 	 **/
-	wilc_wlan_io_func_t io_func;
+	const struct wilc1000_ops *io_func;
 
 	/**
 	 *      host interface functions
@@ -651,7 +651,7 @@ static inline void chip_wakeup(void)
 	u32 reg, clk_status_reg, trials = 0;
 	u32 sleep_time;
 
-	if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) {
+	if ((g_wlan.io_func->io_type & 0x1) == HIF_SPI) {
 		do {
 			g_wlan.hif_func.hif_read_reg(1, &reg);
 			/* Set bit 1 */
@@ -671,7 +671,7 @@ static inline void chip_wakeup(void)
 			} while ((wilc_get_chipid(true) == 0) && ((++trials % 3) == 0));
 
 		} while (wilc_get_chipid(true) == 0);
-	} else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO)	 {
+	} else if ((g_wlan.io_func->io_type & 0x1) == HIF_SDIO)	 {
 		g_wlan.hif_func.hif_read_reg(0xf0, &reg);
 		do {
 			/* Set bit 1 */
@@ -731,7 +731,7 @@ static inline void chip_wakeup(void)
 	u32 reg, trials = 0;
 
 	do {
-		if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) {
+		if ((g_wlan.io_func->io_type & 0x1) == HIF_SPI) {
 			g_wlan.hif_func.hif_read_reg(1, &reg);
 			/* Make sure bit 1 is 0 before we start. */
 			g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1));
@@ -739,7 +739,7 @@ static inline void chip_wakeup(void)
 			g_wlan.hif_func.hif_write_reg(1, reg | BIT(1));
 			/* Clear bit 1*/
 			g_wlan.hif_func.hif_write_reg(1, reg  & ~BIT(1));
-		} else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO)	 {
+		} else if ((g_wlan.io_func->io_type & 0x1) == HIF_SDIO)	 {
 			/* Make sure bit 0 is 0 before we start. */
 			g_wlan.hif_func.hif_read_reg(0xf0, &reg);
 			g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0));
@@ -1465,10 +1465,10 @@ int wilc_wlan_start(void)
 	/**
 	 *      Set the host interface
 	 **/
-	if (p->io_func.io_type == HIF_SDIO) {
+	if (p->io_func->io_type == HIF_SDIO) {
 		reg = 0;
 		reg |= BIT(3); /* bug 4456 and 4557 */
-	} else if (p->io_func.io_type == HIF_SPI) {
+	} else if (p->io_func->io_type == HIF_SPI) {
 		reg = 1;
 	}
 	acquire_bus(ACQUIRE_ONLY);
@@ -1932,7 +1932,7 @@ u8 wilc1000_core_11b_ready(void)
 }
 #endif
 
-int wilc_wlan_init(wilc_wlan_inp_t *inp)
+int wilc_wlan_init(struct wilc *inp)
 {
 
 	int ret = 0;
@@ -1944,11 +1944,11 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp)
 	/**
 	 *      store the input
 	 **/
-	memcpy((void *)&g_wlan.io_func, (void *)&inp->io_func, sizeof(wilc_wlan_io_func_t));
+	g_wlan.io_func = inp->ops;
 	/***
 	 *      host interface init
 	 **/
-	if ((inp->io_func.io_type & 0x1) == HIF_SDIO) {
+	if ((inp->ops->io_type & 0x1) == HIF_SDIO) {
 		if (!wilc1000_hif_sdio.hif_init(inp, wilc_debug)) {
 			/* EIO	5 */
 			ret = -5;
@@ -1956,7 +1956,7 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp)
 		}
 		memcpy((void *)&g_wlan.hif_func, &wilc1000_hif_sdio, sizeof(wilc_hif_func_t));
 	} else {
-		if ((inp->io_func.io_type & 0x1) == HIF_SPI) {
+		if ((inp->ops->io_type & 0x1) == HIF_SPI) {
 			/**
 			 *      TODO:
 			 **/
drivers/staging/wilc1000/wilc_wlan.h +3 -1
index 64295a664ea9..4460c482cb7a 100644
@@ -251,8 +251,10 @@ struct rxq_entry_t {
  *
  ********************************************/
 
+struct wilc;
+
 typedef struct {
-	int (*hif_init)(wilc_wlan_inp_t *, wilc_debug_func);
+	int (*hif_init)(struct wilc *, wilc_debug_func);
 	int (*hif_deinit)(void *);
 	int (*hif_read_reg)(u32, u32 *);
 	int (*hif_write_reg)(u32, u32);
drivers/staging/wilc1000/wilc_wlan_if.h +4 -12
index be972afe6e62..bfa1291e22ed 100644
@@ -71,7 +71,7 @@ typedef struct {
 	u32 block_size;
 } sdio_cmd53_t;
 
-typedef struct {
+struct wilc1000_ops {
 	int io_type;
 	int (*io_init)(void *);
 	void (*io_deinit)(void *);
@@ -89,7 +89,7 @@ typedef struct {
 			int (*spi_trx)(u8 *, u8 *, u32);
 		} spi;
 	} u;
-} wilc_wlan_io_func_t;
+};
 
 #define WILC_MAC_INDICATE_STATUS	0x1
 #define WILC_MAC_STATUS_INIT		-1
@@ -98,15 +98,6 @@ typedef struct {
 
 #define WILC_MAC_INDICATE_SCAN		0x2
 
-typedef struct {
-	void *os_private;
-} wilc_wlan_os_context_t;
-
-typedef struct {
-	wilc_wlan_os_context_t os_context;
-	wilc_wlan_io_func_t io_func;
-} wilc_wlan_inp_t;
-
 struct tx_complete_data {
 	int size;
 	void *buff;
@@ -937,7 +928,8 @@ typedef enum {
 	WID_MAX				= 0xFFFF
 } WID_T;
 
-int wilc_wlan_init(wilc_wlan_inp_t *inp);
+struct wilc;
+int wilc_wlan_init(struct wilc *inp);
 
 void wilc_bus_set_max_speed(void);
 void wilc_bus_set_default_speed(void);
Signature · 1 line
2.1.0.rc2
#10 lore raw

PATCH 9/19 staging/wilc1000: move init/exit functions to driver files

In reply to Arnd Bergmann

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

---
 drivers/staging/wilc1000/linux_wlan.c      | 49 +++++++-----------------------
 drivers/staging/wilc1000/linux_wlan_sdio.c | 14 +++++++++
 drivers/staging/wilc1000/linux_wlan_spi.c  | 16 ++++++++++
 drivers/staging/wilc1000/wilc_wlan.h       |  4 +++
 4 files changed, 45 insertions(+), 38 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +11 -38
index 53cecb892a84..caa85442c12d 100644
@@ -1725,59 +1725,38 @@ int wilc_netdev_init(void)
 	return 0;
 }
 
-/*The 1st function called after module inserted*/
-static int __init init_wilc_driver(void)
+void __init wilc1000_init_driver(void)
 {
 #if defined(WILC_DEBUGFS)
-	if (wilc_debugfs_init() < 0) {
+	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())
-		PRINT_ER("Couldn't initialize netdev\n");
-	return 0;
-#endif
 }
-late_initcall(init_wilc_driver);
 
-static void __exit exit_wilc_driver(void)
+void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
 {
 	int i = 0;
 	perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
 	#define CLOSE_TIMEOUT (12 * 1000)
 
-	if ((wilc1000_dev != NULL) && (((wilc1000_dev->strInterfaceInfo[0].wilc_netdev) != NULL)
-				       || ((wilc1000_dev->strInterfaceInfo[1].wilc_netdev) != NULL))) {
+	if (wilc1000_dev->strInterfaceInfo[0].wilc_netdev ||
+	    wilc1000_dev->strInterfaceInfo[1].wilc_netdev) {
 		unregister_inetaddr_notifier(&g_dev_notifier);
 
 		for (i = 0; i < NUM_CONCURRENT_IFC; i++)
 			nic[i] = netdev_priv(wilc1000_dev->strInterfaceInfo[i].wilc_netdev);
 	}
 
-	if ((wilc1000_dev != NULL) && wilc1000_dev->wilc_firmware != NULL) {
+	if (wilc1000_dev->wilc_firmware) {
 		release_firmware(wilc1000_dev->wilc_firmware);
 		wilc1000_dev->wilc_firmware = NULL;
 	}
 
-	if ((wilc1000_dev != NULL) && (((wilc1000_dev->strInterfaceInfo[0].wilc_netdev) != NULL)
-				       || ((wilc1000_dev->strInterfaceInfo[1].wilc_netdev) != NULL))) {
+	if (wilc1000_dev->strInterfaceInfo[0].wilc_netdev ||
+	    wilc1000_dev->strInterfaceInfo[1].wilc_netdev) {
 		PRINT_D(INIT_DBG, "Waiting for wilc1000_mac_close ....\n");
 
 		if (linux_wlan_lock_timeout(&close_exit_sync, CLOSE_TIMEOUT) < 0)
@@ -1801,15 +1780,10 @@ static void __exit exit_wilc_driver(void)
 			free_netdev(wilc1000_dev->strInterfaceInfo[i].wilc_netdev);
 		}
 	}
+}
 
-#ifndef WILC_SDIO
-	PRINT_D(INIT_DBG, "SPI unregsiter...\n");
-	spi_unregister_driver(&wilc_bus);
-#else
-	PRINT_D(INIT_DBG, "SDIO unregsiter...\n");
-	sdio_unregister_driver(&wilc_bus);
-#endif
-
+void __exit wilc1000_exit_driver(void)
+{
 	kfree(wilc1000_dev);
 	wilc1000_dev = NULL;
 	printk("Module_exit Done.\n");
@@ -1818,6 +1792,5 @@ static void __exit exit_wilc_driver(void)
 	wilc_debugfs_remove();
 #endif
 }
-module_exit(exit_wilc_driver);
 
 MODULE_LICENSE("GPL");
drivers/staging/wilc1000/linux_wlan_sdio.c +14 -0
index 4e8c4e6d499e..badcae57875c 100644
@@ -237,4 +237,18 @@ int wilc1000_sdio_set_default_speed(void)
 }
 
 
+static int __init init_wilc_sdio_driver(void)
+{
+	wilc1000_init_driver();
+	return sdio_register_driver(&wilc_bus);
+}
+late_initcall(init_wilc_sdio_driver);
 
+static void __exit exit_wilc_sdio_driver(void)
+{
+	if (wilc1000_dev)
+		wilc_netdev_free(wilc1000_dev);
+	sdio_unregister_driver(&wilc_bus);
+	wilc1000_exit_driver();
+}
+module_exit(exit_wilc_sdio_driver);
drivers/staging/wilc1000/linux_wlan_spi.c +16 -0
index 43cfeda97030..c90b741824dc 100644
@@ -406,3 +406,19 @@ int wilc1000_spi_set_max_speed(void)
 	PRINT_INFO(BUS_DBG, "@@@@@@@@@@@@ change SPI speed to %d @@@@@@@@@\n", SPEED);
 	return 1;
 }
+
+static int __init init_wilc_spi_driver(void)
+{
+	wilc1000_init_driver();
+	return wilc_netdev_init();
+}
+late_initcall(init_wilc_spi_driver);
+
+static void __exit exit_wilc_spi_driver(void)
+{
+	if (wilc1000_dev)
+		wilc_netdev_free(wilc1000_dev);
+	spi_unregister_driver(&wilc_bus);
+	wilc1000_exit_driver();
+}
+module_exit(exit_wilc_spi_driver);
drivers/staging/wilc1000/wilc_wlan.h +4 -0
index 4460c482cb7a..dd312b0b1abf 100644
@@ -321,6 +321,8 @@ void wilc1000_chip_sleep_manually(u32 u32SleepTime);
 int wilc1000_wlan_get_num_conn_ifcs(void);
 int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
 int wilc_netdev_init(void);
+void __exit wilc_netdev_free(struct wilc *wilc1000_dev);
+
 void wilc_handle_isr(void);
 
 u16 wilc1000_set_machw_change_vir_if(bool bValue);
@@ -337,5 +339,7 @@ u8 wilc1000_core_11b_ready(void);
 extern bool wilc1000_enable_ps;
 extern volatile int wilc1000_probe;
 
+void __init wilc1000_init_driver(void);
+void __exit wilc1000_exit_driver(void);
 
 #endif
Signature · 1 line
2.1.0.rc2
#11 lore raw

PATCH 10/19 staging/wilc1000: unify device pointer

In reply to Arnd Bergmann

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

---
 drivers/staging/wilc1000/linux_wlan.c         | 29 +++++----------------------
 drivers/staging/wilc1000/linux_wlan_sdio.c    |  5 +++--
 drivers/staging/wilc1000/linux_wlan_spi.c     | 17 +++++++++++++++-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  6 +-----
 4 files changed, 25 insertions(+), 32 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +5 -24
index caa85442c12d..4ca045bcf537 100644
@@ -474,19 +474,11 @@ int wilc1000_wlan_get_firmware(perInterface_wlan_t *p_nic)
 	/*	the firmare should be located in /lib/firmware in
 	 *      root file system with the name specified above */
 
-#ifdef WILC_SDIO
-	if (request_firmware(&wilc_firmware, firmware, &wilc1000_dev->wilc_sdio_func->dev) != 0) {
+	if (request_firmware(&wilc_firmware, firmware, wilc1000_dev->dev) != 0) {
 		PRINT_ER("%s - firmare not available\n", firmware);
 		ret = -1;
 		goto _fail_;
 	}
-#else
-	if (request_firmware(&wilc_firmware, firmware, &wilc1000_dev->wilc_spidev->dev) != 0) {
-		PRINT_ER("%s - firmare not available\n", firmware);
-		ret = -1;
-		goto _fail_;
-	}
-#endif
 	wilc1000_dev->wilc_firmware = wilc_firmware;
 
 _fail_:
@@ -1008,7 +1000,7 @@ static u8 wilc1000_prepare_11b_core(struct wilc *nic)
 		while (!wilc1000_probe)
 			msleep(100);
 		wilc1000_probe = 0;
-		wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
+		wilc1000_dev->dev = &wilc1000_sdio_func->dev;
 		nic->ops = &wilc1000_sdio_ops;
 		wilc_wlan_init(nic);
 	}
@@ -1031,7 +1023,7 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
 	while (!wilc1000_probe)
 		msleep(100);
 	wilc1000_probe = 0;
-	wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
+	wilc1000_dev->dev = &wilc1000_sdio_func->dev;
 	wilc1000_dev->ops = &wilc1000_sdio_ops;
 	ret = wilc_wlan_init(wilc1000_dev);
 
@@ -1214,12 +1206,11 @@ int wilc1000_mac_open(struct net_device *ndev)
 	int i = 0;
 	struct wilc_priv *priv;
 
-#ifdef WILC_SPI
-	if (!wilc1000_dev || !wilc1000_dev->wilc_spidev) {
+	if (!wilc1000_dev || !wilc1000_dev->dev) {
 		netdev_err(ndev, "wilc1000: SPI device not ready\n");
 		return -ENODEV;
 	}
-#endif
+
 	nic = netdev_priv(ndev);
 	priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
 	PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev);
@@ -1712,16 +1703,6 @@ int wilc_netdev_init(void)
 
 	}
 
-	#ifndef WILC_SDIO
-	if (!wilc1000_spi_init(&wilc1000_dev->wilc_spidev)) {
-		PRINT_ER("Can't initialize SPI\n");
-		return -1; /* ERROR */
-	}
-	wilc1000_dev->wilc_spidev = wilc_spi_dev;
-	#else
-	wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
-	#endif
-
 	return 0;
 }
 
drivers/staging/wilc1000/linux_wlan_sdio.c +3 -2
index badcae57875c..a6ae26739dd8 100644
@@ -46,7 +46,7 @@ static void wilc_sdio_interrupt(struct sdio_func *func)
 
 int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
 {
-	struct sdio_func *func = wilc1000_dev->wilc_sdio_func;
+	struct sdio_func *func = container_of(wilc1000_dev->dev, struct sdio_func, dev);
 	int ret;
 	u8 data;
 
@@ -78,7 +78,7 @@ int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
 
 int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd)
 {
-	struct sdio_func *func = wilc1000_dev->wilc_sdio_func;
+	struct sdio_func *func = container_of(wilc1000_dev->dev, struct sdio_func, dev);
 	int size, ret;
 
 	sdio_claim_host(func);
@@ -126,6 +126,7 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
 		PRINT_ER("Couldn't initialize netdev\n");
 		return -1;
 	}
+	wilc1000_dev->dev = &wilc1000_sdio_func->dev;
 
 	printk("Driver Initializing success\n");
 	return 0;
drivers/staging/wilc1000/linux_wlan_spi.c +16 -1
index c90b741824dc..b5e9a1b9f509 100644
@@ -9,8 +9,11 @@
 #include <linux/device.h>
 #include <linux/spi/spi.h>
 
+#include "wilc_wfi_netdevice.h"
 #include "linux_wlan_common.h"
 #include "linux_wlan_spi.h"
+#include "wilc_wlan_if.h"
+#include "wilc_wlan.h"
 
 #define USE_SPI_DMA     0       /* johnny add */
 
@@ -409,8 +412,20 @@ int wilc1000_spi_set_max_speed(void)
 
 static int __init init_wilc_spi_driver(void)
 {
+	int ret;
+
 	wilc1000_init_driver();
-	return wilc_netdev_init();
+	ret = wilc_netdev_init();
+	if (ret)
+		return ret;
+
+	if (!wilc1000_spi_init(NULL)) {
+		PRINT_ER("Can't initialize SPI\n");
+		return -ENXIO;
+	}
+	wilc1000_dev->dev = &wilc_spi_dev->dev;
+
+	return ret;
 }
 late_initcall(init_wilc_spi_driver);
 
drivers/staging/wilc1000/wilc_wfi_netdevice.h +1 -5
index 485df4768e78..1e5e7dcee11d 100644
@@ -185,11 +185,7 @@ struct wilc {
 
 	const struct firmware *wilc_firmware;
 
-#ifdef WILC_SDIO
-	struct sdio_func *wilc_sdio_func;
-#else
-	struct spi_device *wilc_spidev;
-#endif
+	struct device *dev;
 };
 
 typedef struct {
Signature · 1 line
2.1.0.rc2
#12 lore raw

PATCH 11/19 staging/wilc1000: move wilc1000_ops to drivers

In reply to Arnd Bergmann

The two instances of struct wilc1000_ops reference functions that are defined in just one file each. By moving the operations there, we can mark all those functions as 'static' and avoid a number of #ifdefs.

---
 drivers/staging/wilc1000/linux_wlan.c      | 43 ++++--------------------------
 drivers/staging/wilc1000/linux_wlan_sdio.c | 24 ++++++++++++-----
 drivers/staging/wilc1000/linux_wlan_sdio.h | 11 +++-----
 drivers/staging/wilc1000/linux_wlan_spi.c  | 29 +++++++++++++-------
 drivers/staging/wilc1000/linux_wlan_spi.h  |  8 ------
 drivers/staging/wilc1000/wilc_wlan.h       |  2 +-
 6 files changed, 45 insertions(+), 72 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +5 -38
index 4ca045bcf537..aa6f5c7db139 100644
@@ -26,11 +26,7 @@
 #include <linux/version.h>
 #include <linux/semaphore.h>
 
-#ifdef WILC_SDIO
 #include "linux_wlan_sdio.h"
-#else
-#include "linux_wlan_spi.h"
-#endif
 
 static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr);
 
@@ -915,30 +911,6 @@ static int wlan_deinit_locks(struct wilc *nic)
 	return 0;
 }
 
-#ifdef WILC_SDIO
-static const struct wilc1000_ops wilc1000_sdio_ops = {
-	.io_type = HIF_SDIO,
-	.io_init = wilc1000_sdio_init,
-	.io_deinit = wilc1000_sdio_deinit,
-	.u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52,
-	.u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53,
-	.u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed,
-	.u.sdio.sdio_set_default_speed = wilc1000_sdio_set_default_speed,
-};
-#endif
-
-#ifdef WILC_SPI
-static const struct wilc1000_ops wilc1000_spi_ops = {
-	.io_type = HIF_SPI,
-	.io_init = wilc1000_spi_init,
-	.io_deinit = wilc1000_spi_deinit,
-	.u.spi.spi_tx = wilc1000_spi_write,
-	.u.spi.spi_rx = wilc1000_spi_read,
-	.u.spi.spi_trx = wilc1000_spi_write_read,
-	.u.spi.spi_max_speed = wilc1000_spi_set_max_speed,
-};
-#endif
-
 static int wlan_initialize_threads(perInterface_wlan_t *nic)
 {
 
@@ -1065,12 +1037,6 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 
 		wlan_init_locks(wilc1000_dev);
 
-#ifdef WILC_SDIO
-		wilc1000_dev->ops = &wilc1000_sdio_ops;
-#else
-		wilc1000_dev->ops = &wilc1000_spi_ops;
-#endif
-
 		ret = wilc_wlan_init(wilc1000_dev);
 		if (ret < 0) {
 			PRINT_ER("Initializing WILC_Wlan FAILED\n");
@@ -1622,7 +1588,7 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
 		WILC_WFI_p2p_rx(wilc1000_dev->strInterfaceInfo[1].wilc_netdev, buff, size);
 }
 
-int wilc_netdev_init(void)
+int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops)
 {
 
 	int i;
@@ -1636,6 +1602,8 @@ int wilc_netdev_init(void)
 	if (!wilc1000_dev)
 		return -ENOMEM;
 
+	wilc1000_dev->ops = ops;
+
 	register_inetaddr_notifier(&g_dev_notifier);
 
 	for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
@@ -1672,10 +1640,9 @@ int wilc_netdev_init(void)
 			/*Register WiFi*/
 			wdev = wilc_create_wiphy(ndev);
 
-			#ifdef WILC_SDIO
 			/* set netdev, tony */
-			SET_NETDEV_DEV(ndev, &wilc1000_sdio_func->dev);
-			#endif
+			if (dev)
+				SET_NETDEV_DEV(ndev, dev);
 
 			if (wdev == NULL) {
 				PRINT_ER("Can't register WILC Wiphy\n");
drivers/staging/wilc1000/linux_wlan_sdio.c +17 -7
index a6ae26739dd8..429bdc85ed62 100644
@@ -1,4 +1,5 @@
 #include "wilc_wfi_netdevice.h"
+#include "linux_wlan_sdio.h"
 
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/card.h>
@@ -44,7 +45,7 @@ static void wilc_sdio_interrupt(struct sdio_func *func)
 #endif
 
 
-int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
+static int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
 {
 	struct sdio_func *func = container_of(wilc1000_dev->dev, struct sdio_func, dev);
 	int ret;
@@ -76,7 +77,7 @@ int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
 }
 
 
-int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd)
+static int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd)
 {
 	struct sdio_func *func = container_of(wilc1000_dev->dev, struct sdio_func, dev);
 	int size, ret;
@@ -122,7 +123,7 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
 #endif
 	PRINT_D(INIT_DBG, "Initializing netdev\n");
 	wilc1000_sdio_func = func;
-	if (wilc_netdev_init()) {
+	if (wilc_netdev_init(&func->dev, &wilc1000_sdio_ops)) {
 		PRINT_ER("Couldn't initialize netdev\n");
 		return -1;
 	}
@@ -204,7 +205,7 @@ static int linux_sdio_get_speed(void)
 	return wilc1000_sdio_func->card->host->ios.clock;
 }
 
-int wilc1000_sdio_init(void *pv)
+static int wilc1000_sdio_init(void *pv)
 {
 
 	/**
@@ -216,7 +217,7 @@ int wilc1000_sdio_init(void *pv)
 	return 1;
 }
 
-void wilc1000_sdio_deinit(void *pv)
+static void wilc1000_sdio_deinit(void *pv)
 {
 
 	/**
@@ -227,16 +228,25 @@ void wilc1000_sdio_deinit(void *pv)
 	sdio_unregister_driver(&wilc_bus);
 }
 
-int wilc1000_sdio_set_max_speed(void)
+static int wilc1000_sdio_set_max_speed(void)
 {
 	return linux_sdio_set_speed(MAX_SPEED);
 }
 
-int wilc1000_sdio_set_default_speed(void)
+static int wilc1000_sdio_set_default_speed(void)
 {
 	return linux_sdio_set_speed(sdio_default_speed);
 }
 
+const struct wilc1000_ops wilc1000_sdio_ops = {
+	.io_type = HIF_SDIO,
+	.io_init = wilc1000_sdio_init,
+	.io_deinit = wilc1000_sdio_deinit,
+	.u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52,
+	.u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53,
+	.u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed,
+	.u.sdio.sdio_set_default_speed = wilc1000_sdio_set_default_speed,
+};
 
 static int __init init_wilc_sdio_driver(void)
 {
drivers/staging/wilc1000/linux_wlan_sdio.h +3 -8
index ff0a37b880c2..de79aff9f11c 100644
@@ -1,14 +1,9 @@
+#include <linux/mmc/sdio_func.h>
+
 extern struct sdio_func *wilc1000_sdio_func;
 extern struct sdio_driver wilc_bus;
+extern const struct wilc1000_ops wilc1000_sdio_ops;
 
-#include <linux/mmc/sdio_func.h>
-
-int wilc1000_sdio_init(void *);
-void wilc1000_sdio_deinit(void *);
-int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd);
-int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd);
 int wilc1000_sdio_enable_interrupt(void);
 void wilc1000_sdio_disable_interrupt(void);
-int wilc1000_sdio_set_max_speed(void);
-int wilc1000_sdio_set_default_speed(void);
 
drivers/staging/wilc1000/linux_wlan_spi.c +19 -10
index b5e9a1b9f509..788531e314c3 100644
@@ -11,7 +11,6 @@
 
 #include "wilc_wfi_netdevice.h"
 #include "linux_wlan_common.h"
-#include "linux_wlan_spi.h"
 #include "wilc_wlan_if.h"
 #include "wilc_wlan.h"
 
@@ -83,7 +82,7 @@ struct spi_driver wilc_bus __refdata = {
 };
 
 
-void wilc1000_spi_deinit(void *vp)
+static void wilc1000_spi_deinit(void *vp)
 {
 
 	spi_unregister_driver(&wilc_bus);
@@ -95,7 +94,7 @@ void wilc1000_spi_deinit(void *vp)
 
 
 
-int wilc1000_spi_init(void *vp)
+static int wilc1000_spi_init(void *vp)
 {
 	int ret = 1;
 	static int called;
@@ -118,7 +117,7 @@ int wilc1000_spi_init(void *vp)
 
 #if defined(TXRX_PHASE_SIZE)
 
-int wilc1000_spi_write(u8 *b, u32 len)
+static int wilc1000_spi_write(u8 *b, u32 len)
 {
 	int ret;
 
@@ -195,7 +194,7 @@ int wilc1000_spi_write(u8 *b, u32 len)
 }
 
 #else
-int wilc1000_spi_write(u8 *b, u32 len)
+static int wilc1000_spi_write(u8 *b, u32 len)
 {
 
 	int ret;
@@ -246,7 +245,7 @@ int wilc1000_spi_write(u8 *b, u32 len)
 
 #if defined(TXRX_PHASE_SIZE)
 
-int wilc1000_spi_read(u8 *rb, u32 rlen)
+static int wilc1000_spi_read(u8 *rb, u32 rlen)
 {
 	int ret;
 
@@ -320,7 +319,7 @@ int wilc1000_spi_read(u8 *rb, u32 rlen)
 }
 
 #else
-int wilc1000_spi_read(u8 *rb, u32 rlen)
+static int wilc1000_spi_read(u8 *rb, u32 rlen)
 {
 
 	int ret;
@@ -365,7 +364,7 @@ int wilc1000_spi_read(u8 *rb, u32 rlen)
 
 #endif
 
-int wilc1000_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
+static int wilc1000_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
 {
 
 	int ret;
@@ -402,7 +401,7 @@ int wilc1000_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
 	return ret;
 }
 
-int wilc1000_spi_set_max_speed(void)
+static int wilc1000_spi_set_max_speed(void)
 {
 	SPEED = MAX_SPEED;
 
@@ -410,12 +409,22 @@ int wilc1000_spi_set_max_speed(void)
 	return 1;
 }
 
+static const struct wilc1000_ops wilc1000_spi_ops = {
+	.io_type = HIF_SPI,
+	.io_init = wilc1000_spi_init,
+	.io_deinit = wilc1000_spi_deinit,
+	.u.spi.spi_tx = wilc1000_spi_write,
+	.u.spi.spi_rx = wilc1000_spi_read,
+	.u.spi.spi_trx = wilc1000_spi_write_read,
+	.u.spi.spi_max_speed = wilc1000_spi_set_max_speed,
+};
+
 static int __init init_wilc_spi_driver(void)
 {
 	int ret;
 
 	wilc1000_init_driver();
-	ret = wilc_netdev_init();
+	ret = wilc_netdev_init(NULL, &wilc1000_spi_ops);
 	if (ret)
 		return ret;
 
drivers/staging/wilc1000/linux_wlan_spi.h +0 -8
index efa95e3e8bfe..aa259c8ee12a 100644
@@ -2,13 +2,5 @@
 #define LINUX_WLAN_SPI_H
 
 #include <linux/spi/spi.h>
-extern struct spi_device *wilc_spi_dev;
-extern struct spi_driver wilc_bus;
 
-int wilc1000_spi_init(void *vp);
-void wilc1000_spi_deinit(void *vp);
-int wilc1000_spi_write(u8 *b, u32 len);
-int wilc1000_spi_read(u8 *rb, u32 rlen);
-int wilc1000_spi_write_read(u8 *wb, u8 *rb, u32 rlen);
-int wilc1000_spi_set_max_speed(void);
 #endif
drivers/staging/wilc1000/wilc_wlan.h +1 -1
index dd312b0b1abf..8c5253cce97c 100644
@@ -320,7 +320,7 @@ void wilc1000_enable_tcp_ack_filter(bool value);
 void wilc1000_chip_sleep_manually(u32 u32SleepTime);
 int wilc1000_wlan_get_num_conn_ifcs(void);
 int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-int wilc_netdev_init(void);
+int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops);
 void __exit wilc_netdev_free(struct wilc *wilc1000_dev);
 
 void wilc_handle_isr(void);
Signature · 1 line
2.1.0.rc2
#13 lore raw

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

In reply to Arnd Bergmann

wilc_create_wiphy tries to get a pointer to a device from the global wilc1000_sdio_func variable. This is a layering violation and we can use the wilc1000_dev->dev pointer instead.

---
 drivers/staging/wilc1000/linux_wlan.c             | 2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 9 ++-------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 +-
 drivers/staging/wilc1000/wilc_wlan.h              | 1 +
 4 files changed, 5 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +1 -1
index aa6f5c7db139..abcb70bb1bd7 100644
@@ -1638,7 +1638,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops)
 		{
 			struct wireless_dev *wdev;
 			/*Register WiFi*/
-			wdev = wilc_create_wiphy(ndev);
+			wdev = wilc_create_wiphy(ndev, wilc1000_dev->dev);
 
 			/* set netdev, tony */
 			if (dev)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +2 -7
index 702c40c1df4b..7405fb8bae42 100644
@@ -11,9 +11,6 @@
  */
 
 #include "wilc_wfi_cfgoperations.h"
-#ifdef WILC_SDIO
-#include "linux_wlan_sdio.h"
-#endif
 #include "host_interface.h"
 #include <linux/errno.h>
 
@@ -3379,7 +3376,7 @@ _fail_:
  *  @date	01 MAR 2012
  *  @version	1.0
  */
-struct wireless_dev *wilc_create_wiphy(struct net_device *net)
+struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev)
 {
 	struct wilc_priv *priv;
 	struct wireless_dev *wdev;
@@ -3431,9 +3428,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net)
 		   wdev->wiphy->max_scan_ssids, wdev->wiphy->max_scan_ie_len, wdev->wiphy->signal_type,
 		   wdev->wiphy->interface_modes, wdev->iftype);
 
-	#ifdef WILC_SDIO
-	set_wiphy_dev(wdev->wiphy, &wilc1000_sdio_func->dev);
-	#endif
+	set_wiphy_dev(wdev->wiphy, dev);
 
 	/*Register wiphy structure*/
 	s32Error = wiphy_register(wdev->wiphy);
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +1 -1
index 158d98c0eb87..ab53d9d59081 100644
@@ -10,7 +10,7 @@
 #define NM_WFI_CFGOPERATIONS
 #include "wilc_wfi_netdevice.h"
 
-struct wireless_dev *wilc_create_wiphy(struct net_device *net);
+struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev);
 void wilc_free_wiphy(struct net_device *net);
 int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed);
 int wilc_deinit_host_int(struct net_device *net);
drivers/staging/wilc1000/wilc_wlan.h +1 -0
index 8c5253cce97c..2297e31b5b75 100644
@@ -2,6 +2,7 @@
 #define WILC_WLAN_H
 
 #include <linux/types.h>
+#include <linux/netdevice.h>
 
 #define ISWILC1000(id)   (((id & 0xfffff000) == 0x100000) ? 1 : 0)
 
Signature · 1 line
2.1.0.rc2
#14 lore raw

PATCH 13/19 staging/wilc1000: move COMPLEMENT_BOOT code to linux_wlan_sdio.c

In reply to Arnd Bergmann

The COMPLEMENT_BOOT code is used only for SDIO and is aware of details of the SDIO implementation that don't belong into the common linux_wlan.c file.

This moves the functions to linux_wlan_sdio.c to get them out of the way.

---
 drivers/staging/wilc1000/linux_wlan.c         | 95 +++------------------------
 drivers/staging/wilc1000/linux_wlan_sdio.c    | 89 +++++++++++++++++++++++--
 drivers/staging/wilc1000/linux_wlan_sdio.h    |  4 --
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 drivers/staging/wilc1000/wilc_wlan.h          |  4 +-
 drivers/staging/wilc1000/wilc_wlan_if.h       |  5 ++
 6 files changed, 103 insertions(+), 96 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +9 -86
index abcb70bb1bd7..980c2c8d300d 100644
@@ -483,11 +483,7 @@ _fail_:
 
 }
 
-#ifdef COMPLEMENT_BOOT
-static int repeat_power_cycle(perInterface_wlan_t *nic);
-#endif
-
-static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
+int wilc1000_start_firmware(perInterface_wlan_t *nic)
 {
 
 	int ret = 0;
@@ -502,19 +498,17 @@ static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
 	/* wait for mac ready */
 	PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n");
 	ret = linux_wlan_lock_timeout(&wilc1000_dev->sync_event, 5000);
-	if (ret) {
-#ifdef COMPLEMENT_BOOT
+	if (ret && wilc1000_dev->ops->repeat_power_cycle) {
 		static int timeout = 5;
 
 		if (timeout--) {
 			PRINT_D(INIT_DBG, "repeat power cycle[%d]", timeout);
-			ret = repeat_power_cycle(nic);
+			ret = wilc1000_dev->ops->repeat_power_cycle(nic);
 		} else {
 			timeout = 5;
 			ret = -1;
 			goto _fail_;
 		}
-#endif
 		PRINT_D(INIT_DBG, "Firmware start timed out");
 		goto _fail_;
 	}
@@ -527,7 +521,8 @@ static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
 _fail_:
 	return ret;
 }
-static int linux_wlan_firmware_download(struct wilc *p_nic)
+
+int wilc1000_firmware_download(struct wilc *p_nic)
 {
 
 	int ret = 0;
@@ -954,77 +949,6 @@ static void wlan_deinitialize_threads(struct wilc *nic)
 	}
 }
 
-#ifdef COMPLEMENT_BOOT
-
-#define READY_CHECK_THRESHOLD		30
-static u8 wilc1000_prepare_11b_core(struct wilc *nic)
-{
-	u8 trials = 0;
-
-	while ((wilc1000_core_11b_ready() && (READY_CHECK_THRESHOLD > (trials++)))) {
-		PRINT_D(INIT_DBG, "11b core not ready yet: %u\n", trials);
-		wilc_wlan_cleanup();
-		wilc_wlan_global_reset();
-		sdio_unregister_driver(&wilc_bus);
-
-		sdio_register_driver(&wilc_bus);
-
-		while (!wilc1000_probe)
-			msleep(100);
-		wilc1000_probe = 0;
-		wilc1000_dev->dev = &wilc1000_sdio_func->dev;
-		nic->ops = &wilc1000_sdio_ops;
-		wilc_wlan_init(nic);
-	}
-
-	if (READY_CHECK_THRESHOLD <= trials)
-		return 1;
-	else
-		return 0;
-
-}
-
-static int repeat_power_cycle(perInterface_wlan_t *nic)
-{
-	int ret = 0;
-	sdio_unregister_driver(&wilc_bus);
-
-	sdio_register_driver(&wilc_bus);
-
-	/* msleep(1000); */
-	while (!wilc1000_probe)
-		msleep(100);
-	wilc1000_probe = 0;
-	wilc1000_dev->dev = &wilc1000_sdio_func->dev;
-	wilc1000_dev->ops = &wilc1000_sdio_ops;
-	ret = wilc_wlan_init(wilc1000_dev);
-
-	wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
-	#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
-	wilc1000_sdio_enable_interrupt();
-	#endif
-
-	if (wilc1000_wlan_get_firmware(nic)) {
-		PRINT_ER("Can't get firmware\n");
-		ret = -1;
-		goto __fail__;
-	}
-
-	/*Download firmware*/
-	ret = linux_wlan_firmware_download(wilc1000_dev);
-	if (ret < 0) {
-		PRINT_ER("Failed to download firmware\n");
-		goto __fail__;
-	}
-	/* Start firmware*/
-	ret = linux_wlan_start_firmware(nic);
-	if (ret < 0)
-		PRINT_ER("Failed to start firmware\n");
-__fail__:
-	return ret;
-}
-#endif
-
 int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 {
 	perInterface_wlan_t *nic = p_nic;
@@ -1051,13 +975,12 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 			goto _fail_wilc_wlan_;
 		}
 
-#if (defined WILC_SDIO) && (defined COMPLEMENT_BOOT)
-		if (wilc1000_prepare_11b_core(wilc1000_dev)) {
+		if (wilc1000_dev->ops->prepare_11b_core &&
+		    wilc1000_dev->ops->prepare_11b_core(wilc1000_dev)) {
 			PRINT_ER("11b Core is not ready\n");
 			ret = -EIO;
 			goto _fail_threads_;
 		}
-#endif
 
 #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
 		if (init_irq(wilc1000_dev)) {
@@ -1082,7 +1005,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 		}
 
 		/*Download firmware*/
-		ret = linux_wlan_firmware_download(wilc1000_dev);
+		ret = wilc1000_firmware_download(wilc1000_dev);
 		if (ret < 0) {
 			PRINT_ER("Failed to download firmware\n");
 			ret = -EIO;
@@ -1090,7 +1013,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 		}
 
 		/* Start firmware*/
-		ret = linux_wlan_start_firmware(nic);
+		ret = wilc1000_start_firmware(nic);
 		if (ret < 0) {
 			PRINT_ER("Failed to start firmware\n");
 			ret = -EIO;
drivers/staging/wilc1000/linux_wlan_sdio.c +85 -4

121 lines not on this page · raw message

drivers/staging/wilc1000/linux_wlan_sdio.h +0 -4
index de79aff9f11c..b4995a3211c7 100644
@@ -1,9 +1,5 @@
 #include <linux/mmc/sdio_func.h>
 
-extern struct sdio_func *wilc1000_sdio_func;
-extern struct sdio_driver wilc_bus;
-extern const struct wilc1000_ops wilc1000_sdio_ops;
-
 int wilc1000_sdio_enable_interrupt(void);
 void wilc1000_sdio_disable_interrupt(void);
 
drivers/staging/wilc1000/wilc_wfi_netdevice.h +1 -1
index 1e5e7dcee11d..ec5a8b1215b7 100644
@@ -188,7 +188,7 @@ struct wilc {
 	struct device *dev;
 };
 
-typedef struct {
+typedef struct wilc_per_interface {
 	u8 u8IfIdx;
 	u8 iftype;
 	int monitor_flag;
drivers/staging/wilc1000/wilc_wlan.h +3 -1
index 2297e31b5b75..10b2a2f9e1b2 100644
@@ -338,7 +338,9 @@ void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
 u8 wilc1000_core_11b_ready(void);
 
 extern bool wilc1000_enable_ps;
-extern volatile int wilc1000_probe;
+
+int wilc1000_firmware_download(struct wilc *p_nic);
+int wilc1000_start_firmware(struct wilc_per_interface *nic);
 
 void __init wilc1000_init_driver(void);
 void __exit wilc1000_exit_driver(void);
drivers/staging/wilc1000/wilc_wlan_if.h +5 -0
index bfa1291e22ed..a4befcb74c82 100644
@@ -71,10 +71,15 @@ typedef struct {
 	u32 block_size;
 } sdio_cmd53_t;
 
+struct wilc;
+struct wilc_per_interface;
 struct wilc1000_ops {
 	int io_type;
 	int (*io_init)(void *);
 	void (*io_deinit)(void *);
+	int (*repeat_power_cycle)(struct wilc_per_interface *nic);
+	u8 (*prepare_11b_core)(struct wilc *nic);
+
 	union {
 		struct {
 			int (*sdio_cmd52)(sdio_cmd52_t *);
Signature · 1 line
2.1.0.rc2
#15 lore raw

PATCH 14/19 staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO

In reply to Arnd Bergmann

Whether the SDIO function uses an internal or external interrupt should not be a compiletime decision but be determined at runtime.

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

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

---
 drivers/staging/wilc1000/Makefile             |   1 -
 drivers/staging/wilc1000/linux_wlan.c         |  66 +++++++---------
 drivers/staging/wilc1000/linux_wlan_sdio.c    |  26 ++++---
 drivers/staging/wilc1000/linux_wlan_spi.c     |   2 +-
 drivers/staging/wilc1000/wilc_sdio.c          | 105 +++++++++++---------------
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |   5 +-
 drivers/staging/wilc1000/wilc_wlan.c          |   8 +-
 drivers/staging/wilc1000/wilc_wlan.h          |   2 +-
 8 files changed, 94 insertions(+), 121 deletions(-)
drivers/staging/wilc1000/Makefile +0 -1
index 55b2ac2b15a8..b96fee8f94f2 100644
@@ -1,7 +1,6 @@
 obj-$(CONFIG_WILC1000) += wilc1000.o
 
 ccflags-$(CONFIG_WILC1000_SDIO) += -DWILC_SDIO -DCOMPLEMENT_BOOT
-ccflags-$(CONFIG_WILC1000_HW_OOB_INTR) += -DWILC_SDIO_IRQ_GPIO
 ccflags-$(CONFIG_WILC1000_SPI) += -DWILC_SPI
 
 ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
drivers/staging/wilc1000/linux_wlan.c +28 -38

152 lines not on this page · raw message

drivers/staging/wilc1000/linux_wlan_sdio.c +14 -12
index bb4a3acf16d0..64c8c5725277 100644
@@ -7,6 +7,7 @@
 #include <linux/mmc/sdio_ids.h>
 #include <linux/mmc/sdio.h>
 #include <linux/mmc/host.h>
+#include <linux/of_gpio.h>
 
 
 
@@ -36,15 +37,12 @@ static const struct sdio_device_id wilc_sdio_ids[] = {
 };
 
 
-#ifndef WILC_SDIO_IRQ_GPIO
 static void wilc_sdio_interrupt(struct sdio_func *func)
 {
 	sdio_release_host(func);
 	wilc_handle_isr();
 	sdio_claim_host(func);
 }
-#endif
-
 
 static int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
 {
@@ -161,9 +159,8 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
 	ret = wilc_wlan_init(wilc1000_dev);
 
 	wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
-#if !defined WILC_SDIO_IRQ_GPIO
-	wilc1000_sdio_enable_interrupt();
-#endif
+	if (wilc1000_dev->gpio < 0)
+		wilc1000_sdio_enable_interrupt();
 
 	if (wilc1000_wlan_get_firmware(nic)) {
 		PRINT_ER("Can't get firmware\n");
@@ -188,6 +185,8 @@ __fail__:
 
 static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
 {
+	int gpio;
+
 	PRINT_D(INIT_DBG, "probe function\n");
 
 #ifdef COMPLEMENT_BOOT
@@ -198,9 +197,17 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
 		return 0;
 	}
 #endif
+
+	gpio = -1;
+	if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) {
+		gpio = of_get_gpio(func->dev.of_node, 0);
+		if (gpio < 0)
+			gpio = GPIO_NUM;
+	}
+
 	PRINT_D(INIT_DBG, "Initializing netdev\n");
 	wilc1000_sdio_func = func;
-	if (wilc_netdev_init(&func->dev, &wilc1000_sdio_ops)) {
+	if (wilc_netdev_init(&func->dev, &wilc1000_sdio_ops, gpio)) {
 		PRINT_ER("Couldn't initialize netdev\n");
 		return -1;
 	}
@@ -228,7 +235,6 @@ static struct sdio_driver wilc_bus = {
 int wilc1000_sdio_enable_interrupt(void)
 {
 	int ret = 0;
-#ifndef WILC_SDIO_IRQ_GPIO
 
 	sdio_claim_host(wilc1000_sdio_func);
 	ret = sdio_claim_irq(wilc1000_sdio_func, wilc_sdio_interrupt);
@@ -238,14 +244,11 @@ int wilc1000_sdio_enable_interrupt(void)
 		PRINT_ER("can't claim sdio_irq, err(%d)\n", ret);
 		ret = -EIO;
 	}
-#endif
 	return ret;
 }
 
 void wilc1000_sdio_disable_interrupt(void)
 {
-
-#ifndef WILC_SDIO_IRQ_GPIO
 	int ret;
 
 	PRINT_D(INIT_DBG, "wilc1000_sdio_disable_interrupt IN\n");
@@ -258,7 +261,6 @@ void wilc1000_sdio_disable_interrupt(void)
 	sdio_release_host(wilc1000_sdio_func);
 
 	PRINT_D(INIT_DBG, "wilc1000_sdio_disable_interrupt OUT\n");
-#endif
 }
 
 static int linux_sdio_set_speed(int speed)
drivers/staging/wilc1000/linux_wlan_spi.c +1 -1
index 788531e314c3..c6ea3ef0664f 100644
@@ -424,7 +424,7 @@ static int __init init_wilc_spi_driver(void)
 	int ret;
 
 	wilc1000_init_driver();
-	ret = wilc_netdev_init(NULL, &wilc1000_spi_ops);
+	ret = wilc_netdev_init(NULL, &wilc1000_spi_ops, GPIO_NUM);
 	if (ret)
 		return ret;
 
drivers/staging/wilc1000/wilc_sdio.c +46 -59

202 lines not on this page · raw message

drivers/staging/wilc1000/wilc_wfi_netdevice.h +2 -3
index ec5a8b1215b7..f1f78f51fea0 100644
@@ -159,9 +159,8 @@ struct wilc {
 	const struct wilc1000_ops *ops;
 	int mac_status;
 	int wilc1000_initialized;
-	#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
-	unsigned short dev_irq_num;
-	#endif
+	int gpio;
+	int dev_irq_num;
 	int close;
 	u8 u8NoIfcs;
 	struct wilc_vif strInterfaceInfo[NUM_CONCURRENT_IFC];
drivers/staging/wilc1000/wilc_wlan.c +2 -6
index 7e1b892f721d..d12a4e7df32c 100644
@@ -1369,9 +1369,6 @@ void wilc_handle_isr(void)
 		wilc_sleeptimer_isr_ext(int_status);
 
 	if (!(int_status & (ALL_INT_EXT))) {
-#ifdef WILC_SDIO
-		PRINT_D(TX_DBG, ">> UNKNOWN_INTERRUPT - 0x%08x\n", int_status);
-#endif
 		wilc_unknown_isr_ext();
 	}
 	release_bus(RELEASE_ALLOW_SLEEP);
@@ -1481,9 +1478,8 @@ int wilc_wlan_start(void)
 		return ret;
 	}
 	reg = 0;
-#ifdef WILC_SDIO_IRQ_GPIO
-	reg |= WILC_HAVE_SDIO_IRQ_GPIO;
-#endif
+	if (p->io_func->io_type == HIF_SDIO && wilc1000_dev->gpio >= 0)
+		reg |= WILC_HAVE_SDIO_IRQ_GPIO;
 
 #ifdef WILC_DISABLE_PMU
 #else
drivers/staging/wilc1000/wilc_wlan.h +1 -1
index 10b2a2f9e1b2..2e9b5d50ff7e 100644
@@ -321,7 +321,7 @@ void wilc1000_enable_tcp_ack_filter(bool value);
 void wilc1000_chip_sleep_manually(u32 u32SleepTime);
 int wilc1000_wlan_get_num_conn_ifcs(void);
 int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops);
+int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops, int gpio);
 void __exit wilc_netdev_free(struct wilc *wilc1000_dev);
 
 void wilc_handle_isr(void);
Signature · 1 line
2.1.0.rc2
#16 lore raw

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

In reply to Arnd Bergmann

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

The linux_wlan_sdio.h file is now unused and gets deleted.

---
 drivers/staging/wilc1000/linux_wlan.c      | 21 ++++++++++++---------
 drivers/staging/wilc1000/linux_wlan_sdio.c | 23 +++++++++++++----------
 drivers/staging/wilc1000/linux_wlan_sdio.h |  5 -----
 drivers/staging/wilc1000/wilc_wlan_if.h    |  2 ++
 4 files changed, 27 insertions(+), 24 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.h
drivers/staging/wilc1000/linux_wlan.c +12 -9
index beafc543aac3..7b0ac31f04a2 100644
@@ -26,8 +26,6 @@
 #include <linux/version.h>
 #include <linux/semaphore.h>
 
-#include "linux_wlan_sdio.h"
-
 static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr);
 
 static struct notifier_block g_dev_notifier = {
@@ -826,9 +824,10 @@ void wilc1000_wlan_deinit(struct wilc *nic)
 #endif
 
 		PRINT_D(INIT_DBG, "Disabling IRQ\n");
-		if (wilc1000_dev->gpio < 0) {
+		if (wilc1000_dev->gpio < 0 &&
+		    wilc1000_dev->ops->disable_interrupt) {
 			mutex_lock(&wilc1000_dev->hif_cs);
-			wilc1000_sdio_disable_interrupt();
+			wilc1000_dev->ops->disable_interrupt(wilc1000_dev);
 			mutex_unlock(&wilc1000_dev->hif_cs);
 		}
 		if (&wilc1000_dev->txq_event != NULL)
@@ -845,11 +844,12 @@ void wilc1000_wlan_deinit(struct wilc *nic)
 		PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
 		wilc_wlan_cleanup();
 #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
-		if (wilc1000_dev->gpio < 0) {
+		if (wilc1000_dev->gpio < 0 &&
+		    wilc1000_dev->ops->disable_interrupt) {
 			PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
 
 			mutex_lock(&wilc1000_dev->hif_cs);
-			wilc1000_sdio_disable_interrupt();
+			wilc1000_dev->ops->disable_interrupt(wilc1000_dev);
 			mutex_unlock(&wilc1000_dev->hif_cs);
 #endif
 
@@ -983,7 +983,9 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 			goto _fail_threads_;
 		}
 
-		if (wilc1000_dev->gpio < 0 && wilc1000_sdio_enable_interrupt()) {
+		if (wilc1000_dev->gpio < 0 &&
+		    wilc1000_dev->ops->enable_interrupt &&
+		    wilc1000_dev->ops->enable_interrupt(wilc1000_dev)) {
 			PRINT_ER("couldn't initialize IRQ\n");
 			ret = -EIO;
 			goto _fail_irq_init_;
@@ -1039,8 +1041,9 @@ _fail_fw_start_:
 		wilc_wlan_stop();
 
 _fail_irq_enable_:
-		if (wilc1000_dev->gpio < 0)
-			wilc1000_sdio_disable_interrupt();
+		if (wilc1000_dev->gpio < 0 &&
+		    wilc1000_dev->ops->disable_interrupt)
+			wilc1000_dev->ops->disable_interrupt(wilc1000_dev);
 _fail_irq_init_:
 		if (wilc1000_dev->gpio >= 0)
 			deinit_irq(wilc1000_dev);
drivers/staging/wilc1000/linux_wlan_sdio.c +13 -10
index 64c8c5725277..86251b907197 100644
@@ -1,5 +1,4 @@
 #include "wilc_wfi_netdevice.h"
-#include "linux_wlan_sdio.h"
 #include "wilc_wfi_netdevice.h"
 
 #include <linux/mmc/sdio_func.h>
@@ -160,7 +159,7 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
 
 	wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
 	if (wilc1000_dev->gpio < 0)
-		wilc1000_sdio_enable_interrupt();
+		wilc1000_dev->ops->enable_interrupt(wilc1000_dev);
 
 	if (wilc1000_wlan_get_firmware(nic)) {
 		PRINT_ER("Can't get firmware\n");
@@ -232,13 +231,14 @@ static struct sdio_driver wilc_bus = {
 	.remove		= linux_sdio_remove,
 };
 
-int wilc1000_sdio_enable_interrupt(void)
+static int wilc1000_sdio_enable_interrupt(struct wilc *dev)
 {
+	struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev);
 	int ret = 0;
 
-	sdio_claim_host(wilc1000_sdio_func);
-	ret = sdio_claim_irq(wilc1000_sdio_func, wilc_sdio_interrupt);
-	sdio_release_host(wilc1000_sdio_func);
+	sdio_claim_host(func);
+	ret = sdio_claim_irq(func, wilc_sdio_interrupt);
+	sdio_release_host(func);
 
 	if (ret < 0) {
 		PRINT_ER("can't claim sdio_irq, err(%d)\n", ret);
@@ -247,18 +247,19 @@ int wilc1000_sdio_enable_interrupt(void)
 	return ret;
 }
 
-void wilc1000_sdio_disable_interrupt(void)
+static void wilc1000_sdio_disable_interrupt(struct wilc *dev)
 {
+	struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev);
 	int ret;
 
 	PRINT_D(INIT_DBG, "wilc1000_sdio_disable_interrupt IN\n");
 
-	sdio_claim_host(wilc1000_sdio_func);
-	ret = sdio_release_irq(wilc1000_sdio_func);
+	sdio_claim_host(func);
+	ret = sdio_release_irq(func);
 	if (ret < 0) {
 		PRINT_ER("can't release sdio_irq, err(%d)\n", ret);
 	}
-	sdio_release_host(wilc1000_sdio_func);
+	sdio_release_host(func);
 
 	PRINT_D(INIT_DBG, "wilc1000_sdio_disable_interrupt OUT\n");
 }
@@ -325,6 +326,8 @@ static const struct wilc1000_ops wilc1000_sdio_ops = {
 	.repeat_power_cycle = repeat_power_cycle,
 	.prepare_11b_core = wilc1000_prepare_11b_core,
 #endif
+	.enable_interrupt = wilc1000_sdio_enable_interrupt,
+	.disable_interrupt = wilc1000_sdio_disable_interrupt,
 	.u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52,
 	.u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53,
 	.u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed,
drivers/staging/wilc1000/linux_wlan_sdio.h deleted +0 -5
deleted file mode 100644
index b4995a3211c7..000000000000
@@ -1,5 +0,0 @@
-#include <linux/mmc/sdio_func.h>
-
-int wilc1000_sdio_enable_interrupt(void);
-void wilc1000_sdio_disable_interrupt(void);
-
drivers/staging/wilc1000/wilc_wlan_if.h +2 -0
index a4befcb74c82..2fdf411d6e13 100644
@@ -79,6 +79,8 @@ struct wilc1000_ops {
 	void (*io_deinit)(void *);
 	int (*repeat_power_cycle)(struct wilc_per_interface *nic);
 	u8 (*prepare_11b_core)(struct wilc *nic);
+	int (*enable_interrupt)(struct wilc *nic);
+	void (*disable_interrupt)(struct wilc *nic);
 
 	union {
 		struct {
Signature · 1 line
2.1.0.rc2
#17 lore raw

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

In reply to Arnd Bergmann

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

---
 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(-)
drivers/staging/wilc1000/Makefile +1 -2
index b96fee8f94f2..9ce30e92ea3a 100644
@@ -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\" \
drivers/staging/wilc1000/wilc_wlan.c +4 -1
index d12a4e7df32c..038c9b2eee6c 100644
@@ -1238,7 +1238,10 @@ static void wilc_pllupdate_isr_ext(u32 int_stats)
 	g_wlan.hif_func.hif_clear_int_ext(PLL_INT_CLR);
 
 	/* Waiting for PLL */
-	mdelay(WILC_PLL_TO);
+	if (g_wlan.io_func->io_type == HIF_SDIO)
+		mdelay(WILC_PLL_TO_SDIO);
+	else
+		mdelay(WILC_PLL_TO_SPI);
 
 	/* poll till read a valid data */
 	while (!(ISWILC1000(wilc_get_chipid(true)) && --trials)) {
drivers/staging/wilc1000/wilc_wlan.h +2 -5
index 2e9b5d50ff7e..2f636534fc5d 100644
@@ -143,11 +143,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)
Signature · 1 line
2.1.0.rc2
#18 lore raw

PATCH 17/19 staging/wilc1000: pass hif operations through initialization

In reply to Arnd Bergmann

The wilc1000_hif_spi and wilc1000_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.

---
 drivers/staging/wilc1000/linux_wlan.c         |  4 ++-
 drivers/staging/wilc1000/linux_wlan_sdio.c    |  3 ++-
 drivers/staging/wilc1000/linux_wlan_spi.c     |  3 ++-
 drivers/staging/wilc1000/wilc_sdio.c          | 35 +++++++++++++--------------
 drivers/staging/wilc1000/wilc_spi.c           | 34 +++++++++++++-------------
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 drivers/staging/wilc1000/wilc_wlan.c          | 29 ++++------------------
 drivers/staging/wilc1000/wilc_wlan.h          | 11 +++++----
 8 files changed, 53 insertions(+), 67 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +3 -1
index 7b0ac31f04a2..04ebb6310070 100644
@@ -1503,7 +1503,8 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
 		WILC_WFI_p2p_rx(wilc1000_dev->strInterfaceInfo[1].wilc_netdev, buff, size);
 }
 
-int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops, int gpio)
+int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops,
+		     const struct wilc1000_hif_ops *hif_ops, int gpio)
 {
 
 	int i;
@@ -1518,6 +1519,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops, int gpi
 		return -ENOMEM;
 
 	wilc1000_dev->ops = ops;
+	wilc1000_dev->hif_ops = hif_ops;
 	wilc1000_dev->gpio = gpio;
 
 	register_inetaddr_notifier(&g_dev_notifier);
drivers/staging/wilc1000/linux_wlan_sdio.c +2 -1
index 86251b907197..1f79d986be5c 100644
@@ -206,7 +206,8 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
 
 	PRINT_D(INIT_DBG, "Initializing netdev\n");
 	wilc1000_sdio_func = func;
-	if (wilc_netdev_init(&func->dev, &wilc1000_sdio_ops, gpio)) {
+	if (wilc_netdev_init(&func->dev, &wilc1000_sdio_ops,
+	    &wilc1000_hif_sdio, gpio)) {
 		PRINT_ER("Couldn't initialize netdev\n");
 		return -1;
 	}
drivers/staging/wilc1000/linux_wlan_spi.c +2 -1
index c6ea3ef0664f..02b922ab86bb 100644
@@ -424,7 +424,8 @@ static int __init init_wilc_spi_driver(void)
 	int ret;
 
 	wilc1000_init_driver();
-	ret = wilc_netdev_init(NULL, &wilc1000_spi_ops, GPIO_NUM);
+	ret = wilc_netdev_init(NULL, &wilc1000_spi_ops, &wilc1000_hif_spi,
+			       GPIO_NUM);
 	if (ret)
 		return ret;
 
drivers/staging/wilc1000/wilc_sdio.c +17 -18
index 69b7c72b76c5..5bfc093b6201 100644
@@ -924,23 +924,22 @@ static int sdio_sync_ext(int nint /*  how mant interrupts to enable. */)
  *
  ********************************************/
 
-wilc_hif_func_t wilc1000_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 wilc1000_hif_ops wilc1000_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,
 };
 
drivers/staging/wilc1000/wilc_spi.c +17 -17
index 4c5659b72f29..a418774d7960 100644
@@ -1032,21 +1032,21 @@ static int spi_sync_ext(int nint /*  how mant interrupts to enable. */)
  *      Global spi HIF function table
  *
  ********************************************/
-wilc_hif_func_t wilc1000_hif_spi = {
-	spi_init,
-	spi_deinit,
-	spi_read_reg,
-	spi_write_reg,
-	spi_read,
-	spi_write,
-	spi_sync,
-	spi_clear_int,
-	spi_read_int,
-	spi_clear_int_ext,
-	spi_read_size,
-	spi_write,
-	spi_read,
-	spi_sync_ext,
-	spi_max_bus_speed,
-	spi_default_bus_speed,
+const struct wilc1000_hif_ops wilc1000_hif_spi = {
+	.hif_init = spi_init,
+	.hif_deinit = spi_deinit,
+	.hif_read_reg = spi_read_reg,
+	.hif_write_reg = spi_write_reg,
+	.hif_block_rx = spi_read,
+	.hif_block_tx = spi_write,
+	.hif_sync = spi_sync,
+	.hif_clear_int = spi_clear_int,
+	.hif_read_int = spi_read_int,
+	.hif_clear_int_ext = spi_clear_int_ext,
+	.hif_read_size = spi_read_size,
+	.hif_block_rx_ext = spi_write,
+	.hif_block_tx_ext = spi_read,
+	.hif_sync_ext = spi_sync_ext,
+	.hif_set_max_bus_speed = spi_max_bus_speed,
+	.hif_set_default_bus_speed = spi_default_bus_speed,
 };
drivers/staging/wilc1000/wilc_wfi_netdevice.h +1 -0
index f1f78f51fea0..791ede247465 100644
@@ -157,6 +157,7 @@ struct wilc_vif {
 
 struct wilc {
 	const struct wilc1000_ops *ops;
+	const struct wilc1000_hif_ops *hif_ops;
 	int mac_status;
 	int wilc1000_initialized;
 	int gpio;
drivers/staging/wilc1000/wilc_wlan.c +5 -24
index 038c9b2eee6c..04d2938a383c 100644
@@ -28,7 +28,7 @@ typedef struct {
 	/**
 	 *      host interface functions
 	 **/
-	wilc_hif_func_t hif_func;
+	struct wilc1000_hif_ops hif_func;
 
 	/**
 	 *      configuration interface functions
@@ -1947,29 +1947,10 @@ int wilc_wlan_init(struct wilc *inp)
 	/***
 	 *      host interface init
 	 **/
-	if ((inp->ops->io_type & 0x1) == HIF_SDIO) {
-		if (!wilc1000_hif_sdio.hif_init(inp, wilc_debug)) {
-			/* EIO	5 */
-			ret = -5;
-			goto _fail_;
-		}
-		memcpy((void *)&g_wlan.hif_func, &wilc1000_hif_sdio, sizeof(wilc_hif_func_t));
-	} else {
-		if ((inp->ops->io_type & 0x1) == HIF_SPI) {
-			/**
-			 *      TODO:
-			 **/
-			if (!wilc1000_hif_spi.hif_init(inp, wilc_debug)) {
-				/* EIO	5 */
-				ret = -5;
-				goto _fail_;
-			}
-			memcpy((void *)&g_wlan.hif_func, &wilc1000_hif_spi, sizeof(wilc_hif_func_t));
-		} else {
-			/* EIO	5 */
-			ret = -5;
-			goto _fail_;
-		}
+	g_wlan.hif_func = *inp->hif_ops;
+	if (!g_wlan.hif_func.hif_init(inp, wilc_debug))	{
+		ret = -EIO;
+		goto _fail_;
 	}
 
 	/***
drivers/staging/wilc1000/wilc_wlan.h +6 -5
index 2f636534fc5d..f684d5bf465d 100644
@@ -251,7 +251,7 @@ struct rxq_entry_t {
 
 struct wilc;
 
-typedef struct {
+struct wilc1000_hif_ops {
 	int (*hif_init)(struct wilc *, wilc_debug_func);
 	int (*hif_deinit)(void *);
 	int (*hif_read_reg)(u32, u32 *);
@@ -268,10 +268,10 @@ typedef struct {
 	int (*hif_sync_ext)(int);
 	void (*hif_set_max_bus_speed)(void);
 	void (*hif_set_default_bus_speed)(void);
-} wilc_hif_func_t;
+};
 
-extern wilc_hif_func_t wilc1000_hif_spi;
-extern wilc_hif_func_t wilc1000_hif_sdio;
+extern const struct wilc1000_hif_ops wilc1000_hif_spi;
+extern const struct wilc1000_hif_ops wilc1000_hif_sdio;
 
 /********************************************
  *
@@ -318,7 +318,8 @@ void wilc1000_enable_tcp_ack_filter(bool value);
 void wilc1000_chip_sleep_manually(u32 u32SleepTime);
 int wilc1000_wlan_get_num_conn_ifcs(void);
 int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops, int gpio);
+int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops,
+		     const struct wilc1000_hif_ops *hif_ops, int gpio);
 void __exit wilc_netdev_free(struct wilc *wilc1000_dev);
 
 void wilc_handle_isr(void);
Signature · 1 line
2.1.0.rc2
#19 lore raw

PATCH 18/19 staging/wilc1000: split out bus specific modules

In reply to Arnd Bergmann

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

---
 drivers/staging/wilc1000/Kconfig           | 66 +++++++++++++-----------------
 drivers/staging/wilc1000/Makefile          |  9 ++--
 drivers/staging/wilc1000/linux_wlan.c      |  6 +++
 drivers/staging/wilc1000/linux_wlan_sdio.c |  1 +
 drivers/staging/wilc1000/linux_wlan_spi.c  |  1 +
 drivers/staging/wilc1000/wilc_debugfs.c    |  2 +
 drivers/staging/wilc1000/wilc_wlan.c       |  1 +
 7 files changed, 45 insertions(+), 41 deletions(-)
drivers/staging/wilc1000/Kconfig +28 -38
index ee51b4278088..2923122346ef 100644
@@ -1,41 +1,12 @@
-config WILC1000_DRIVER
-	bool "WILC1000 support (WiFi only)"
-	depends on CFG80211 && WEXT_CORE && INET
-	---help---
-	  This module only support IEEE 802.11n WiFi.
-
-if WILC1000_DRIVER
-
 config WILC1000
 	tristate
-
-choice
-        prompt "Memory Allocation"
-        default WILC1000_PREALLOCATE_AT_LOADING_DRIVER
-
-config WILC1000_PREALLOCATE_AT_LOADING_DRIVER
-	bool "Preallocate memory at loading driver"
+	select WIRELESS_EXT
 	---help---
-	  This choice supports static allocation of the memory
-	  for the receive buffer. The driver will allocate the RX buffer
-	  during initial time. The driver will also free the buffer
-	  by calling network device stop.
-
-config WILC1000_DYNAMICALLY_ALLOCATE_MEMROY
-        bool "Dynamically allocate memory in real time"
-        ---help---
-	  This choice supports dynamic allocation of the memory
-	  for the receive buffer. The driver will allocate the RX buffer
-	  when it is required.
-endchoice
-
-choice
-	prompt "Bus Type"
-	default WILC1000_SDIO
+	  This module only support IEEE 802.11n WiFi.
 
 config WILC1000_SDIO
-	bool "SDIO support"
-	depends on MMC
+	tristate "Atmel WILC1000 SDIO (WiFi only)"
+	depends on CFG80211 && INET && MMC
 	select WILC1000
 	---help---
 	  This module adds support for the SDIO interface of adapters using
@@ -48,9 +19,9 @@ config WILC1000_SDIO
 	  this if your platform is using the SDIO bus.
 
 config WILC1000_SPI
-	depends on SPI
+	tristate "Atmel WILC1000 SPI (WiFi only)"
+	depends on CFG80211 && INET && SPI
 	select WILC1000
-	bool "SPI support"
 	---help---
 	  This module adds support for the SPI interface of adapters using
 	  WILC1000 chipset. The Atmel WILC1000 has a Serial Peripheral
@@ -59,10 +30,31 @@ config WILC1000_SPI
 	  full-duplex slave synchronous serial interface that is available
 	  immediately following reset when pin 9 (SDIO_SPI_CFG) is tied to
 	  VDDIO. Select this if your platform is using the SPI bus.
+
+choice
+        prompt "WILC1000 Memory Allocation"
+        depends on WILC1000
+        default WILC1000_PREALLOCATE_AT_LOADING_DRIVER
+
+config WILC1000_PREALLOCATE_AT_LOADING_DRIVER
+	bool "Preallocate memory at loading driver"
+	---help---
+	  This choice supports static allocation of the memory
+	  for the receive buffer. The driver will allocate the RX buffer
+	  during initial time. The driver will also free the buffer
+	  by calling network device stop.
+
+config WILC1000_DYNAMICALLY_ALLOCATE_MEMROY
+        bool "Dynamically allocate memory in real time"
+        ---help---
+	  This choice supports dynamic allocation of the memory
+	  for the receive buffer. The driver will allocate the RX buffer
+	  when it is required.
 endchoice
 
+
 config WILC1000_HW_OOB_INTR
-	bool "Use out of band interrupt"
+	bool "WILC1000 out of band interrupt"
 	depends on WILC1000_SDIO
 	default n
 	---help---
@@ -71,5 +63,3 @@ config WILC1000_HW_OOB_INTR
 	  mechanism for SDIO host controllers that don't support SDIO interrupt.
 	  Select this option If the SDIO host controller in your platform
 	  doesn't support SDIO time devision interrupt.
-
-endif
drivers/staging/wilc1000/Makefile +6 -3
index 9ce30e92ea3a..198d536da57c 100644
@@ -18,8 +18,11 @@ ccflags-$(CONFIG_WILC1000_DYNAMICALLY_ALLOCATE_MEMROY) += -DWILC_NORMAL_ALLOC
 wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
 			wilc_msgqueue.o \
 			coreconfigurator.o host_interface.o \
-			wilc_sdio.o wilc_spi.o wilc_wlan_cfg.o wilc_debugfs.o \
+			wilc_wlan_cfg.o wilc_debugfs.o \
 			wilc_wlan.o
 
-wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o
-wilc1000-$(CONFIG_WILC1000_SPI) += linux_wlan_spi.o
+obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
+wilc1000-sdio-objs += linux_wlan_sdio.o wilc_sdio.o
+
+obj-$(CONFIG_WILC1000_SPI) += wilc1000-spi.o
+wilc1000-spi-objs += linux_wlan_spi.o wilc_spi.o
drivers/staging/wilc1000/linux_wlan.c +6 -0
index 04ebb6310070..8a5f4673c5d0 100644
@@ -56,6 +56,8 @@ static void wilc_set_multicast_list(struct net_device *dev);
  * and this data should be pointer to net device
  */
 struct wilc *wilc1000_dev;
+EXPORT_SYMBOL_GPL(wilc1000_dev);
+
 bool wilc1000_enable_ps = true;
 
 static const struct net_device_ops wilc_netdev_ops = {
@@ -1590,6 +1592,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops,
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(wilc_netdev_init);
 
 void __init wilc1000_init_driver(void)
 {
@@ -1601,6 +1604,7 @@ void __init wilc1000_init_driver(void)
 	printk("IN INIT FUNCTION\n");
 	printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
 }
+EXPORT_SYMBOL_GPL(wilc1000_init_driver);
 
 void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
 {
@@ -1647,6 +1651,7 @@ void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
 		}
 	}
 }
+EXPORT_SYMBOL_GPL(wilc_netdev_free);
 
 void __exit wilc1000_exit_driver(void)
 {
@@ -1658,5 +1663,6 @@ void __exit wilc1000_exit_driver(void)
 	wilc_debugfs_remove();
 #endif
 }
+EXPORT_SYMBOL_GPL(wilc1000_exit_driver);
 
 MODULE_LICENSE("GPL");
drivers/staging/wilc1000/linux_wlan_sdio.c +1 -0
index 1f79d986be5c..1f343ac72530 100644
@@ -350,3 +350,4 @@ static void __exit exit_wilc_sdio_driver(void)
 	wilc1000_exit_driver();
 }
 module_exit(exit_wilc_sdio_driver);
+MODULE_LICENSE("GPL");
drivers/staging/wilc1000/linux_wlan_spi.c +1 -0
index 02b922ab86bb..c0e0e6be6b0b 100644
@@ -447,3 +447,4 @@ static void __exit exit_wilc_spi_driver(void)
 	wilc1000_exit_driver();
 }
 module_exit(exit_wilc_spi_driver);
+MODULE_LICENSE("GPL");
drivers/staging/wilc1000/wilc_debugfs.c +2 -0
index c22f0ca10250..6f37b6491de7 100644
@@ -27,7 +27,9 @@ static struct dentry *wilc_dir;
 #define DBG_REGION_ALL	(GENERIC_DBG | HOSTAPD_DBG | HOSTINF_DBG | CORECONFIG_DBG | CFG80211_DBG | INT_DBG | TX_DBG | RX_DBG | LOCK_DBG | INIT_DBG | BUS_DBG | MEM_DBG)
 #define DBG_LEVEL_ALL	(DEBUG | INFO | WRN | ERR)
 atomic_t WILC1000_REGION = ATOMIC_INIT(INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG);
+EXPORT_SYMBOL_GPL(WILC1000_REGION);
 atomic_t WILC1000_DEBUG_LEVEL = ATOMIC_INIT(ERR);
+EXPORT_SYMBOL_GPL(WILC1000_DEBUG_LEVEL);
 
 /*
  * --------------------------------------------------------------------------------
drivers/staging/wilc1000/wilc_wlan.c +1 -0
index 04d2938a383c..bebc0880cc02 100644
@@ -1376,6 +1376,7 @@ void wilc_handle_isr(void)
 	}
 	release_bus(RELEASE_ALLOW_SLEEP);
 }
+EXPORT_SYMBOL_GPL(wilc_handle_isr);
 
 /********************************************
  *
Signature · 1 line
2.1.0.rc2
#20 lore raw

PATCH 1/1 fixup! staging/wilc1000: split out bus specific modules

The patch to split out bus modules causes new valid build warnings without this.

drivers/staging/wilc1000/linux_wlan.c +3 -3
index 8a5f4673c5d0..fe3b464f0d5c 100644
@@ -1594,7 +1594,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops,
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_init);
 
-void __init wilc1000_init_driver(void)
+void wilc1000_init_driver(void)
 {
 #if defined(WILC_DEBUGFS)
 	if (wilc_debugfs_init() < 0)
@@ -1606,7 +1606,7 @@ void __init wilc1000_init_driver(void)
 }
 EXPORT_SYMBOL_GPL(wilc1000_init_driver);
 
-void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
+void wilc_netdev_free(struct wilc *wilc1000_dev)
 {
 	int i = 0;
 	perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
@@ -1653,7 +1653,7 @@ void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_free);
 
-void __exit wilc1000_exit_driver(void)
+void wilc1000_exit_driver(void)
 {
 	kfree(wilc1000_dev);
 	wilc1000_dev = NULL;
drivers/staging/wilc1000/wilc_wlan.h +3 -3
index f684d5bf465d..b460b7f6971a 100644
@@ -320,7 +320,7 @@ int wilc1000_wlan_get_num_conn_ifcs(void);
 int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
 int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops,
 		     const struct wilc1000_hif_ops *hif_ops, int gpio);
-void __exit wilc_netdev_free(struct wilc *wilc1000_dev);
+void wilc_netdev_free(struct wilc *wilc1000_dev);
 
 void wilc_handle_isr(void);
 
@@ -340,7 +340,7 @@ extern bool wilc1000_enable_ps;
 int wilc1000_firmware_download(struct wilc *p_nic);
 int wilc1000_start_firmware(struct wilc_per_interface *nic);
 
-void __init wilc1000_init_driver(void);
-void __exit wilc1000_exit_driver(void);
+void wilc1000_init_driver(void);
+void wilc1000_exit_driver(void);
 
 #endif
#21 lore raw

RFC PATCH 19/19 staging/wilc1000: use more regular probing

In reply to Arnd Bergmann

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

---
 drivers/staging/wilc1000/linux_wlan.c      |  30 ++++----
 drivers/staging/wilc1000/linux_wlan_sdio.c |  54 ++++---------
 drivers/staging/wilc1000/linux_wlan_spi.c  | 118 ++++++++++-------------------
 drivers/staging/wilc1000/wilc_wlan.h       |   5 +-
 4 files changed, 72 insertions(+), 135 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +15 -15
index 8a5f4673c5d0..6e16c0b32f43 100644
@@ -1594,19 +1594,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops,
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_init);
 
-void __init wilc1000_init_driver(void)
-{
-#if defined(WILC_DEBUGFS)
-	if (wilc_debugfs_init() < 0)
-		PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc driver\n");
-#endif
-
-	printk("IN INIT FUNCTION\n");
-	printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
-}
-EXPORT_SYMBOL_GPL(wilc1000_init_driver);
-
-void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
+void wilc_netdev_free(struct wilc *wilc1000_dev)
 {
 	int i = 0;
 	perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
@@ -1653,16 +1641,28 @@ void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_free);
 
+int __init wilc1000_init_driver(void)
+{
+	int ret = 0;
+#if defined(WILC_DEBUGFS)
+	ret = wilc_debugfs_init();
+	if (ret < 0)
+		PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc driver\n");
+#endif
+	return ret;
+
+}
+module_init(wilc1000_init_driver);
+
 void __exit wilc1000_exit_driver(void)
 {
 	kfree(wilc1000_dev);
 	wilc1000_dev = NULL;
-	printk("Module_exit Done.\n");
 
 #if defined(WILC_DEBUGFS)
 	wilc_debugfs_remove();
 #endif
 }
-EXPORT_SYMBOL_GPL(wilc1000_exit_driver);
+module_exit(wilc1000_exit_driver);
 
 MODULE_LICENSE("GPL");
drivers/staging/wilc1000/linux_wlan_sdio.c +16 -38

120 lines not on this page · raw message

drivers/staging/wilc1000/linux_wlan_spi.c +40 -78

263 lines not on this page · raw message

drivers/staging/wilc1000/wilc_wlan.h +1 -4
index f684d5bf465d..a551e6810ff3 100644
@@ -320,7 +320,7 @@ int wilc1000_wlan_get_num_conn_ifcs(void);
 int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
 int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops,
 		     const struct wilc1000_hif_ops *hif_ops, int gpio);
-void __exit wilc_netdev_free(struct wilc *wilc1000_dev);
+void wilc_netdev_free(struct wilc *wilc1000_dev);
 
 void wilc_handle_isr(void);
 
@@ -340,7 +340,4 @@ extern bool wilc1000_enable_ps;
 int wilc1000_firmware_download(struct wilc *p_nic);
 int wilc1000_start_firmware(struct wilc_per_interface *nic);
 
-void __init wilc1000_init_driver(void);
-void __exit wilc1000_exit_driver(void);
-
 #endif
Signature · 1 line
2.1.0.rc2
#22 lore raw
In reply to Arnd Bergmann

Hi arnd,

Thanks for the all the patches. :)
About the patch ( use proper naming for global symbols ),
We are planning to use this driver not only for wilc1000 but also for other atmel wireless driver. I'd appreciate if you could use wl instead of wilc1000.

And the global variable g_linux_wlan will be placed in netdevice private data and finally it will be removed. I already posted some of those patches.

Thanks,
Glen.

Quoted 63 lines · Arnd Bergmann

After I screwed up two or three times trying to get the dependencies with the SPI and SDIO backends right, I ended up taking the time to do the real fix and make both coexist.

This is a series of patches that address various issues with the driver, but is mainly targetted at splitting out the spi and sdio backends into separate drivers that can be built independent of one another.

The last patch is more experimental than the others, hence the [RFC] annotation.

Please review and test.

Arnd

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

  drivers/staging/wilc1000/Kconfig                  |  66 +-
  drivers/staging/wilc1000/Makefile                 |  16 +-
  drivers/staging/wilc1000/coreconfigurator.c       |  12 +-
  drivers/staging/wilc1000/coreconfigurator.h       |  12 +-
  drivers/staging/wilc1000/host_interface.c         | 501 +++-------------
  drivers/staging/wilc1000/host_interface.h         | 349 ++---------
  drivers/staging/wilc1000/linux_mon.c              |  11 +-
  drivers/staging/wilc1000/linux_wlan.c             | 695 +++++++---------------
  drivers/staging/wilc1000/linux_wlan_common.h      |  18 +-
  drivers/staging/wilc1000/linux_wlan_sdio.c        | 202 +++++--
  drivers/staging/wilc1000/linux_wlan_sdio.h        |  14 -
  drivers/staging/wilc1000/linux_wlan_spi.c         | 119 ++--
  drivers/staging/wilc1000/linux_wlan_spi.h         |   8 -
  drivers/staging/wilc1000/wilc_debugfs.c           |  20 +-
  drivers/staging/wilc1000/wilc_sdio.c              | 213 +++----
  drivers/staging/wilc1000/wilc_spi.c               | 276 +--------
  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 495 +++++++--------
  drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  87 +--
  drivers/staging/wilc1000/wilc_wfi_netdevice.h     |  21 +-
  drivers/staging/wilc1000/wilc_wlan.c              | 180 +++---
  drivers/staging/wilc1000/wilc_wlan.h              |  49 +-
  drivers/staging/wilc1000/wilc_wlan_cfg.c          |   6 +-
  drivers/staging/wilc1000/wilc_wlan_if.h           |  23 +-
  23 files changed, 1171 insertions(+), 2222 deletions(-)

delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.h

#23 lore raw
Quoted 6 lines · On Wednesday 21 October 2015 19:06:52 glen lee wrote:

Hi arnd,

Thanks for the all the patches.
About the patch ( use proper naming for global symbols ),
We are planning to use this driver not only for wilc1000 but also for other atmel wireless driver. I'd appreciate if you could use wl instead of wilc1000.

Hmm, while I see that 'wilc1000' is too specific here, using just 'wl' might be a little too general. The same namespace is used by drivers/mtd/ubi/wl.c, drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c, and a number of local identifiers in other drivers.

Would 'wilc' work as a prefix for all devices you are interested in here?

Quoted 2 lines

And the global variable g_linux_wlan will be placed in netdevice private data and finally it will be removed. I already posted some of those patches.

Ok, so we need to coordinate a bit here. My patches also go in that direction and remove the global variables from linux_wlan_sdio.c and linux_wlan_spi.c, but did not remove the one from linux_wlan.c, because doing that depends on the last [RFC] patch in my series, and I felt I had spent enough time on it at that point ;-)

Would you be ok with taking my patches and rebasing them on top of yours with the changes you want, or do you need help from me with that?

Arnd

#24 lore raw
In reply to glen lee
Quoted 9 lines · On Wednesday 21 October 2015 19:06:52 glen lee wrote:

Hi arnd,

Thanks for the all the patches.
About the patch ( use proper naming for global symbols ),
We are planning to use this driver not only for wilc1000 but also for other atmel wireless driver. I'd appreciate if you could use wl instead of wilc1000.

And the global variable g_linux_wlan will be placed in netdevice private data and finally it will be removed. I already posted some of those patches.

I couldn't find the patches anywhere, but I've updated my series now to rename the symbols to wilc_* and to remove most but not all references to g_linux_wlan (or wilc_dev after my rename). Do you want me to post those so you can integrate them, or should I have a look at what you sent first (please send me a copy then).

Arnd

#25 lore raw
Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · On Wednesday 21 October 2015 19:06:52 glen lee wrote:

Hi arnd,

Thanks for the all the patches.
About the patch ( use proper naming for global symbols ),
We are planning to use this driver not only for wilc1000 but also for other atmel wireless driver. I'd appreciate if you could use wl instead of wilc1000.

Quoted 7 lines
Quoted 2 lines

And the global variable g_linux_wlan will be placed in netdevice private data and finally it will be removed. I already posted some of those patches.

I couldn't find the patches anywhere, but I've updated my series now to rename the symbols to wilc_* and to remove most but not all references to g_linux_wlan (or wilc_dev after my rename). Do you want me to post those so you can integrate them, or should I have a look at what you sent first (please send me a copy then).

Hi arnd,

I have tested with all the patches you have posted but it does not works. firmware start timed out in the function wilc1000_start_firmware.
I also have tested with all the patched without last one, [RFC] one, but it shows Segmentation fault when insmod driver.
For now, I can't rebase the patches. I'd appreciate if you could help us.

The title of my first patch is,
[PATCH 01/13] staging: wilc1000: add wilc to netdev private data structure and also refer to [PATCH 00/12] WILC1000 V2 for the g_linux_wlan ( The patches posted by [email protected] )

By the way, deleting feature COMPLEMENT_BOOT patch already posted but not yet accepted.

Thank you.
Glen.

Quoted 1 line

Arnd

#26 lore raw

Hi Arnd,
First of all, I would like to say "thank you" for your efforts and contributions. We are updating the driver because new revision came up and making new patches to make it stable and elegant as Linux driver. In these days, we are sending big changes while testing such patches and also doing updates at once.

As you did, we are scheduled to provide the patches making device tree and delete all of platform dependencies as you removed WILC_SDIO_IRQ_GPIO as well as other things. So, I would like to discuss with you for your series of patch.

In this time, I think it's important to make the driver to be compiled even if the link problem happens as you reported. So, how about deleting all of SPI related files from source tree and even from Kconfig for the time being because new bus driver will come or revert the Kconfig and then can we expect the best patch in the near feature?

I respect your efforts and patches, so your opinion is very important to me.

Thanks,
Tony.

Quoted 38 lines · glen lee
Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · On Wednesday 21 October 2015 19:06:52 glen lee wrote:

Hi arnd,

Thanks for the all the patches.
About the patch ( use proper naming for global symbols ),
We are planning to use this driver not only for wilc1000 but also for other atmel wireless driver. I'd appreciate if you could use wl instead of wilc1000.

Quoted 7 lines
Quoted 2 lines

And the global variable g_linux_wlan will be placed in netdevice private data and finally it will be removed. I already posted some of those patches.

I couldn't find the patches anywhere, but I've updated my series now to rename the symbols to wilc_* and to remove most but not all references to g_linux_wlan (or wilc_dev after my rename). Do you want me to post those so you can integrate them, or should I have a look at what you sent first (please send me a copy then).

Hi arnd,

I have tested with all the patches you have posted but it does not works. firmware start timed out in the function wilc1000_start_firmware.
I also have tested with all the patched without last one, [RFC] one, but it shows Segmentation fault when insmod driver.
For now, I can't rebase the patches. I'd appreciate if you could help us.

The title of my first patch is,
[PATCH 01/13] staging: wilc1000: add wilc to netdev private data structure and also refer to [PATCH 00/12] WILC1000 V2 for the g_linux_wlan ( The patches posted by [email protected] )

By the way, deleting feature COMPLEMENT_BOOT patch already posted but not yet accepted.

Thank you.
Glen.

Quoted 1 line

Arnd

#27 lore raw

Hi Arnd,
I expect your opinion but I would like to make the patch to revert the commit bcc43a4b5ed75285aeacf2cf8d9b96d6379fb429 if you don't mind because the WILC1000 in staging still has compile errors. Then, we had better make patch for your concerns.

I always appreciate your review and contribution.

Thanks,
Tony.

Quoted 60 lines · Tony Cho

Hi Arnd,
First of all, I would like to say "thank you" for your efforts and contributions. We are updating the driver because new revision came up and making new patches to make it stable and elegant as Linux driver. In these days, we are sending big changes while testing such patches and also doing updates at once.

As you did, we are scheduled to provide the patches making device tree and delete all of platform dependencies as you removed WILC_SDIO_IRQ_GPIO as well as other things. So, I would like to discuss with you for your series of patch.

In this time, I think it's important to make the driver to be compiled even if the link problem happens as you reported. So, how about deleting all of SPI related files from source tree and even from Kconfig for the time being because new bus driver will come or revert the Kconfig and then can we expect the best patch in the near feature?

I respect your efforts and patches, so your opinion is very important to me.

Thanks,
Tony.

Quoted 38 lines · glen lee
Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · On Wednesday 21 October 2015 19:06:52 glen lee wrote:

Hi arnd,

Thanks for the all the patches.
About the patch ( use proper naming for global symbols ),
We are planning to use this driver not only for wilc1000 but also for other atmel wireless driver. I'd appreciate if you could use wl instead of wilc1000.

Quoted 7 lines
Quoted 2 lines

And the global variable g_linux_wlan will be placed in netdevice private data and finally it will be removed. I already posted some of those patches.

I couldn't find the patches anywhere, but I've updated my series now to rename the symbols to wilc_* and to remove most but not all references to g_linux_wlan (or wilc_dev after my rename). Do you want me to post those so you can integrate them, or should I have a look at what you sent first (please send me a copy then).

Hi arnd,

I have tested with all the patches you have posted but it does not works. firmware start timed out in the function wilc1000_start_firmware.
I also have tested with all the patched without last one, [RFC] one, but it shows Segmentation fault when insmod driver.
For now, I can't rebase the patches. I'd appreciate if you could help us.

The title of my first patch is,
[PATCH 01/13] staging: wilc1000: add wilc to netdev private data structure and also refer to [PATCH 00/12] WILC1000 V2 for the g_linux_wlan ( The patches posted by [email protected] )

By the way, deleting feature COMPLEMENT_BOOT patch already posted but not yet accepted.

Thank you.
Glen.

Quoted 1 line

Arnd

#28 lore raw
In reply to Tony Cho
Quoted 23 lines · On Friday 23 October 2015 16:51:13 Tony Cho wrote:

Hi Arnd,
First of all, I would like to say "thank you" for your efforts and contributions.
We are updating the driver because new revision came up and making new patches
to make it stable and elegant as Linux driver. In these days, we are sending big changes
while testing such patches and also doing updates at once.

As you did, we are scheduled to provide the patches making device tree and delete all of platform
dependencies as you removed WILC_SDIO_IRQ_GPIO as well as other things. So, I would like to
discuss with you for your series of patch.

In this time, I think it's important to make the driver to be compiled even if the link problem
happens as you reported. So, how about deleting all of SPI related files from source tree and
even from Kconfig for the time being because new bus driver will come or revert
the Kconfig and then can we expect the best patch in the near feature?

Quoted 1 line

I respect your efforts and patches, so your opinion is very important to me.

Hi Tony,

I've seen you have merged the patches that you mentioned into Greg's tree. I have now rebased my patches on top, including the separate SPI driver. Once we merge those, it should work fine, and having multiple front-end drivers gives a nice template for adding future hardware specific variations like another bus, or a newer model on the same bus. I'll post my patches after some more testing.

Arnd