staging: wilc1000: remove function pointer rx_indicate
PATCH 1/15 staging: wilc1000: remove function pointer rx_indicate
This patch removes function pointer rx_indicate and call the function frmw_to_linux directly.
--- drivers/staging/wilc1000/linux_wlan.c | 2 -- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + drivers/staging/wilc1000/wilc_wlan.c | 11 +++++------ drivers/staging/wilc1000/wilc_wlan_if.h | 1 - 4 files changed, 6 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +0 -2
@@ -106,7 +106,6 @@ 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); -void frmw_to_linux (u8 *buff,u32 size,u32 pkt_offset);static int mac_init_fn (struct net_device *ndev);int mac_xmit (struct sk_buff *skb,struct net_device *dev);int mac_open (struct net_device *ndev);
@@ -1095,7 +1094,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic)#endif /*for now - to be revised*/ - nwi->net_func.rx_indicate = frmw_to_linux; nwi->net_func.rx_complete = linux_wlan_rx_complete; nwi->indicate_func.mac_indicate = linux_wlan_mac_indicate; }
drivers/staging/wilc1000/wilc_wfi_netdevice.h +1 -0
@@ -216,5 +216,6 @@ struct WILC_WFI_mon_priv { };extern struct net_device *WILC_WFI_devs[]; +void frmw_to_linux (u8 *buff,u32 size,u32 pkt_offset);#endif
drivers/staging/wilc1000/wilc_wlan.c +5 -6
@@ -1199,12 +1199,11 @@ static void wilc_wlan_handle_rxq(void) {if (!is_cfg_packet) { - -if (p->net_func.rx_indicate) { -if (pkt_len >0 ) { - p->net_func.rx_indicate (&buffer[offset], pkt_len, pkt_offset); - has_packet =1 ; - } +if (pkt_len >0 ) { +frmw_to_linux (&buffer[offset], + pkt_len, + pkt_offset); + has_packet =1 ; } }else {wilc_cfg_rsp_t rsp;
drivers/staging/wilc1000/wilc_wlan_if.h +0 -1
@@ -100,7 +100,6 @@ typedef struct { } wilc_wlan_io_func_t;typedef struct { -void (*rx_indicate)(u8 *,u32 ,u32 );void (*rx_complete)(void ); }wilc_wlan_net_func_t ;
Signature · 1 line
1.9.1
PATCH 2/15 staging: wilc1000: remove function pointer mac_indicate
No need for a pointer to a function. Just call linux_wlan_mac_indicate. Remove mac_indicate and also wilc_wlan_indicate_func_t since no members in it. Variable indicate_func is not used so delete it and related codes. Finally remove static from the function linux_wlan_mac_indicate.
--- drivers/staging/wilc1000/linux_wlan.c | 3 +-- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + drivers/staging/wilc1000/wilc_wlan.c | 9 ++------- drivers/staging/wilc1000/wilc_wlan_if.h | 4 ---- 4 files changed, 4 insertions(+), 13 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +1 -2
@@ -393,7 +393,7 @@ static int linux_wlan_lock_timeout(void *vp, u32 timeout)return error; } -static void linux_wlan_mac_indicate (int flag) +void linux_wlan_mac_indicate (int flag) {/*I have to do it that way becuase there is no mean to encapsulate device pointer * as a parameter
@@ -1095,7 +1095,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic)/*for now - to be revised*/ nwi->net_func.rx_complete = linux_wlan_rx_complete; - nwi->indicate_func.mac_indicate = linux_wlan_mac_indicate; }int wlan_initialize_threads (perInterface_wlan_t *nic)
drivers/staging/wilc1000/wilc_wfi_netdevice.h +1 -0
@@ -217,5 +217,6 @@ struct WILC_WFI_mon_priv {extern struct net_device *WILC_WFI_devs[];void frmw_to_linux (u8 *buff,u32 size,u32 pkt_offset); +void linux_wlan_mac_indicate (int flag);#endif
drivers/staging/wilc1000/wilc_wlan.c +2 -7
@@ -33,7 +33,6 @@ typedef struct {wilc_wlan_os_func_t os_func;wilc_wlan_io_func_t io_func;wilc_wlan_net_func_t net_func; -wilc_wlan_indicate_func_t indicate_func;/** * host interface functions
@@ -1223,13 +1222,10 @@ static void wilc_wlan_handle_rxq(void)/** * Call back to indicate status... **/ -if (p->indicate_func.mac_indicate) { - p->indicate_func.mac_indicate (WILC_MAC_INDICATE_STATUS ); - } +linux_wlan_mac_indicate (WILC_MAC_INDICATE_STATUS ); }else if (rsp.type ==WILC_CFG_RSP_SCAN ) { -if (p->indicate_func.mac_indicate) - p->indicate_func.mac_indicate (WILC_MAC_INDICATE_SCAN ); +linux_wlan_mac_indicate (WILC_MAC_INDICATE_SCAN ); } } }
@@ -1978,7 +1974,6 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)memcpy ((void *)&g_wlan.os_func, (void *)&inp->os_func,sizeof (wilc_wlan_os_func_t));memcpy ((void *)&g_wlan.io_func, (void *)&inp->io_func,sizeof (wilc_wlan_io_func_t));memcpy ((void *)&g_wlan.net_func, (void *)&inp->net_func,sizeof (wilc_wlan_net_func_t)); -memcpy ((void *)&g_wlan.indicate_func, (void *)&inp->indicate_func,sizeof (wilc_wlan_net_func_t)); g_wlan.hif_lock = inp->os_context.hif_critical_section; g_wlan.txq_lock = inp->os_context.txq_critical_section;
drivers/staging/wilc1000/wilc_wlan_if.h +0 -4
@@ -103,9 +103,6 @@ typedef struct {void (*rx_complete)(void ); } wilc_wlan_net_func_t; -typedef struct { -void (*mac_indicate)(int ); -}wilc_wlan_indicate_func_t ;#define WILC_MAC_INDICATE_STATUS 0x1#define WILC_MAC_STATUS_INIT -1#define WILC_MAC_STATUS_READY 0
@@ -139,7 +136,6 @@ typedef struct {wilc_wlan_os_func_t os_func;wilc_wlan_io_func_t io_func;wilc_wlan_net_func_t net_func; -wilc_wlan_indicate_func_t indicate_func; } wilc_wlan_inp_t;struct tx_complete_data {
Signature · 1 line
1.9.1
PATCH 3/15 staging: wilc1000: remove function pointer rx_complete
In reply to Glen Leejust call the function linux_wlan_rx_complete directly. No need for a pointer to the functions. Remove rx_complete, wilc_wlan_net_func_t and net_func which are not used anymore.
Finally remove static from the function linux_wlan_rx_complete.
--- drivers/staging/wilc1000/linux_wlan.c | 5 +---- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + drivers/staging/wilc1000/wilc_wlan.c | 5 +---- drivers/staging/wilc1000/wilc_wlan_if.h | 5 ----- 4 files changed, 3 insertions(+), 13 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +1 -4
@@ -555,7 +555,7 @@ static int linux_wlan_txq_task(void *vp)return 0 ; } -static void linux_wlan_rx_complete (void ) +void linux_wlan_rx_complete (void ) {PRINT_D (RX_DBG ,"RX completed\n" ); }
@@ -1092,9 +1092,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic) nwi->io_func.u.spi.spi_trx = linux_spi_write_read; nwi->io_func.u.spi.spi_max_speed = linux_spi_set_max_speed;#endif - -/*for now - to be revised*/ - nwi->net_func.rx_complete = linux_wlan_rx_complete; }int wlan_initialize_threads (perInterface_wlan_t *nic)
drivers/staging/wilc1000/wilc_wfi_netdevice.h +1 -0
@@ -218,5 +218,6 @@ struct WILC_WFI_mon_priv {extern struct net_device *WILC_WFI_devs[];void frmw_to_linux (u8 *buff,u32 size,u32 pkt_offset);void linux_wlan_mac_indicate (int flag); +void linux_wlan_rx_complete (void );#endif
drivers/staging/wilc1000/wilc_wlan.c +1 -4
@@ -32,7 +32,6 @@ typedef struct {**/ wilc_wlan_os_func_t os_func;wilc_wlan_io_func_t io_func; -wilc_wlan_net_func_t net_func;/** * host interface functions
@@ -1241,8 +1240,7 @@ static void wilc_wlan_handle_rxq(void)kfree (rqe);if (has_packet) { -if (p->net_func.rx_complete) - p->net_func.rx_complete (); +linux_wlan_rx_complete (); } }while (1 );
@@ -1973,7 +1971,6 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)**/ memcpy ((void *)&g_wlan.os_func, (void *)&inp->os_func,sizeof (wilc_wlan_os_func_t));memcpy ((void *)&g_wlan.io_func, (void *)&inp->io_func,sizeof (wilc_wlan_io_func_t)); -memcpy ((void *)&g_wlan.net_func, (void *)&inp->net_func,sizeof (wilc_wlan_net_func_t)); g_wlan.hif_lock = inp->os_context.hif_critical_section; g_wlan.txq_lock = inp->os_context.txq_critical_section;
drivers/staging/wilc1000/wilc_wlan_if.h +0 -5
@@ -99,10 +99,6 @@ typedef struct { } u; } wilc_wlan_io_func_t; -typedef struct { -void (*rx_complete)(void ); -}wilc_wlan_net_func_t ; -#define WILC_MAC_INDICATE_STATUS 0x1#define WILC_MAC_STATUS_INIT -1#define WILC_MAC_STATUS_READY 0
@@ -135,7 +131,6 @@ typedef struct {wilc_wlan_os_context_t os_context;wilc_wlan_os_func_t os_func;wilc_wlan_io_func_t io_func; -wilc_wlan_net_func_t net_func; } wilc_wlan_inp_t;struct tx_complete_data {
Signature · 1 line
1.9.1
PATCH 4/15 staging: wilc1000: remove function pointer os_debug
In reply to Glen LeeThis patch removes os_debug and call linux_wlan_dbg function instead of os_debug. Delete static from the linux_wlan_dbg.
--- drivers/staging/wilc1000/linux_wlan.c | 3 +-- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + drivers/staging/wilc1000/wilc_wlan.c | 3 +-- drivers/staging/wilc1000/wilc_wlan_if.h | 1 - 4 files changed, 3 insertions(+), 5 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +1 -2
@@ -376,7 +376,7 @@ static void deinit_irq(linux_wlan_t *nic)/* * OS functions */ -static void linux_wlan_dbg (u8 *buff) +void linux_wlan_dbg (u8 *buff) {PRINT_D (INIT_DBG ,"%d\n" , *buff); }
@@ -1072,7 +1072,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic) nwi->os_context.rxq_critical_section = (void *)&g_linux_wlan->rxq_cs; nwi->os_context.cfg_wait_event = (void *)&g_linux_wlan->cfg_event; - nwi->os_func.os_debug = linux_wlan_dbg; nwi->os_func.os_wait = linux_wlan_lock_timeout;#ifdef WILC_SDIO
drivers/staging/wilc1000/wilc_wfi_netdevice.h +1 -0
@@ -219,5 +219,6 @@ extern struct net_device *WILC_WFI_devs[];void frmw_to_linux (u8 *buff,u32 size,u32 pkt_offset);void linux_wlan_mac_indicate (int flag);void linux_wlan_rx_complete (void ); +void linux_wlan_dbg (u8 *buff);#endif
drivers/staging/wilc1000/wilc_wlan.c +1 -2
@@ -113,8 +113,7 @@ static void wilc_debug(u32 flag, char *fmt, ...)vsprintf (buf, fmt, args);va_end (args); -if (g_wlan.os_func.os_debug) - g_wlan.os_func.os_debug (buf); +linux_wlan_dbg (buf); } }
drivers/staging/wilc1000/wilc_wlan_if.h +0 -1
@@ -75,7 +75,6 @@ typedef struct { } sdio_cmd53_t;typedef struct { -void (*os_debug)(u8 *);int (*os_wait)(void *,u32 ); }wilc_wlan_os_func_t ;
Signature · 1 line
1.9.1
PATCH 5/15 staging: wilc1000: use g_linux_wlan->txq_spinlock not the pointer of it
In reply to Glen LeeUse spinlock variable g_linux_wlan->txq_spinlock itself instead of g_wlan.txq_spinlock which is pointer of g_linux_wlan->txq_spinlock. Delete os_context.txq_spin_lock, g_wlan.txq_spinlock and it's related codes.
--- drivers/staging/wilc1000/linux_wlan.c | 2 -- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + drivers/staging/wilc1000/wilc_wlan.c | 37 ++++++++++++--------------- drivers/staging/wilc1000/wilc_wlan_if.h | 1 - 4 files changed, 18 insertions(+), 23 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +0 -2
@@ -1062,8 +1062,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic) nwi->os_context.txq_add_to_head_critical_section = (void *)&g_linux_wlan->txq_add_to_head_cs; - nwi->os_context.txq_spin_lock = (void *)&g_linux_wlan->txq_spinlock; - nwi->os_context.txq_wait_event = (void *)&g_linux_wlan->txq_event;#if defined(MEMORY_STATIC )
drivers/staging/wilc1000/wilc_wfi_netdevice.h +1 -0
@@ -215,6 +215,7 @@ struct WILC_WFI_mon_priv {struct net_device *real_ndev; }; +extern linux_wlan_t *g_linux_wlan;extern struct net_device *WILC_WFI_devs[];void frmw_to_linux (u8 *buff,u32 size,u32 pkt_offset);void linux_wlan_mac_indicate (int flag);
drivers/staging/wilc1000/wilc_wlan.c +17 -20
@@ -70,7 +70,6 @@ typedef struct {void *txq_lock;struct semaphore *txq_add_to_head_lock; -void *txq_spinlock;unsigned long txq_spinlock_flags;struct txq_entry_t *txq_head;
@@ -179,7 +178,7 @@ static struct txq_entry_t *wilc_wlan_txq_remove_from_head(void)wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;unsigned long flags; -spin_lock_irqsave (p->txq_spinlock, flags); +spin_lock_irqsave (&g_linux_wlan->txq_spinlock, flags);if (p->txq_head) { tqe = p->txq_head; p->txq_head = tqe->next;
@@ -194,7 +193,7 @@ static struct txq_entry_t *wilc_wlan_txq_remove_from_head(void) }else { tqe =NULL ; } -spin_unlock_irqrestore (p->txq_spinlock, flags); +spin_unlock_irqrestore (&g_linux_wlan->txq_spinlock, flags);return tqe; }
@@ -202,7 +201,7 @@ static void wilc_wlan_txq_add_to_tail(struct txq_entry_t *tqe) {wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;unsigned long flags; -spin_lock_irqsave (p->txq_spinlock, flags); +spin_lock_irqsave (&g_linux_wlan->txq_spinlock, flags);if (p->txq_head ==NULL ) { tqe->next =NULL ;
@@ -218,7 +217,7 @@ static void wilc_wlan_txq_add_to_tail(struct txq_entry_t *tqe) p->txq_entries +=1 ;PRINT_D (TX_DBG ,"Number of entries in TxQ = %d\n" , p->txq_entries); -spin_unlock_irqrestore (p->txq_spinlock, flags); +spin_unlock_irqrestore (&g_linux_wlan->txq_spinlock, flags);/** * wake up TX queue
@@ -235,7 +234,7 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe)if (p->os_func.os_wait (p->txq_add_to_head_lock,CFG_PKTS_TIMEOUT ))return -1 ; -spin_lock_irqsave (p->txq_spinlock, flags); +spin_lock_irqsave (&g_linux_wlan->txq_spinlock, flags);if (p->txq_head ==NULL ) { tqe->next =NULL ;
@@ -251,7 +250,7 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) p->txq_entries +=1 ;PRINT_D (TX_DBG ,"Number of entries in TxQ = %d\n" , p->txq_entries); -spin_unlock_irqrestore (p->txq_spinlock, flags); +spin_unlock_irqrestore (&g_linux_wlan->txq_spinlock, flags);up (p->txq_add_to_head_lock);
@@ -352,9 +351,9 @@ static inline int remove_TCP_related(void)wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;unsigned long flags; -spin_lock_irqsave (p->txq_spinlock, flags); +spin_lock_irqsave (&g_linux_wlan->txq_spinlock, flags); -spin_unlock_irqrestore (p->txq_spinlock, flags); +spin_unlock_irqrestore (&g_linux_wlan->txq_spinlock, flags);return 0 ; }
@@ -368,7 +367,7 @@ static inline int tcp_process(struct txq_entry_t *tqe)wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;unsigned long flags; -spin_lock_irqsave (p->txq_spinlock, flags); +spin_lock_irqsave (&g_linux_wlan->txq_spinlock, flags); eth_hdr_ptr = &buffer[0 ]; h_proto =ntohs (*((unsigned short *)ð_hdr_ptr[12 ]));
@@ -416,7 +415,7 @@ static inline int tcp_process(struct txq_entry_t *tqe) }else { ret =0 ; } -spin_unlock_irqrestore (p->txq_spinlock, flags); +spin_unlock_irqrestore (&g_linux_wlan->txq_spinlock, flags);return ret; }
@@ -428,7 +427,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)u32 Dropped =0 ;wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan; -spin_lock_irqsave (p->txq_spinlock, p->txq_spinlock_flags); +spin_lock_irqsave (&g_linux_wlan->txq_spinlock, p->txq_spinlock_flags);for (i = PendingAcks_arrBase; i < (PendingAcks_arrBase + Pending_Acks); i++) {if (Pending_Acks_info[i].ack_num < Acks_keep_track_info[Pending_Acks_info[i].Session_index].Bigger_Ack_num) {struct txq_entry_t *tqe;
@@ -455,7 +454,8 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void) PendingAcks_arrBase =0 ; -spin_unlock_irqrestore (p->txq_spinlock, p->txq_spinlock_flags); +spin_unlock_irqrestore (&g_linux_wlan->txq_spinlock, + p->txq_spinlock_flags);while (Dropped >0 ) {/*consume the semaphore count of the removed packet*/
@@ -576,11 +576,11 @@ static struct txq_entry_t *wilc_wlan_txq_get_first(void)struct txq_entry_t *tqe;unsigned long flags; -spin_lock_irqsave (p->txq_spinlock, flags); +spin_lock_irqsave (&g_linux_wlan->txq_spinlock, flags); tqe = p->txq_head; -spin_unlock_irqrestore (p->txq_spinlock, flags); +spin_unlock_irqrestore (&g_linux_wlan->txq_spinlock, flags);return tqe;
@@ -588,12 +588,11 @@ static struct txq_entry_t *wilc_wlan_txq_get_first(void)static struct txq_entry_t *wilc_wlan_txq_get_next (struct txq_entry_t *tqe) { -wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;unsigned long flags; -spin_lock_irqsave (p->txq_spinlock, flags); +spin_lock_irqsave (&g_linux_wlan->txq_spinlock, flags); tqe = tqe->next; -spin_unlock_irqrestore (p->txq_spinlock, flags); +spin_unlock_irqrestore (&g_linux_wlan->txq_spinlock, flags);return tqe;
@@ -1975,8 +1974,6 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup) g_wlan.txq_add_to_head_lock = inp->os_context.txq_add_to_head_critical_section; - g_wlan.txq_spinlock = inp->os_context.txq_spin_lock; - g_wlan.rxq_lock = inp->os_context.rxq_critical_section; g_wlan.txq_wait = inp->os_context.txq_wait_event; g_wlan.cfg_wait = inp->os_context.cfg_wait_event;
drivers/staging/wilc1000/wilc_wlan_if.h +0 -1
@@ -114,7 +114,6 @@ typedef struct {void *txq_critical_section;void *txq_add_to_head_critical_section; -void *txq_spin_lock;void *txq_wait_event;
Signature · 1 line
1.9.1
PATCH 6/15 staging: wilc1000: use g_linux_wlan->rxq_cs for function arguemnt
In reply to Glen LeeUse mutex variable g_linux_wlan->rxq_cs instead of pointer varialbe. No need to make extra pointer variable for the mutex. Remove rxq_critical_section, rxq_lock and it's related codes.
--- drivers/staging/wilc1000/linux_wlan.c | 1 - drivers/staging/wilc1000/wilc_wlan.c | 10 ++++------ drivers/staging/wilc1000/wilc_wlan_if.h | 1 - 3 files changed, 4 insertions(+), 8 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +0 -1
@@ -1067,7 +1067,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic)#if defined(MEMORY_STATIC ) nwi->os_context.rx_buffer_size =LINUX_RX_SIZE ;#endif - nwi->os_context.rxq_critical_section = (void *)&g_linux_wlan->rxq_cs; nwi->os_context.cfg_wait_event = (void *)&g_linux_wlan->cfg_event; nwi->os_func.os_wait = linux_wlan_lock_timeout;
drivers/staging/wilc1000/wilc_wlan.c +4 -6
@@ -81,7 +81,6 @@ typedef struct {/** * RX queue **/ -struct mutex *rxq_lock;struct rxq_entry_t *rxq_head;struct rxq_entry_t *rxq_tail;int rxq_entries;
@@ -605,7 +604,7 @@ static int wilc_wlan_rxq_add(struct rxq_entry_t *rqe)if (p->quit)return 0 ; -mutex_lock (p->rxq_lock); +mutex_lock (&g_linux_wlan->rxq_cs);if (p->rxq_head ==NULL ) {PRINT_D (RX_DBG ,"Add to Queue head\n" ); rqe->next =NULL ;
@@ -619,7 +618,7 @@ static int wilc_wlan_rxq_add(struct rxq_entry_t *rqe) } p->rxq_entries +=1 ;PRINT_D (RX_DBG ,"Number of queue entries: %d\n" , p->rxq_entries); -mutex_unlock (p->rxq_lock); +mutex_unlock (&g_linux_wlan->rxq_cs);return p->rxq_entries; }
@@ -631,12 +630,12 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(void)if (p->rxq_head) {struct rxq_entry_t *rqe; -mutex_lock (p->rxq_lock); +mutex_lock (&g_linux_wlan->rxq_cs); rqe = p->rxq_head; p->rxq_head = p->rxq_head->next; p->rxq_entries -=1 ;PRINT_D (RX_DBG ,"RXQ entries decreased\n" ); -mutex_unlock (p->rxq_lock); +mutex_unlock (&g_linux_wlan->rxq_cs);return rqe; }PRINT_D (RX_DBG ,"Nothing to get from Q\n" );
@@ -1974,7 +1973,6 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup) g_wlan.txq_add_to_head_lock = inp->os_context.txq_add_to_head_critical_section; - g_wlan.rxq_lock = inp->os_context.rxq_critical_section; g_wlan.txq_wait = inp->os_context.txq_wait_event; g_wlan.cfg_wait = inp->os_context.cfg_wait_event; g_wlan.tx_buffer_size = inp->os_context.tx_buffer_size;
drivers/staging/wilc1000/wilc_wlan_if.h +0 -1
@@ -120,7 +120,6 @@ typedef struct {#if defined(MEMORY_STATIC )u32 rx_buffer_size;#endif -void *rxq_critical_section;struct semaphore *cfg_wait_event; } wilc_wlan_os_context_t;
Signature · 1 line
1.9.1
PATCH 7/15 staging: wilc1000: remove pointer variable of g_linux_wlan->txq_event
In reply to Glen LeeRemove variable txq_wait and txq_wait_event which are pointer varialbe of g_linux_wlan->txq_event. No need to have extra pointer varialbe. Just use g_linux_wlan->txq_event. Remove os_context.txq_wait_event, txq_wait and it's related codes.
--- drivers/staging/wilc1000/linux_wlan.c | 2 -- drivers/staging/wilc1000/wilc_wlan.c | 8 +++----- drivers/staging/wilc1000/wilc_wlan_if.h | 2 -- 3 files changed, 3 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +0 -2
@@ -1062,8 +1062,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic) nwi->os_context.txq_add_to_head_critical_section = (void *)&g_linux_wlan->txq_add_to_head_cs; - nwi->os_context.txq_wait_event = (void *)&g_linux_wlan->txq_event; -#if defined(MEMORY_STATIC ) nwi->os_context.rx_buffer_size =LINUX_RX_SIZE ;#endif
drivers/staging/wilc1000/wilc_wlan.c +3 -5
@@ -75,7 +75,6 @@ typedef struct {struct txq_entry_t *txq_head;struct txq_entry_t *txq_tail;int txq_entries; -void *txq_wait;int txq_exit;/**
@@ -223,7 +222,7 @@ static void wilc_wlan_txq_add_to_tail(struct txq_entry_t *tqe)**/ PRINT_D (TX_DBG ,"Wake the txq_handling\n" ); -up (p->txq_wait); +up (&g_linux_wlan->txq_event); }static int wilc_wlan_txq_add_to_head (struct txq_entry_t *tqe)
@@ -256,7 +255,7 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe)/** * wake up TX queue **/ -up (p->txq_wait); +up (&g_linux_wlan->txq_event);PRINT_D (TX_DBG ,"Wake up the txq_handler\n" );return 0 ;
@@ -458,7 +457,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)while (Dropped >0 ) {/*consume the semaphore count of the removed packet*/ - p->os_func.os_wait (p->txq_wait,1 ); + p->os_func.os_wait (&g_linux_wlan->txq_event,1 ); Dropped--; }
@@ -1973,7 +1972,6 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup) g_wlan.txq_add_to_head_lock = inp->os_context.txq_add_to_head_critical_section; - g_wlan.txq_wait = inp->os_context.txq_wait_event; g_wlan.cfg_wait = inp->os_context.cfg_wait_event; g_wlan.tx_buffer_size = inp->os_context.tx_buffer_size;#if defined (MEMORY_STATIC )
drivers/staging/wilc1000/wilc_wlan_if.h +0 -2
@@ -115,8 +115,6 @@ typedef struct {void *txq_add_to_head_critical_section; -void *txq_wait_event; -#if defined(MEMORY_STATIC )u32 rx_buffer_size;#endif
Signature · 1 line
1.9.1
PATCH 8/15 staging: wilc1000: remove pointer varialbe cfg_wait and cfg_wait_event
In reply to Glen LeeThis patch removes cfg_wait and cfg_wait_event which are pointer of g_linux_wlan->cfg_event. No need to have pointer varialbe of it. Just use g_linux_wlan->cfg_event.
--- drivers/staging/wilc1000/linux_wlan.c | 2 -- drivers/staging/wilc1000/wilc_wlan.c | 14 +++++++------- drivers/staging/wilc1000/wilc_wlan_if.h | 2 -- 3 files changed, 7 insertions(+), 11 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +0 -2
@@ -1065,8 +1065,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic)#if defined(MEMORY_STATIC ) nwi->os_context.rx_buffer_size =LINUX_RX_SIZE ;#endif - nwi->os_context.cfg_wait_event = (void *)&g_linux_wlan->cfg_event; - nwi->os_func.os_wait = linux_wlan_lock_timeout;#ifdef WILC_SDIO
drivers/staging/wilc1000/wilc_wlan.c +7 -7
@@ -47,7 +47,6 @@ typedef struct {wilc_cfg_frame_t cfg_frame;u32 cfg_frame_offset;int cfg_seq_no; -void *cfg_wait;/** * RX buffer
@@ -485,7 +484,7 @@ static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size)PRINT_D (TX_DBG ,"Adding config packet ...\n" );if (p->quit) {PRINT_D (TX_DBG ,"Return due to clear function\n" ); -up (p->cfg_wait); +up (&g_linux_wlan->cfg_event);return 0 ; }
@@ -1137,7 +1136,7 @@ static void wilc_wlan_handle_rxq(void) do { if (p->quit) { PRINT_D(RX_DBG, "exit 1st do-while due to Clean_UP function\n"); - up(p->cfg_wait); + up(&g_linux_wlan->cfg_event); break; } rqe = wilc_wlan_rxq_remove();
@@ -1211,7 +1210,7 @@ static void wilc_wlan_handle_rxq(void)**/ PRINT_D (RX_DBG ,"p->cfg_seq_no = %d - rsp.seq_no = %d\n" , p->cfg_seq_no, rsp.seq_no);if (p->cfg_seq_no == rsp.seq_no) { -up (p->cfg_wait); +up (&g_linux_wlan->cfg_event); } }else if (rsp.type ==WILC_CFG_RSP_STATUS ) {/**
@@ -1781,7 +1780,8 @@ static int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, inif (wilc_wlan_cfg_commit (WILC_CFG_SET , drvHandler)) ret_size =0 ; -if (p->os_func.os_wait (p->cfg_wait,CFG_PKTS_TIMEOUT )) { +if (p->os_func.os_wait (&g_linux_wlan->cfg_event, +CFG_PKTS_TIMEOUT )) {PRINT_D (TX_DBG ,"Set Timed Out\n" ); ret_size =0 ; }
@@ -1818,7 +1818,8 @@ static int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler) ret_size =0 ; -if (p->os_func.os_wait (p->cfg_wait,CFG_PKTS_TIMEOUT )) { +if (p->os_func.os_wait (&g_linux_wlan->cfg_event, +CFG_PKTS_TIMEOUT )) {PRINT_D (TX_DBG ,"Get Timed Out\n" ); ret_size =0 ; }
@@ -1972,7 +1973,6 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup) g_wlan.txq_add_to_head_lock = inp->os_context.txq_add_to_head_critical_section; - g_wlan.cfg_wait = inp->os_context.cfg_wait_event; g_wlan.tx_buffer_size = inp->os_context.tx_buffer_size;#if defined (MEMORY_STATIC ) g_wlan.rx_buffer_size = inp->os_context.rx_buffer_size;
drivers/staging/wilc1000/wilc_wlan_if.h +0 -2
@@ -118,8 +118,6 @@ typedef struct {#if defined(MEMORY_STATIC )u32 rx_buffer_size;#endif - -struct semaphore *cfg_wait_event; } wilc_wlan_os_context_t; typedef struct {
Signature · 1 line
1.9.1
PATCH 9/15 staging: wilc1000: remove pointer variables of txq_add_to_head_cs
In reply to Glen LeeThis patch removes txq_add_to_head_critical_section and txq_add_to_head_lock which are pointer of g_linux_wlan->txq_add_to_head_cs.
Just use g_linux_wlan->txq_add_to_head_cs as argument of function.
--- drivers/staging/wilc1000/linux_wlan.c | 3 --- drivers/staging/wilc1000/wilc_wlan.c | 13 ++++++------- drivers/staging/wilc1000/wilc_wlan_if.h | 3 --- 3 files changed, 6 insertions(+), 13 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +0 -3
@@ -1059,9 +1059,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic) nwi->os_context.os_private = (void *)nic; nwi->os_context.tx_buffer_size =LINUX_TX_SIZE ; nwi->os_context.txq_critical_section = (void *)&g_linux_wlan->txq_cs; - - nwi->os_context.txq_add_to_head_critical_section = (void *)&g_linux_wlan->txq_add_to_head_cs; -#if defined(MEMORY_STATIC ) nwi->os_context.rx_buffer_size =LINUX_RX_SIZE ;#endif
drivers/staging/wilc1000/wilc_wlan.c +6 -7
@@ -68,7 +68,6 @@ typedef struct {**/ void *txq_lock; -struct semaphore *txq_add_to_head_lock;unsigned long txq_spinlock_flags;struct txq_entry_t *txq_head;
@@ -228,7 +227,8 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) {wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;unsigned long flags; -if (p->os_func.os_wait (p->txq_add_to_head_lock,CFG_PKTS_TIMEOUT )) +if (p->os_func.os_wait (&g_linux_wlan->txq_add_to_head_cs, +CFG_PKTS_TIMEOUT ))return -1 ;spin_lock_irqsave (&g_linux_wlan->txq_spinlock, flags);
@@ -248,7 +248,7 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe)PRINT_D (TX_DBG ,"Number of entries in TxQ = %d\n" , p->txq_entries);spin_unlock_irqrestore (&g_linux_wlan->txq_spinlock, flags); -up (p->txq_add_to_head_lock); +up (&g_linux_wlan->txq_add_to_head_cs);/**
@@ -843,7 +843,8 @@ static int wilc_wlan_handle_txq(u32 *pu32TxqCount)if (p->quit)break ; - p->os_func.os_wait (p->txq_add_to_head_lock,CFG_PKTS_TIMEOUT ); + p->os_func.os_wait (&g_linux_wlan->txq_add_to_head_cs, +CFG_PKTS_TIMEOUT );#ifdef TCP_ACK_FILTER wilc_wlan_txq_filter_dup_tcp_ack ();#endif
@@ -1112,7 +1113,7 @@ _end_:if (ret !=1 )break ; }while (0 ); -up (p->txq_add_to_head_lock); +up (&g_linux_wlan->txq_add_to_head_cs); p->txq_exit =1 ;PRINT_D (TX_DBG ,"THREAD: Exiting txq\n" );
@@ -1971,8 +1972,6 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup) g_wlan.hif_lock = inp->os_context.hif_critical_section; g_wlan.txq_lock = inp->os_context.txq_critical_section; - g_wlan.txq_add_to_head_lock = inp->os_context.txq_add_to_head_critical_section; - g_wlan.tx_buffer_size = inp->os_context.tx_buffer_size;#if defined (MEMORY_STATIC ) g_wlan.rx_buffer_size = inp->os_context.rx_buffer_size;
drivers/staging/wilc1000/wilc_wlan_if.h +0 -3
@@ -112,9 +112,6 @@ typedef struct {u32 tx_buffer_size;void *txq_critical_section; - -void *txq_add_to_head_critical_section; -#if defined(MEMORY_STATIC )u32 rx_buffer_size;#endif
Signature · 1 line
1.9.1
PATCH 10/15 staging: wilc1000: remove pointer varialbes of hif_cs
In reply to Glen LeeRemove hif_lock and hif_critical_section which are pointer of g_linux_wlan->hif_cs. Remove also it's related codes. Just use mutex varialbe g_linux_wlan->hif_cs.
--- drivers/staging/wilc1000/linux_wlan.c | 1 - drivers/staging/wilc1000/wilc_wlan.c | 10 ++++------ drivers/staging/wilc1000/wilc_wlan_if.h | 3 --- 3 files changed, 4 insertions(+), 10 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +0 -1
@@ -1055,7 +1055,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic)PRINT_D (INIT_DBG ,"Linux to Wlan services ...\n" ); - nwi->os_context.hif_critical_section = (void *)&g_linux_wlan->hif_cs; nwi->os_context.os_private = (void *)nic; nwi->os_context.tx_buffer_size =LINUX_TX_SIZE ; nwi->os_context.txq_critical_section = (void *)&g_linux_wlan->txq_cs;
drivers/staging/wilc1000/wilc_wlan.c +4 -6
@@ -37,7 +37,6 @@ typedef struct {* host interface functions **/ wilc_hif_func_t hif_func; -struct mutex *hif_lock;/** * configuration interface functions
@@ -120,7 +119,7 @@ static CHIP_PS_STATE_T genuChipPSstate = CHIP_WAKEDUP;static inline void acquire_bus (BUS_ACQUIRE_T acquire) { -mutex_lock (g_wlan.hif_lock); +mutex_lock (&g_linux_wlan->hif_cs);#ifndef WILC_OPTIMIZE_SLEEP_INT if (genuChipPSstate != CHIP_WAKEDUP)#endif
@@ -136,7 +135,7 @@ static inline void release_bus(BUS_RELEASE_T release)if (release ==RELEASE_ALLOW_SLEEP )chip_allow_sleep ();#endif -mutex_unlock (g_wlan.hif_lock); +mutex_unlock (&g_linux_wlan->hif_cs); }/******************************************** *
@@ -1969,7 +1968,6 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)**/ memcpy ((void *)&g_wlan.os_func, (void *)&inp->os_func,sizeof (wilc_wlan_os_func_t));memcpy ((void *)&g_wlan.io_func, (void *)&inp->io_func,sizeof (wilc_wlan_io_func_t)); - g_wlan.hif_lock = inp->os_context.hif_critical_section; g_wlan.txq_lock = inp->os_context.txq_critical_section; g_wlan.tx_buffer_size = inp->os_context.tx_buffer_size;
@@ -2088,7 +2086,7 @@ u16 Set_machw_change_vir_if(bool bValue)u32 reg;/*Reset WILC_CHANGING_VIR_IF register to allow adding futrue keys to CE H/W*/ -mutex_lock ((&g_wlan)->hif_lock); +mutex_lock (&g_linux_wlan->hif_cs); ret = (&g_wlan)->hif_func.hif_read_reg (WILC_CHANGING_VIR_IF , ®);if (!ret) {PRINT_ER ("Error while Reading reg WILC_CHANGING_VIR_IF\n" );
@@ -2104,7 +2102,7 @@ u16 Set_machw_change_vir_if(bool bValue)if (!ret) {PRINT_ER ("Error while writing reg WILC_CHANGING_VIR_IF\n" ); } -mutex_unlock ((&g_wlan)->hif_lock); +mutex_unlock (&g_linux_wlan->hif_cs);return ret; }
drivers/staging/wilc1000/wilc_wlan_if.h +0 -3
@@ -107,9 +107,6 @@ typedef struct { typedef struct { void *os_private; - - struct mutex *hif_critical_section; - u32 tx_buffer_size; void *txq_critical_section; #if defined(MEMORY_STATIC)
Signature · 1 line
1.9.1
PATCH 11/15 staging: wilc1000: remove variable tx_buffer_size
In reply to Glen LeeThis patch removes unnecessary two variables tx_buffer_size and just use LINUX_TX_SIZE as argument.
--- drivers/staging/wilc1000/linux_wlan.c | 1 - drivers/staging/wilc1000/wilc_wlan.c | 6 ++---- drivers/staging/wilc1000/wilc_wlan_if.h | 1 - 3 files changed, 2 insertions(+), 6 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +0 -1
@@ -1056,7 +1056,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic)PRINT_D (INIT_DBG ,"Linux to Wlan services ...\n" ); nwi->os_context.os_private = (void *)nic; - nwi->os_context.tx_buffer_size =LINUX_TX_SIZE ; nwi->os_context.txq_critical_section = (void *)&g_linux_wlan->txq_cs;#if defined(MEMORY_STATIC ) nwi->os_context.rx_buffer_size =LINUX_RX_SIZE ;
drivers/staging/wilc1000/wilc_wlan.c +2 -4
@@ -58,7 +58,6 @@ typedef struct {/** * TX buffer **/ -u32 tx_buffer_size;u8 *tx_buffer;u32 tx_buffer_offset;
@@ -873,7 +872,7 @@ static int wilc_wlan_handle_txq(u32 *pu32TxqCount)if (vmm_sz &0x3 ) {/* has to be word aligned */ vmm_sz = (vmm_sz +4 ) & ~0x3 ; } -if ((sum + vmm_sz) > p->tx_buffer_size) { +if ((sum + vmm_sz) >LINUX_TX_SIZE ) {break ; }PRINT_D (TX_DBG ,"VMM Size AFTER alignment = %d\n" , vmm_sz);
@@ -1970,7 +1969,6 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)memcpy ((void *)&g_wlan.io_func, (void *)&inp->io_func,sizeof (wilc_wlan_io_func_t)); g_wlan.txq_lock = inp->os_context.txq_critical_section; - g_wlan.tx_buffer_size = inp->os_context.tx_buffer_size;#if defined (MEMORY_STATIC ) g_wlan.rx_buffer_size = inp->os_context.rx_buffer_size;#endif
@@ -2017,7 +2015,7 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)* alloc tx, rx buffer **/ if (g_wlan.tx_buffer ==NULL ) - g_wlan.tx_buffer =kmalloc (g_wlan.tx_buffer_size,GFP_KERNEL ); + g_wlan.tx_buffer =kmalloc (LINUX_TX_SIZE ,GFP_KERNEL );PRINT_D (TX_DBG ,"g_wlan.tx_buffer = %p\n" , g_wlan.tx_buffer);if (g_wlan.tx_buffer ==NULL ) {
drivers/staging/wilc1000/wilc_wlan_if.h +0 -1
@@ -107,7 +107,6 @@ typedef struct { typedef struct { void *os_private; - u32 tx_buffer_size; void *txq_critical_section; #if defined(MEMORY_STATIC) u32 rx_buffer_size;
Signature · 1 line
1.9.1
PATCH 12/15 staging: wilc1000: remove variable rx_buffer_size
In reply to Glen LeeThis patch removes two variables rx_buffer_size and use LINUX_RX_SIZE as argument.
--- drivers/staging/wilc1000/linux_wlan.c | 3 --- drivers/staging/wilc1000/wilc_wlan.c | 9 ++------- drivers/staging/wilc1000/wilc_wlan_if.h | 3 --- 3 files changed, 2 insertions(+), 13 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +0 -3
@@ -1057,9 +1057,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic) nwi->os_context.os_private = (void *)nic; nwi->os_context.txq_critical_section = (void *)&g_linux_wlan->txq_cs; -#if defined(MEMORY_STATIC ) - nwi->os_context.rx_buffer_size =LINUX_RX_SIZE ; -#endif nwi->os_func.os_wait = linux_wlan_lock_timeout;#ifdef WILC_SDIO
drivers/staging/wilc1000/wilc_wlan.c +2 -7
@@ -51,7 +51,6 @@ typedef struct {* RX buffer **/ #ifdef MEMORY_STATIC -u32 rx_buffer_size;u8 *rx_buffer;u32 rx_buffer_offset;#endif
@@ -1308,7 +1307,7 @@ static void wilc_wlan_handle_isr_ext(u32 int_status)if (size >0 ) {#ifdef MEMORY_STATIC -if (p->rx_buffer_size - offset < size) +if (LINUX_RX_SIZE - offset < size) offset =0 ;if (p->rx_buffer)
@@ -1968,10 +1967,6 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)memcpy ((void *)&g_wlan.os_func, (void *)&inp->os_func,sizeof (wilc_wlan_os_func_t));memcpy ((void *)&g_wlan.io_func, (void *)&inp->io_func,sizeof (wilc_wlan_io_func_t)); g_wlan.txq_lock = inp->os_context.txq_critical_section; - -#if defined (MEMORY_STATIC ) - g_wlan.rx_buffer_size = inp->os_context.rx_buffer_size; -#endif /*** * host interface init **/
@@ -2028,7 +2023,7 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)/* rx_buffer is not used unless we activate USE_MEM STATIC which is not applicable, allocating such memory is useless*/ #if defined (MEMORY_STATIC )if (g_wlan.rx_buffer ==NULL ) - g_wlan.rx_buffer =kmalloc (g_wlan.rx_buffer_size,GFP_KERNEL ); + g_wlan.rx_buffer =kmalloc (LINUX_RX_SIZE ,GFP_KERNEL );PRINT_D (TX_DBG ,"g_wlan.rx_buffer =%p\n" , g_wlan.rx_buffer);if (g_wlan.rx_buffer ==NULL ) {/* ENOBUFS 105 */
drivers/staging/wilc1000/wilc_wlan_if.h +0 -3
@@ -108,9 +108,6 @@ typedef struct {typedef struct {void *os_private;void *txq_critical_section; -#if defined(MEMORY_STATIC ) -u32 rx_buffer_size; -#endif }wilc_wlan_os_context_t ; typedef struct {
Signature · 1 line
1.9.1
PATCH 13/15 staging: wilc1000: remove mutex txq_cs and it's related codes
In reply to Glen Leemutex txq_cs is never used in the driver. txq_cs, txq_critical_section and txq_lock have same pointer so just delete them and it's related codes.
--- drivers/staging/wilc1000/linux_wlan.c | 5 ----- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 - drivers/staging/wilc1000/wilc_wlan.c | 2 -- drivers/staging/wilc1000/wilc_wlan_if.h | 1 - 4 files changed, 9 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +0 -5
@@ -1020,7 +1020,6 @@ int wlan_init_locks(linux_wlan_t *p_nic)mutex_init (&g_linux_wlan->hif_cs);mutex_init (&g_linux_wlan->rxq_cs); -mutex_init (&g_linux_wlan->txq_cs);spin_lock_init (&g_linux_wlan->txq_spinlock);sema_init (&g_linux_wlan->txq_add_to_head_cs,1 );
@@ -1045,9 +1044,6 @@ static int wlan_deinit_locks(linux_wlan_t *nic)if (&g_linux_wlan->rxq_cs !=NULL )mutex_destroy (&g_linux_wlan->rxq_cs); -if (&g_linux_wlan->txq_cs !=NULL ) -mutex_destroy (&g_linux_wlan->txq_cs); -return 0 ; }void linux_to_wlan (wilc_wlan_inp_t *nwi,linux_wlan_t *nic)
@@ -1056,7 +1052,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic)PRINT_D (INIT_DBG ,"Linux to Wlan services ...\n" ); nwi->os_context.os_private = (void *)nic; - nwi->os_context.txq_critical_section = (void *)&g_linux_wlan->txq_cs; nwi->os_func.os_wait = linux_wlan_lock_timeout;#ifdef WILC_SDIO
drivers/staging/wilc1000/wilc_wfi_netdevice.h +0 -1
@@ -169,7 +169,6 @@ typedef struct {u8 u8NoIfcs;tstrInterfaceInfo strInterfaceInfo[NUM_CONCURRENT_IFC ];u8 open_ifcs; -struct mutex txq_cs;struct semaphore txq_add_to_head_cs;spinlock_t txq_spinlock;
drivers/staging/wilc1000/wilc_wlan.c +0 -2
@@ -63,7 +63,6 @@ typedef struct {/** * TX queue **/ -void *txq_lock;unsigned long txq_spinlock_flags;
@@ -1966,7 +1965,6 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)**/ memcpy ((void *)&g_wlan.os_func, (void *)&inp->os_func,sizeof (wilc_wlan_os_func_t));memcpy ((void *)&g_wlan.io_func, (void *)&inp->io_func,sizeof (wilc_wlan_io_func_t)); - g_wlan.txq_lock = inp->os_context.txq_critical_section;/*** * host interface init **/
drivers/staging/wilc1000/wilc_wlan_if.h +0 -1
@@ -107,7 +107,6 @@ typedef struct {typedef struct {void *os_private; -void *txq_critical_section; }wilc_wlan_os_context_t ; typedef struct {
Signature · 1 line
1.9.1
PATCH 14/15 staging: wilc1000: remove function pointer os_wait
In reply to Glen LeeThis patch removes function pointer os_wait which is pointer of linux_wlan_lock_timeout and just call the real name function directly. Remove also static from linux_wlan_lock_timeout declaration. As os_wait is deleted, structure wilc_wlan_os_func_t is useless. Delete wilc_wlan_os_func_t, os_func and it's related codes.
--- drivers/staging/wilc1000/linux_wlan.c | 3 +-- drivers/staging/wilc1000/wilc_sdio.c | 2 -- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + drivers/staging/wilc1000/wilc_wlan.c | 20 +++++++++----------- drivers/staging/wilc1000/wilc_wlan_if.h | 5 ----- 5 files changed, 11 insertions(+), 20 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +1 -2
@@ -381,7 +381,7 @@ void linux_wlan_dbg(u8 *buff)PRINT_D (INIT_DBG ,"%d\n" , *buff); } -static int linux_wlan_lock_timeout (void *vp,u32 timeout) +int linux_wlan_lock_timeout (void *vp,u32 timeout) {int error =-1 ;
@@ -1052,7 +1052,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic)PRINT_D (INIT_DBG ,"Linux to Wlan services ...\n" ); nwi->os_context.os_private = (void *)nic; - nwi->os_func.os_wait = linux_wlan_lock_timeout;#ifdef WILC_SDIO nwi->io_func.io_type =HIF_SDIO ;
drivers/staging/wilc1000/wilc_sdio.c +0 -2
@@ -14,7 +14,6 @@ typedef struct { void *os_context; - wilc_wlan_os_func_t os_func; u32 block_size; int (*sdio_cmd52)(sdio_cmd52_t *); int (*sdio_cmd53)(sdio_cmd53_t *);
@@ -586,7 +585,6 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) g_sdio.dPrint = func; g_sdio.os_context = inp->os_context.os_private; -memcpy ((void *)&g_sdio.os_func, (void *)&inp->os_func,sizeof (wilc_wlan_os_func_t));if (inp->io_func.io_init) {if (!inp->io_func.io_init (g_sdio.os_context)) {
drivers/staging/wilc1000/wilc_wfi_netdevice.h +1 -0
@@ -220,5 +220,6 @@ void frmw_to_linux(u8 *buff, u32 size, u32 pkt_offset);void linux_wlan_mac_indicate (int flag);void linux_wlan_rx_complete (void );void linux_wlan_dbg (u8 *buff); +int linux_wlan_lock_timeout (void *vp,u32 timeout);#endif
drivers/staging/wilc1000/wilc_wlan.c +9 -11
@@ -30,7 +30,6 @@ typedef struct {/** * input interface functions **/ -wilc_wlan_os_func_t os_func;wilc_wlan_io_func_t io_func;/**
@@ -223,8 +222,8 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) {wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;unsigned long flags; -if (p->os_func.os_wait (&g_linux_wlan->txq_add_to_head_cs, -CFG_PKTS_TIMEOUT )) +if (linux_wlan_lock_timeout (&g_linux_wlan->txq_add_to_head_cs, +CFG_PKTS_TIMEOUT ))return -1 ;spin_lock_irqsave (&g_linux_wlan->txq_spinlock, flags);
@@ -452,7 +451,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)while (Dropped >0 ) {/*consume the semaphore count of the removed packet*/ - p->os_func.os_wait (&g_linux_wlan->txq_event,1 ); +linux_wlan_lock_timeout (&g_linux_wlan->txq_event,1 ); Dropped--; }
@@ -839,8 +838,8 @@ static int wilc_wlan_handle_txq(u32 *pu32TxqCount)if (p->quit)break ; - p->os_func.os_wait (&g_linux_wlan->txq_add_to_head_cs, -CFG_PKTS_TIMEOUT ); +linux_wlan_lock_timeout (&g_linux_wlan->txq_add_to_head_cs, +CFG_PKTS_TIMEOUT );#ifdef TCP_ACK_FILTER wilc_wlan_txq_filter_dup_tcp_ack ();#endif
@@ -1777,8 +1776,8 @@ static int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, inif (wilc_wlan_cfg_commit (WILC_CFG_SET , drvHandler)) ret_size =0 ; -if (p->os_func.os_wait (&g_linux_wlan->cfg_event, -CFG_PKTS_TIMEOUT )) { +if (linux_wlan_lock_timeout (&g_linux_wlan->cfg_event, +CFG_PKTS_TIMEOUT )) {PRINT_D (TX_DBG ,"Set Timed Out\n" ); ret_size =0 ; }
@@ -1815,8 +1814,8 @@ static int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler) ret_size =0 ; -if (p->os_func.os_wait (&g_linux_wlan->cfg_event, -CFG_PKTS_TIMEOUT )) { +if (linux_wlan_lock_timeout (&g_linux_wlan->cfg_event, +CFG_PKTS_TIMEOUT )) {PRINT_D (TX_DBG ,"Get Timed Out\n" ); ret_size =0 ; }
@@ -1963,7 +1962,6 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)/** * store the input **/ -memcpy ((void *)&g_wlan.os_func, (void *)&inp->os_func,sizeof (wilc_wlan_os_func_t));memcpy ((void *)&g_wlan.io_func, (void *)&inp->io_func,sizeof (wilc_wlan_io_func_t));/*** * host interface init
drivers/staging/wilc1000/wilc_wlan_if.h +0 -5
@@ -75,10 +75,6 @@ typedef struct { } sdio_cmd53_t; typedef struct { -int (*os_wait)(void *,u32 ); -}wilc_wlan_os_func_t ; - -typedef struct { int io_type; int (*io_init)(void *); void (*io_deinit)(void *);
@@ -111,7 +107,6 @@ typedef struct {typedef struct {wilc_wlan_os_context_t os_context; -wilc_wlan_os_func_t os_func;wilc_wlan_io_func_t io_func; }wilc_wlan_inp_t ;
Signature · 1 line
1.9.1
PATCH 15/15 staging: wilc1000: remove variable cif_func
In reply to Glen LeeThis patch removes variable cif_func and use mac_cfg directly. No need to have another pointer variable.
--- drivers/staging/wilc1000/wilc_wlan.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/staging/wilc1000/wilc_wlan.c +5 -8
@@ -40,7 +40,6 @@ typedef struct {/** * configuration interface functions **/ -wilc_cfg_func_t cif_func;int cfg_frame_in_use;wilc_cfg_frame_t cfg_frame;u32 cfg_frame_offset;
@@ -1199,7 +1198,7 @@ static void wilc_wlan_handle_rxq(void) - p->cif_func.rx_indicate (&buffer[pkt_offset + offset], pkt_len, &rsp); + mac_cfg.rx_indicate (&buffer[pkt_offset + offset], pkt_len, &rsp);if (rsp.type ==WILC_CFG_RSP ) {/** * wake up the waiting task...
@@ -1764,7 +1763,8 @@ static int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, in p->cfg_frame_offset =0 ; offset = p->cfg_frame_offset; - ret_size = p->cif_func.cfg_wid_set (p->cfg_frame.frame, offset, (u16 )wid, buffer, buffer_size); + ret_size = mac_cfg.cfg_wid_set (p->cfg_frame.frame, offset, (u16 )wid, + buffer, buffer_size); offset += ret_size; p->cfg_frame_offset = offset;
@@ -1803,7 +1803,7 @@ static int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler) p->cfg_frame_offset =0 ; offset = p->cfg_frame_offset; - ret_size = p->cif_func.cfg_wid_get (p->cfg_frame.frame, offset, (u16 )wid); + ret_size = mac_cfg.cfg_wid_get (p->cfg_frame.frame, offset, (u16 )wid); offset += ret_size; p->cfg_frame_offset = offset;
@@ -1830,10 +1830,9 @@ static int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler)static int wilc_wlan_cfg_get_val (u32 wid,u8 *buffer,u32 buffer_size) { -wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;int ret; - ret = p->cif_func.cfg_wid_get_val ((u16 )wid, buffer, buffer_size); + ret = mac_cfg.cfg_wid_get_val ((u16 )wid, buffer, buffer_size);return ret; }
@@ -1999,8 +1998,6 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup) ret =-105 ; goto _fail_; } -memcpy ((void *)&g_wlan.cif_func, &mac_cfg,sizeof (wilc_cfg_func_t)); -/** * alloc tx, rx buffer
Signature · 1 line
1.9.1