staging: vt6656: iwctl.c: Rewrite siwrts funciton

This function has the following issues:
	Parameter info and extra are not used
	Wrong error handling(the function not return -EINVAL when it
happens)

This patch simplifies this funtion, remove the not used parameters and
fix the error handilng.

Signed-off-by: Marcos Paulo de Souza <marcos.mage@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Marcos Paulo de Souza 2011-12-28 21:18:31 +00:00 committed by Greg Kroah-Hartman
parent 739ea07640
commit 2fdde902ca
3 changed files with 11 additions and 22 deletions

View file

@ -1010,27 +1010,19 @@ void iwctl_giwrate(struct net_device *dev,
/* /*
* Wireless Handler : set rts threshold * Wireless Handler : set rts threshold
*/ */
int iwctl_siwrts(struct net_device *dev, int iwctl_siwrts(struct net_device *dev,
struct iw_request_info *info, struct iw_param *wrq)
struct iw_param *wrq,
char *extra)
{ {
PSDevice pDevice = (PSDevice)netdev_priv(dev); PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS \n"); if ((wrq->value < 0 || wrq->value > 2312) && !wrq->disabled)
return -EINVAL;
{ else if (wrq->disabled)
int rthr = wrq->value; pDevice->wRTSThreshold = 2312;
if(wrq->disabled)
rthr = 2312; else
if((rthr < 0) || (rthr > 2312)) { pDevice->wRTSThreshold = wrq->value;
rc = -EINVAL;
}else {
pDevice->wRTSThreshold = rthr;
}
}
return 0; return 0;
} }

View file

@ -113,10 +113,7 @@ void iwctl_giwrate(struct net_device *dev,
char *extra); char *extra);
int iwctl_siwrts(struct net_device *dev, int iwctl_siwrts(struct net_device *dev,
struct iw_request_info *info, struct iw_param *wrq);
struct iw_param *wrq,
char *extra);
int iwctl_giwrts(struct net_device *dev, int iwctl_giwrts(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,

View file

@ -1704,7 +1704,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
// Set the desired RTS threshold // Set the desired RTS threshold
case SIOCSIWRTS: case SIOCSIWRTS:
rc = iwctl_siwrts(dev, NULL, &(wrq->u.rts), NULL); rc = iwctl_siwrts(dev, &(wrq->u.rts));
break; break;
// Get the current RTS threshold // Get the current RTS threshold