/* Shall be calle under atomic context... to avoid possible racing condition...  */
struct wlan_network* _rtw_find_network(_queue *scanned_queue, u8 *addr)
/* Shall be calle under atomic context... to avoid possible racing condition...  */
struct wlan_network* _rtw_find_network(_queue *scanned_queue, u8 *addr)
{
	_list	*phead, *plist;
	struct	wlan_network *pnetwork = NULL;
	u8 zero_addr[ETH_ALEN] = {0,0,0,0,0,0};
_func_enter_;
	if(_rtw_memcmp(zero_addr, addr, ETH_ALEN)){
		pnetwork=NULL;
		goto exit;
	}
	phead = get_list_head(scanned_queue);
	plist = get_next(phead);
	while (plist != phead)
       {
                pnetwork = LIST_CONTAINOR(plist, struct wlan_network ,list);
		if (_rtw_memcmp(addr, pnetwork->network.MacAddress, ETH_ALEN) == _TRUE)
                        break;
		plist = get_next(plist);
        }
	if(plist == phead)
		pnetwork = NULL;
exit:_func_exit_;
	return pnetwork;
}