[WEXT]: Misc code cleanups.
Just a few things that didn't fit in with the other patches. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
bdf51894c1
commit
4d44e0dfe9
@@ -476,7 +476,7 @@ static struct iw_statistics *get_wireless_stats(struct net_device *dev)
|
|||||||
return dev->wireless_handlers->get_wireless_stats(dev);
|
return dev->wireless_handlers->get_wireless_stats(dev);
|
||||||
|
|
||||||
/* Not found */
|
/* Not found */
|
||||||
return (struct iw_statistics *) NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------- */
|
/* ---------------------------------------------------------------- */
|
||||||
@@ -501,11 +501,11 @@ static struct iw_statistics *get_wireless_stats(struct net_device *dev)
|
|||||||
static int call_commit_handler(struct net_device *dev)
|
static int call_commit_handler(struct net_device *dev)
|
||||||
{
|
{
|
||||||
if ((netif_running(dev)) &&
|
if ((netif_running(dev)) &&
|
||||||
(dev->wireless_handlers->standard[0] != NULL)) {
|
(dev->wireless_handlers->standard[0] != NULL))
|
||||||
/* Call the commit handler on the driver */
|
/* Call the commit handler on the driver */
|
||||||
return dev->wireless_handlers->standard[0](dev, NULL,
|
return dev->wireless_handlers->standard[0](dev, NULL,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
} else
|
else
|
||||||
return 0; /* Command completed successfully */
|
return 0; /* Command completed successfully */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -554,8 +554,7 @@ static int iw_handler_get_iwstats(struct net_device * dev,
|
|||||||
struct iw_statistics *stats;
|
struct iw_statistics *stats;
|
||||||
|
|
||||||
stats = get_wireless_stats(dev);
|
stats = get_wireless_stats(dev);
|
||||||
if (stats != (struct iw_statistics *) NULL) {
|
if (stats) {
|
||||||
|
|
||||||
/* Copy statistics to extra */
|
/* Copy statistics to extra */
|
||||||
memcpy(extra, stats, sizeof(struct iw_statistics));
|
memcpy(extra, stats, sizeof(struct iw_statistics));
|
||||||
wrqu->data.length = sizeof(struct iw_statistics);
|
wrqu->data.length = sizeof(struct iw_statistics);
|
||||||
@@ -814,9 +813,8 @@ static int ioctl_standard_call(struct net_device * dev,
|
|||||||
/* Create the kernel buffer */
|
/* Create the kernel buffer */
|
||||||
/* kzalloc ensures NULL-termination for essid_compat */
|
/* kzalloc ensures NULL-termination for essid_compat */
|
||||||
extra = kzalloc(extra_size, GFP_KERNEL);
|
extra = kzalloc(extra_size, GFP_KERNEL);
|
||||||
if (extra == NULL) {
|
if (extra == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
/* If it is a SET, get all the extra data in here */
|
/* If it is a SET, get all the extra data in here */
|
||||||
if (IW_IS_SET(cmd) && (iwr->u.data.length != 0)) {
|
if (IW_IS_SET(cmd) && (iwr->u.data.length != 0)) {
|
||||||
@@ -957,18 +955,14 @@ static int ioctl_private_call(struct net_device *dev, struct ifreq *ifr,
|
|||||||
if (iwr->u.data.length > (descr->set_args &
|
if (iwr->u.data.length > (descr->set_args &
|
||||||
IW_PRIV_SIZE_MASK))
|
IW_PRIV_SIZE_MASK))
|
||||||
return -E2BIG;
|
return -E2BIG;
|
||||||
} else {
|
} else if (iwr->u.data.pointer == NULL)
|
||||||
/* Check NULL pointer */
|
return -EFAULT;
|
||||||
if (iwr->u.data.pointer == NULL)
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Always allocate for max space. Easier, and won't last
|
/* Always allocate for max space. Easier, and won't last
|
||||||
* long... */
|
* long... */
|
||||||
extra = kmalloc(extra_size, GFP_KERNEL);
|
extra = kmalloc(extra_size, GFP_KERNEL);
|
||||||
if (extra == NULL) {
|
if (extra == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
/* If it is a SET, get all the extra data in here */
|
/* If it is a SET, get all the extra data in here */
|
||||||
if (IW_IS_SET(cmd) && (iwr->u.data.length != 0)) {
|
if (IW_IS_SET(cmd) && (iwr->u.data.length != 0)) {
|
||||||
@@ -1259,7 +1253,7 @@ void wireless_send_event(struct net_device * dev,
|
|||||||
event->len = event_len;
|
event->len = event_len;
|
||||||
event->cmd = cmd;
|
event->cmd = cmd;
|
||||||
memcpy(&event->u, ((char *) wrqu) + wrqu_off, hdr_len - IW_EV_LCP_LEN);
|
memcpy(&event->u, ((char *) wrqu) + wrqu_off, hdr_len - IW_EV_LCP_LEN);
|
||||||
if (extra != NULL)
|
if (extra)
|
||||||
memcpy(((char *) event) + hdr_len, extra, extra_len);
|
memcpy(((char *) event) + hdr_len, extra, extra_len);
|
||||||
|
|
||||||
/* Send via the RtNetlink event channel */
|
/* Send via the RtNetlink event channel */
|
||||||
@@ -1290,11 +1284,11 @@ EXPORT_SYMBOL(wireless_send_event);
|
|||||||
* Because this is called on the Rx path via wireless_spy_update(),
|
* Because this is called on the Rx path via wireless_spy_update(),
|
||||||
* we want it to be efficient...
|
* we want it to be efficient...
|
||||||
*/
|
*/
|
||||||
static inline struct iw_spy_data * get_spydata(struct net_device *dev)
|
static inline struct iw_spy_data *get_spydata(struct net_device *dev)
|
||||||
{
|
{
|
||||||
/* This is the new way */
|
/* This is the new way */
|
||||||
if (dev->wireless_data)
|
if (dev->wireless_data)
|
||||||
return(dev->wireless_data->spy_data);
|
return dev->wireless_data->spy_data;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user