Commit 2497322e authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Greg Kroah-Hartman

Staging: rtxxx0: remove dead virtual adapter support

* remove dead virtual adapter support
* remove needless rt28xx_ioctl() wrapper
* remove superfluous NULL checks
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 66b1bfd1
...@@ -200,12 +200,6 @@ struct os_cookie { ...@@ -200,12 +200,6 @@ struct os_cookie {
INT ioctl_if; INT ioctl_if;
}; };
typedef struct _VIRTUAL_ADAPTER
{
struct net_device *RtmpDev;
struct net_device *VirtualDev;
} VIRTUAL_ADAPTER, PVIRTUAL_ADAPTER;
#undef ASSERT #undef ASSERT
#define ASSERT(x) #define ASSERT(x)
......
...@@ -670,7 +670,7 @@ int rt28xx_open(IN PNET_DEV dev) ...@@ -670,7 +670,7 @@ int rt28xx_open(IN PNET_DEV dev)
static const struct net_device_ops rt2860_netdev_ops = { static const struct net_device_ops rt2860_netdev_ops = {
.ndo_open = MainVirtualIF_open, .ndo_open = MainVirtualIF_open,
.ndo_stop = MainVirtualIF_close, .ndo_stop = MainVirtualIF_close,
.ndo_do_ioctl = rt28xx_ioctl, .ndo_do_ioctl = rt28xx_sta_ioctl,
.ndo_get_stats = RT28xx_get_ether_stats, .ndo_get_stats = RT28xx_get_ether_stats,
.ndo_validate_addr = NULL, .ndo_validate_addr = NULL,
.ndo_set_mac_address = eth_mac_addr, .ndo_set_mac_address = eth_mac_addr,
...@@ -970,37 +970,6 @@ void tbtt_tasklet(unsigned long data) ...@@ -970,37 +970,6 @@ void tbtt_tasklet(unsigned long data)
} }
INT rt28xx_ioctl(
IN struct net_device *net_dev,
IN OUT struct ifreq *rq,
IN INT cmd)
{
VIRTUAL_ADAPTER *pVirtualAd = NULL;
RTMP_ADAPTER *pAd = NULL;
INT ret = 0;
if (net_dev->priv_flags == INT_MAIN)
{
pAd = net_dev->ml_priv;
}
else
{
pVirtualAd = net_dev->ml_priv;
pAd = pVirtualAd->RtmpDev->ml_priv;
}
if (pAd == NULL)
{
/* if 1st open fail, pAd will be free;
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
ret = rt28xx_sta_ioctl(net_dev, rq, cmd);
return ret;
}
/* /*
======================================================================== ========================================================================
......
...@@ -6337,11 +6337,6 @@ VOID RT28xx_UpdateBeaconToAsic( ...@@ -6337,11 +6337,6 @@ VOID RT28xx_UpdateBeaconToAsic(
IN ULONG BeaconLen, IN ULONG BeaconLen,
IN ULONG UpdatePos); IN ULONG UpdatePos);
INT rt28xx_ioctl(
IN struct net_device *net_dev,
IN OUT struct ifreq *rq,
IN INT cmd);
INT rt28xx_sta_ioctl( INT rt28xx_sta_ioctl(
IN struct net_device *net_dev, IN struct net_device *net_dev,
IN OUT struct ifreq *rq, IN OUT struct ifreq *rq,
......
...@@ -572,38 +572,10 @@ int rt_ioctl_giwfreq(struct net_device *dev, ...@@ -572,38 +572,10 @@ int rt_ioctl_giwfreq(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_freq *freq, char *extra) struct iw_freq *freq, char *extra)
{ {
VIRTUAL_ADAPTER *pVirtualAd = NULL; PRTMP_ADAPTER pAdapter = dev->ml_priv;
#ifndef RT30xx UCHAR ch = pAdapter->CommonCfg.Channel;
PRTMP_ADAPTER pAdapter = NULL;
#endif
#ifdef RT30xx
PRTMP_ADAPTER pAdapter;
#endif
UCHAR ch;
ULONG m; ULONG m;
if (dev->priv_flags == INT_MAIN)
{
pAdapter = dev->ml_priv;
}
else
{
pVirtualAd = dev->ml_priv;
#ifndef RT30xx
if (pVirtualAd && pVirtualAd->RtmpDev)
#endif
pAdapter = pVirtualAd->RtmpDev->ml_priv;
}
if (pAdapter == NULL)
{
/* if 1st open fail, pAd will be free;
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
ch = pAdapter->CommonCfg.Channel;
DBGPRINT(RT_DEBUG_TRACE,("==>rt_ioctl_giwfreq %d\n", ch)); DBGPRINT(RT_DEBUG_TRACE,("==>rt_ioctl_giwfreq %d\n", ch));
MAP_CHANNEL_ID_TO_KHZ(ch, m); MAP_CHANNEL_ID_TO_KHZ(ch, m);
...@@ -651,31 +623,7 @@ int rt_ioctl_giwmode(struct net_device *dev, ...@@ -651,31 +623,7 @@ int rt_ioctl_giwmode(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
__u32 *mode, char *extra) __u32 *mode, char *extra)
{ {
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
VIRTUAL_ADAPTER *pVirtualAd = NULL;
if (dev->priv_flags == INT_MAIN)
{
pAdapter = dev->ml_priv;
}
else
{
pVirtualAd = dev->ml_priv;
if (pVirtualAd && pVirtualAd->RtmpDev)
pAdapter = pVirtualAd->RtmpDev->ml_priv;
}
if (pAdapter == NULL)
{
/* if 1st open fail, pAd will be free;
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
#endif
#ifdef RT30xx
PRTMP_ADAPTER pAdapter = dev->ml_priv; PRTMP_ADAPTER pAdapter = dev->ml_priv;
#endif
if (ADHOC_ON(pAdapter)) if (ADHOC_ON(pAdapter))
*mode = IW_MODE_ADHOC; *mode = IW_MODE_ADHOC;
...@@ -719,37 +667,11 @@ int rt_ioctl_giwrange(struct net_device *dev, ...@@ -719,37 +667,11 @@ int rt_ioctl_giwrange(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_point *data, char *extra) struct iw_point *data, char *extra)
{ {
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
VIRTUAL_ADAPTER *pVirtualAd = NULL;
#endif
#ifdef RT30xx
PRTMP_ADAPTER pAdapter = dev->ml_priv; PRTMP_ADAPTER pAdapter = dev->ml_priv;
#endif
struct iw_range *range = (struct iw_range *) extra; struct iw_range *range = (struct iw_range *) extra;
u16 val; u16 val;
int i; int i;
#ifndef RT30xx
if (dev->priv_flags == INT_MAIN)
{
pAdapter = dev->ml_priv;
}
else
{
pVirtualAd = dev->ml_priv;
if (pVirtualAd && pVirtualAd->RtmpDev)
pAdapter = pVirtualAd->RtmpDev->ml_priv;
}
if (pAdapter == NULL)
{
/* if 1st open fail, pAd will be free;
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
#endif
DBGPRINT(RT_DEBUG_TRACE ,("===>rt_ioctl_giwrange\n")); DBGPRINT(RT_DEBUG_TRACE ,("===>rt_ioctl_giwrange\n"));
data->length = sizeof(struct iw_range); data->length = sizeof(struct iw_range);
memset(range, 0, sizeof(struct iw_range)); memset(range, 0, sizeof(struct iw_range));
...@@ -866,31 +788,7 @@ int rt_ioctl_giwap(struct net_device *dev, ...@@ -866,31 +788,7 @@ int rt_ioctl_giwap(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct sockaddr *ap_addr, char *extra) struct sockaddr *ap_addr, char *extra)
{ {
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
VIRTUAL_ADAPTER *pVirtualAd = NULL;
if (dev->priv_flags == INT_MAIN)
{
pAdapter = dev->ml_priv;
}
else
{
pVirtualAd = dev->ml_priv;
if (pVirtualAd && pVirtualAd->RtmpDev)
pAdapter = pVirtualAd->RtmpDev->ml_priv;
}
if (pAdapter == NULL)
{
/* if 1st open fail, pAd will be free;
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
#endif
#ifdef RT30xx
PRTMP_ADAPTER pAdapter = dev->ml_priv; PRTMP_ADAPTER pAdapter = dev->ml_priv;
#endif
if (INFRA_ON(pAdapter) || ADHOC_ON(pAdapter)) if (INFRA_ON(pAdapter) || ADHOC_ON(pAdapter))
{ {
...@@ -1389,31 +1287,7 @@ int rt_ioctl_giwessid(struct net_device *dev, ...@@ -1389,31 +1287,7 @@ int rt_ioctl_giwessid(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_point *data, char *essid) struct iw_point *data, char *essid)
{ {
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
VIRTUAL_ADAPTER *pVirtualAd = NULL;
if (dev->priv_flags == INT_MAIN)
{
pAdapter = dev->ml_priv;
}
else
{
pVirtualAd = dev->ml_priv;
if (pVirtualAd && pVirtualAd->RtmpDev)
pAdapter = pVirtualAd->RtmpDev->ml_priv;
}
if (pAdapter == NULL)
{
/* if 1st open fail, pAd will be free;
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
#endif
#ifdef RT30xx
PRTMP_ADAPTER pAdapter = dev->ml_priv; PRTMP_ADAPTER pAdapter = dev->ml_priv;
#endif
data->flags = 1; data->flags = 1;
if (MONITOR_ON(pAdapter)) if (MONITOR_ON(pAdapter))
...@@ -1473,31 +1347,7 @@ int rt_ioctl_giwnickn(struct net_device *dev, ...@@ -1473,31 +1347,7 @@ int rt_ioctl_giwnickn(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_point *data, char *nickname) struct iw_point *data, char *nickname)
{ {
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
VIRTUAL_ADAPTER *pVirtualAd = NULL;
if (dev->priv_flags == INT_MAIN)
{
pAdapter = dev->ml_priv;
}
else
{
pVirtualAd = dev->ml_priv;
if (pVirtualAd && pVirtualAd->RtmpDev)
pAdapter = pVirtualAd->RtmpDev->ml_priv;
}
if (pAdapter == NULL)
{
/* if 1st open fail, pAd will be free;
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
#endif
#ifdef RT30xx
PRTMP_ADAPTER pAdapter = dev->ml_priv; PRTMP_ADAPTER pAdapter = dev->ml_priv;
#endif
if (data->length > strlen(pAdapter->nickname) + 1) if (data->length > strlen(pAdapter->nickname) + 1)
data->length = strlen(pAdapter->nickname) + 1; data->length = strlen(pAdapter->nickname) + 1;
...@@ -1541,31 +1391,7 @@ int rt_ioctl_giwrts(struct net_device *dev, ...@@ -1541,31 +1391,7 @@ int rt_ioctl_giwrts(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_param *rts, char *extra) struct iw_param *rts, char *extra)
{ {
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
VIRTUAL_ADAPTER *pVirtualAd = NULL;
if (dev->priv_flags == INT_MAIN)
{
pAdapter = dev->ml_priv;
}
else
{
pVirtualAd = dev->ml_priv;
if (pVirtualAd && pVirtualAd->RtmpDev)
pAdapter = pVirtualAd->RtmpDev->ml_priv;
}
if (pAdapter == NULL)
{
/* if 1st open fail, pAd will be free;
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
#endif
#ifdef RT30xx
PRTMP_ADAPTER pAdapter = dev->ml_priv; PRTMP_ADAPTER pAdapter = dev->ml_priv;
#endif
//check if the interface is down //check if the interface is down
if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE))
...@@ -1612,31 +1438,7 @@ int rt_ioctl_giwfrag(struct net_device *dev, ...@@ -1612,31 +1438,7 @@ int rt_ioctl_giwfrag(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_param *frag, char *extra) struct iw_param *frag, char *extra)
{ {
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
VIRTUAL_ADAPTER *pVirtualAd = NULL;
if (dev->priv_flags == INT_MAIN)
{
pAdapter = dev->ml_priv;
}
else
{
pVirtualAd = dev->ml_priv;
if (pVirtualAd && pVirtualAd->RtmpDev)
pAdapter = pVirtualAd->RtmpDev->ml_priv;
}
if (pAdapter == NULL)
{
/* if 1st open fail, pAd will be free;
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
#endif
#ifdef RT30xx
PRTMP_ADAPTER pAdapter = dev->ml_priv; PRTMP_ADAPTER pAdapter = dev->ml_priv;
#endif
//check if the interface is down //check if the interface is down
if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE))
...@@ -1768,32 +1570,8 @@ rt_ioctl_giwencode(struct net_device *dev, ...@@ -1768,32 +1570,8 @@ rt_ioctl_giwencode(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_point *erq, char *key) struct iw_point *erq, char *key)
{ {
#ifdef RT30xx
PRTMP_ADAPTER pAdapter = dev->ml_priv; PRTMP_ADAPTER pAdapter = dev->ml_priv;
#endif
int kid; int kid;
#ifndef RT30xx
PRTMP_ADAPTER pAdapter = NULL;
VIRTUAL_ADAPTER *pVirtualAd = NULL;
if (dev->priv_flags == INT_MAIN)
{
pAdapter = dev->ml_priv;
}
else
{
pVirtualAd = dev->ml_priv;
if (pVirtualAd && pVirtualAd->RtmpDev)
pAdapter = pVirtualAd->RtmpDev->ml_priv;
}
if (pAdapter == NULL)
{
/* if 1st open fail, pAd will be free;
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
#endif
//check if the interface is down //check if the interface is down
if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE))
...@@ -1850,31 +1628,12 @@ static int ...@@ -1850,31 +1628,12 @@ static int
rt_ioctl_setparam(struct net_device *dev, struct iw_request_info *info, rt_ioctl_setparam(struct net_device *dev, struct iw_request_info *info,
void *w, char *extra) void *w, char *extra)
{ {
VIRTUAL_ADAPTER *pVirtualAd = NULL; PRTMP_ADAPTER pAdapter = dev->ml_priv;
PRTMP_ADAPTER pAdapter; POS_COOKIE pObj = (POS_COOKIE)pAdapter->OS_Cookie;
POS_COOKIE pObj;
char *this_char = extra; char *this_char = extra;
char *value; char *value;
int Status=0; int Status=0;
if (dev->priv_flags == INT_MAIN)
{
pAdapter = dev->ml_priv;
}
else
{
pVirtualAd = dev->ml_priv;
pAdapter = pVirtualAd->RtmpDev->ml_priv;
}
pObj = (POS_COOKIE) pAdapter->OS_Cookie;
if (pAdapter == NULL)
{
/* if 1st open fail, pAd will be free;
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
{ {
pObj->ioctl_if_type = INT_MAIN; pObj->ioctl_if_type = INT_MAIN;
pObj->ioctl_if = MAIN_MBSSID; pObj->ioctl_if = MAIN_MBSSID;
...@@ -2018,27 +1777,10 @@ rt_private_show(struct net_device *dev, struct iw_request_info *info, ...@@ -2018,27 +1777,10 @@ rt_private_show(struct net_device *dev, struct iw_request_info *info,
struct iw_point *wrq, char *extra) struct iw_point *wrq, char *extra)
{ {
INT Status = 0; INT Status = 0;
VIRTUAL_ADAPTER *pVirtualAd = NULL; PRTMP_ADAPTER pAd = dev->ml_priv;
PRTMP_ADAPTER pAd; POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
POS_COOKIE pObj;
u32 subcmd = wrq->flags; u32 subcmd = wrq->flags;
if (dev->priv_flags == INT_MAIN)
pAd = dev->ml_priv;
else
{
pVirtualAd = dev->ml_priv;
pAd = pVirtualAd->RtmpDev->ml_priv;
}
pObj = (POS_COOKIE) pAd->OS_Cookie;
if (pAd == NULL)
{
/* if 1st open fail, pAd will be free;
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
if (extra == NULL) if (extra == NULL)
{ {
wrq->length = 0; wrq->length = 0;
...@@ -4989,32 +4731,13 @@ INT rt28xx_sta_ioctl( ...@@ -4989,32 +4731,13 @@ INT rt28xx_sta_ioctl(
IN OUT struct ifreq *rq, IN OUT struct ifreq *rq,
IN INT cmd) IN INT cmd)
{ {
POS_COOKIE pObj; RTMP_ADAPTER *pAd = net_dev->ml_priv;
VIRTUAL_ADAPTER *pVirtualAd = NULL; POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie;
RTMP_ADAPTER *pAd = NULL;
struct iwreq *wrq = (struct iwreq *) rq; struct iwreq *wrq = (struct iwreq *) rq;
BOOLEAN StateMachineTouched = FALSE; BOOLEAN StateMachineTouched = FALSE;
INT Status = NDIS_STATUS_SUCCESS; INT Status = NDIS_STATUS_SUCCESS;
USHORT subcmd; USHORT subcmd;
if (net_dev->priv_flags == INT_MAIN)
{
pAd = net_dev->ml_priv;
}
else
{
pVirtualAd = net_dev->ml_priv;
pAd = pVirtualAd->RtmpDev->ml_priv;
}
pObj = (POS_COOKIE) pAd->OS_Cookie;
if (pAd == NULL)
{
/* if 1st open fail, pAd will be free;
So the net_dev->ml_priv will be NULL in 2rd open */
return -ENETDOWN;
}
//check if the interface is down //check if the interface is down
if(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) if(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE))
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment