Skip to content

Commit

Permalink
staging: vt6656: iwctl.c: Rewrite siwrts funciton
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marcos Paulo de Souza authored and Greg Kroah-Hartman committed Feb 9, 2012
1 parent 739ea07 commit 2fdde90
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
26 changes: 9 additions & 17 deletions drivers/staging/vt6656/iwctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1010,27 +1010,19 @@ void iwctl_giwrate(struct net_device *dev,
/*
* Wireless Handler : set rts threshold
*/

int iwctl_siwrts(struct net_device *dev,
struct iw_request_info *info,
struct iw_param *wrq,
char *extra)
struct iw_param *wrq)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0;
PSDevice pDevice = (PSDevice)netdev_priv(dev);

DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS \n");
if ((wrq->value < 0 || wrq->value > 2312) && !wrq->disabled)
return -EINVAL;

{
int rthr = wrq->value;
if(wrq->disabled)
rthr = 2312;
if((rthr < 0) || (rthr > 2312)) {
rc = -EINVAL;
}else {
pDevice->wRTSThreshold = rthr;
}
}
else if (wrq->disabled)
pDevice->wRTSThreshold = 2312;

else
pDevice->wRTSThreshold = wrq->value;

return 0;
}
Expand Down
5 changes: 1 addition & 4 deletions drivers/staging/vt6656/iwctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,7 @@ void iwctl_giwrate(struct net_device *dev,
char *extra);

int iwctl_siwrts(struct net_device *dev,
struct iw_request_info *info,
struct iw_param *wrq,
char *extra);

struct iw_param *wrq);

int iwctl_giwrts(struct net_device *dev,
struct iw_request_info *info,
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/vt6656/main_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
// Set the desired RTS threshold
case SIOCSIWRTS:

rc = iwctl_siwrts(dev, NULL, &(wrq->u.rts), NULL);
rc = iwctl_siwrts(dev, &(wrq->u.rts));
break;

// Get the current RTS threshold
Expand Down

0 comments on commit 2fdde90

Please sign in to comment.