]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/staging/winbond/wblinux.c
Staging: w35und: clean up wblinux.c a bit
[linux-2.6-omap-h63xx.git] / drivers / staging / winbond / wblinux.c
1 //============================================================================
2 //  Copyright (c) 1996-2005 Winbond Electronic Corporation
3 //
4 //  Module Name:
5 //    wblinux.c
6 //
7 //  Abstract:
8 //    Linux releated routines
9 //
10 //============================================================================
11 #include <linux/netdevice.h>
12
13 #include "mds_f.h"
14 #include "mto_f.h"
15 #include "os_common.h"
16 #include "wbhal_f.h"
17 #include "wblinux_f.h"
18
19 void
20 WBLINUX_stop(  struct wbsoft_priv * adapter )
21 {
22         struct sk_buff *pSkb;
23
24         if (atomic_inc_return(&adapter->ThreadCount) == 1) {
25                 // Shutdown module immediately
26                 adapter->shutdown = 1;
27
28                 while (adapter->skb_array[ adapter->skb_GetIndex ]) {
29                         // Trying to free the un-sending packet
30                         pSkb = adapter->skb_array[ adapter->skb_GetIndex ];
31                         adapter->skb_array[ adapter->skb_GetIndex ] = NULL;
32                         if( in_irq() )
33                                 dev_kfree_skb_irq( pSkb );
34                         else
35                                 dev_kfree_skb( pSkb );
36
37                         adapter->skb_GetIndex++;
38                         adapter->skb_GetIndex %= WBLINUX_PACKET_ARRAY_SIZE;
39                 }
40
41 #ifdef _PE_STATE_DUMP_
42                 WBDEBUG(( "[w35und] SKB_RELEASE OK\n" ));
43 #endif
44         }
45
46         atomic_dec(&adapter->ThreadCount);
47 }