OSDN Git Service

Remove msleep() wrapper
[android-x86/external-modules-rtl8723au.git] / os_dep / osdep_service.c
index 1e7f6bc..c6b543b 100644 (file)
@@ -48,7 +48,7 @@ inline int RTW_STATUS_CODE(int error_code){
 
 inline u8* _rtw_vmalloc(u32 sz)
 {
-       u8      *pbuf;
+       u8      *pbuf;
        pbuf = vmalloc(sz);
 
        return pbuf;
@@ -56,7 +56,7 @@ inline u8* _rtw_vmalloc(u32 sz)
 
 inline u8* _rtw_zvmalloc(u32 sz)
 {
-       u8      *pbuf;
+       u8      *pbuf;
        pbuf = _rtw_vmalloc(sz);
        if (pbuf != NULL)
                memset(pbuf, 0, sz);
@@ -82,13 +82,13 @@ u8* _rtw_malloc(u32 sz)
 
 u8* _rtw_zmalloc(u32 sz)
 {
-       u8      *pbuf = _rtw_malloc(sz);
+       u8      *pbuf = _rtw_malloc(sz);
 
        if (pbuf != NULL) {
                memset(pbuf, 0, sz);
        }
 
-       return pbuf;    
+       return pbuf;
 }
 
 void   _rtw_mfree(u8 *pbuf, u32 sz)
@@ -96,99 +96,23 @@ void        _rtw_mfree(u8 *pbuf, u32 sz)
        kfree(pbuf);
 }
 
-void _rtw_init_listhead(_list *list)
-{
-        INIT_LIST_HEAD(list);
-}
-
-
-/*
-For the following list_xxx operations,
-caller must guarantee the atomic context.
-Otherwise, there will be racing condition.
-*/
-u32    rtw_is_list_empty(_list *phead)
-{
-       if (list_empty(phead))
-               return _TRUE;
-       else
-               return _FALSE;
-}
-
-void rtw_list_insert_head(_list *plist, _list *phead)
-{
-       list_add(plist, phead);
-}
-
-void rtw_list_insert_tail(_list *plist, _list *phead)
-{
-       list_add_tail(plist, phead);
-}
-
-
-/*
-
-Caller must check if the list is empty before calling rtw_list_delete
-
-*/
-
-
-void _rtw_init_sema(_sema      *sema, int init_val)
-{
-       sema_init(sema, init_val);
-}
-
-void _rtw_free_sema(_sema      *sema)
-{
-}
-
-void _rtw_up_sema(_sema        *sema)
-{
-       up(sema);
-}
-
-u32 _rtw_down_sema(_sema *sema)
-{
-       if (down_interruptible(sema))
-               return _FAIL;
-       else
-               return _SUCCESS;
-}
-
-
-
-void   _rtw_mutex_init(_mutex *pmutex)
-{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
-       mutex_init(pmutex);
-#else
-       init_MUTEX(pmutex);
-#endif
-}
-
-void   _rtw_mutex_free(_mutex *pmutex);
-void   _rtw_mutex_free(_mutex *pmutex)
-{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
-       mutex_destroy(pmutex);
-#else
-#endif
-}
-
 
 void   _rtw_init_queue(_queue  *pqueue)
 {
-       _rtw_init_listhead(&(pqueue->queue));
+       INIT_LIST_HEAD(&(pqueue->queue));
        spin_lock_init(&(pqueue->lock));
 }
 
-u32      _rtw_queue_empty(_queue       *pqueue)
+u32      _rtw_queue_empty(_queue *pqueue)
 {
-       return (rtw_is_list_empty(&(pqueue->queue)));
+       if (list_empty(&(pqueue->queue)))
+               return _TRUE;
+       else
+               return _FALSE;
 }
 
 
-u32 rtw_end_of_queue_search(_list *head, _list *plist)
+u32 rtw_end_of_queue_search(struct list_head *head, struct list_head *plist)
 {
        if (head == plist)
                return _TRUE;
@@ -240,11 +164,6 @@ void rtw_sleep_schedulable(int ms)
 }
 
 
-void rtw_msleep_os(int ms)
-{
-       msleep((unsigned int)ms);
-}
-
 void rtw_usleep_os(int us)
 {
       // msleep((unsigned int)us);
@@ -268,7 +187,7 @@ void _rtw_mdelay_os(int ms, const char *func, const int line)
 
        DBG_8723A("%s:%d %s(%d)\n", func, line, __FUNCTION__, ms);
 
-       mdelay((unsigned long)ms); 
+       mdelay((unsigned long)ms);
 }
 void _rtw_udelay_os(int us, const char *func, const int line)
 {
@@ -283,17 +202,17 @@ void _rtw_udelay_os(int us, const char *func, const int line)
 
 
        DBG_8723A("%s:%d %s(%d)\n", func, line, __FUNCTION__, us);
-       
-      udelay((unsigned long)us); 
+
+      udelay((unsigned long)us);
 }
 #else
 void rtw_mdelay_os(int ms)
 {
-       mdelay((unsigned long)ms); 
+       mdelay((unsigned long)ms);
 }
 void rtw_udelay_os(int us)
 {
-      udelay((unsigned long)us); 
+      udelay((unsigned long)us);
 }
 #endif
 
@@ -367,56 +286,6 @@ inline void rtw_lock_suspend_timeout(long timeout)
 }
 #endif //CONFIG_WOWLAN
 
-inline void ATOMIC_SET(ATOMIC_T *v, int i)
-{
-       atomic_set(v,i);
-}
-
-inline int ATOMIC_READ(ATOMIC_T *v)
-{
-       return atomic_read(v);
-}
-
-inline void ATOMIC_ADD(ATOMIC_T *v, int i)
-{
-       atomic_add(i,v);
-}
-inline void ATOMIC_SUB(ATOMIC_T *v, int i)
-{
-       atomic_sub(i,v);
-}
-
-inline void ATOMIC_INC(ATOMIC_T *v)
-{
-       atomic_inc(v);
-}
-
-inline void ATOMIC_DEC(ATOMIC_T *v)
-{
-       atomic_dec(v);
-}
-
-inline int ATOMIC_ADD_RETURN(ATOMIC_T *v, int i)
-{
-       return atomic_add_return(i,v);
-}
-
-inline int ATOMIC_SUB_RETURN(ATOMIC_T *v, int i)
-{
-       return atomic_sub_return(i,v);
-}
-
-inline int ATOMIC_INC_RETURN(ATOMIC_T *v)
-{
-       return atomic_inc_return(v);
-}
-
-inline int ATOMIC_DEC_RETURN(ATOMIC_T *v)
-{
-       return atomic_dec_return(v);
-}
-
-
 /*
 * Open a file with the specific @param path, @param flag, @param mode
 * @param fpp the pointer of struct file pointer to get struct file pointer while file opening is success
@@ -718,11 +587,9 @@ int rtw_change_ifname(_adapter *padapter, const char *ifname)
                rereg_priv->old_pnetdev = NULL;
        }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
        if(!rtnl_is_locked())
                unregister_netdev(cur_pnetdev);
        else
-#endif
                unregister_netdevice(cur_pnetdev);
 
        rtw_proc_remove_one(cur_pnetdev);
@@ -741,11 +608,9 @@ int rtw_change_ifname(_adapter *padapter, const char *ifname)
 
        memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN);
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
        if(!rtnl_is_locked())
                ret = register_netdev(pnetdev);
        else
-#endif
                ret = register_netdevice(pnetdev);
 
        if ( ret != 0) {