diff options
Diffstat (limited to 'drivers/net/wireless/libertas/ioctl.c')
-rw-r--r-- | drivers/net/wireless/libertas/ioctl.c | 165 |
1 files changed, 92 insertions, 73 deletions
diff --git a/drivers/net/wireless/libertas/ioctl.c b/drivers/net/wireless/libertas/ioctl.c index a8f76c358992..3f95e97a309e 100644 --- a/drivers/net/wireless/libertas/ioctl.c +++ b/drivers/net/wireless/libertas/ioctl.c @@ -30,6 +30,7 @@ static int wlan_set_region(wlan_private * priv, u16 region_code) { int i; + int ret = 0; for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { // use the region code to search for the index @@ -42,17 +43,18 @@ static int wlan_set_region(wlan_private * priv, u16 region_code) // if it's unidentified region code if (i >= MRVDRV_MAX_REGION_CODE) { - lbs_pr_debug(1, "region Code not identified\n"); - LEAVE(); - return -1; + lbs_deb_ioctl("region Code not identified\n"); + ret = -1; + goto done; } if (libertas_set_regiontable(priv, priv->adapter->regioncode, 0)) { - LEAVE(); - return -EINVAL; + ret = -EINVAL; } - return 0; +done: + lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret); + return ret; } static inline int hex2int(char c) @@ -125,8 +127,10 @@ static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req) char ethaddrs_str[18]; char *pos; u8 ethaddr[ETH_ALEN]; + int ret; + + lbs_deb_enter(LBS_DEB_IOCTL); - ENTER(); if (copy_from_user(ethaddrs_str, wrq->u.data.pointer, sizeof(ethaddrs_str))) return -EFAULT; @@ -136,11 +140,12 @@ static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req) return -EINVAL; } - lbs_pr_debug(1, "BT: adding %s\n", ethaddrs_str); - LEAVE(); - return (libertas_prepare_and_send_command(priv, cmd_bt_access, + lbs_deb_ioctl("BT: adding %s\n", ethaddrs_str); + ret = libertas_prepare_and_send_command(priv, cmd_bt_access, cmd_act_bt_access_add, - cmd_option_waitforrsp, 0, ethaddr)); + cmd_option_waitforrsp, 0, ethaddr); + lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret); + return ret; } /** @@ -156,7 +161,8 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req) u8 ethaddr[ETH_ALEN]; char *pos; - ENTER(); + lbs_deb_enter(LBS_DEB_IOCTL); + if (copy_from_user(ethaddrs_str, wrq->u.data.pointer, sizeof(ethaddrs_str))) return -EFAULT; @@ -166,13 +172,14 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req) return -EINVAL; } - lbs_pr_debug(1, "BT: deleting %s\n", ethaddrs_str); + lbs_deb_ioctl("BT: deleting %s\n", ethaddrs_str); return (libertas_prepare_and_send_command(priv, cmd_bt_access, cmd_act_bt_access_del, cmd_option_waitforrsp, 0, ethaddr)); - LEAVE(); + + lbs_deb_leave(LBS_DEB_IOCTL); return 0; } @@ -183,7 +190,7 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req) */ static int wlan_bt_reset_ioctl(wlan_private * priv) { - ENTER(); + lbs_deb_enter(LBS_DEB_IOCTL); lbs_pr_alert( "BT: resetting\n"); @@ -192,7 +199,7 @@ static int wlan_bt_reset_ioctl(wlan_private * priv) cmd_act_bt_access_reset, cmd_option_waitforrsp, 0, NULL)); - LEAVE(); + lbs_deb_leave(LBS_DEB_IOCTL); return 0; } @@ -216,10 +223,10 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req) char *pbuf = outstr; int ret; - ENTER(); + lbs_deb_enter(LBS_DEB_IOCTL); if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) { - lbs_pr_debug(1, "Copy from user failed\n"); + lbs_deb_ioctl("Copy from user failed\n"); return -1; } param.id = simple_strtoul(outstr, NULL, 10); @@ -246,11 +253,11 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req) wrq->u.data.length = strlen(outstr); if (copy_to_user(wrq->u.data.pointer, (char *)outstr, wrq->u.data.length)) { - lbs_pr_debug(1, "BT_LIST: Copy to user failed!\n"); + lbs_deb_ioctl("BT_LIST: Copy to user failed!\n"); return -EFAULT; } - LEAVE(); + lbs_deb_leave(LBS_DEB_IOCTL); return 0; } @@ -278,8 +285,10 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) char in_str[128]; static struct cmd_ds_fwt_access fwt_access; char *ptr; + int ret; + + lbs_deb_enter(LBS_DEB_IOCTL); - ENTER(); if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) return -EFAULT; @@ -348,20 +357,22 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) char ethaddr1_str[18], ethaddr2_str[18]; eth_addr2str(fwt_access.da, ethaddr1_str); eth_addr2str(fwt_access.ra, ethaddr2_str); - lbs_pr_debug(1, "FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str, + lbs_deb_ioctl("FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str, fwt_access.dir, ethaddr2_str); - lbs_pr_debug(1, "FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n", + lbs_deb_ioctl("FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n", fwt_access.ssn, fwt_access.dsn, fwt_access.metric, fwt_access.hopcount, fwt_access.ttl, fwt_access.expiration, fwt_access.sleepmode, fwt_access.snr); } #endif - LEAVE(); - return (libertas_prepare_and_send_command(priv, cmd_fwt_access, - cmd_act_fwt_access_add, - cmd_option_waitforrsp, 0, - (void *)&fwt_access)); + ret = libertas_prepare_and_send_command(priv, cmd_fwt_access, + cmd_act_fwt_access_add, + cmd_option_waitforrsp, 0, + (void *)&fwt_access); + + lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret); + return ret; } /** @@ -376,8 +387,10 @@ static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req) char in_str[64]; static struct cmd_ds_fwt_access fwt_access; char *ptr; + int ret; + + lbs_deb_enter(LBS_DEB_IOCTL); - ENTER(); if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) return -EFAULT; @@ -399,20 +412,21 @@ static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req) #ifdef DEBUG { char ethaddr1_str[18], ethaddr2_str[18]; - lbs_pr_debug(1, "FWT_DEL: line is %s\n", in_str); + lbs_deb_ioctl("FWT_DEL: line is %s\n", in_str); eth_addr2str(fwt_access.da, ethaddr1_str); eth_addr2str(fwt_access.ra, ethaddr2_str); - lbs_pr_debug(1, "FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str, + lbs_deb_ioctl("FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str, ethaddr2_str, fwt_access.dir); } #endif - LEAVE(); - return (libertas_prepare_and_send_command(priv, - cmd_fwt_access, - cmd_act_fwt_access_del, - cmd_option_waitforrsp, 0, - (void *)&fwt_access)); + ret = libertas_prepare_and_send_command(priv, + cmd_fwt_access, + cmd_act_fwt_access_del, + cmd_option_waitforrsp, 0, + (void *)&fwt_access); + lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret); + return ret; } @@ -453,7 +467,8 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req) static char out_str[128]; int ret; - ENTER(); + lbs_deb_enter(LBS_DEB_IOCTL); + if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) return -EFAULT; @@ -465,9 +480,9 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req) #ifdef DEBUG { char ethaddr1_str[18]; - lbs_pr_debug(1, "FWT_LOOKUP: line is %s\n", in_str); + lbs_deb_ioctl("FWT_LOOKUP: line is %s\n", in_str); eth_addr2str(fwt_access.da, ethaddr1_str); - lbs_pr_debug(1, "FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str); + lbs_deb_ioctl("FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str); } #endif @@ -485,11 +500,11 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req) wrq->u.data.length = strlen(out_str); if (copy_to_user(wrq->u.data.pointer, (char *)out_str, wrq->u.data.length)) { - lbs_pr_debug(1, "FWT_LOOKUP: Copy to user failed!\n"); + lbs_deb_ioctl("FWT_LOOKUP: Copy to user failed!\n"); return -EFAULT; } - LEAVE(); + lbs_deb_leave(LBS_DEB_IOCTL); return 0; } @@ -500,7 +515,7 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req) */ static int wlan_fwt_reset_ioctl(wlan_private * priv) { - lbs_pr_debug(1, "FWT: resetting\n"); + lbs_deb_ioctl("FWT: resetting\n"); return (libertas_prepare_and_send_command(priv, cmd_fwt_access, @@ -524,7 +539,8 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req) char *pbuf = out_str; int ret; - ENTER(); + lbs_deb_enter(LBS_DEB_IOCTL); + if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) return -EFAULT; @@ -532,8 +548,8 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req) #ifdef DEBUG { - lbs_pr_debug(1, "FWT_LIST: line is %s\n", in_str); - lbs_pr_debug(1, "FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id)); + lbs_deb_ioctl("FWT_LIST: line is %s\n", in_str); + lbs_deb_ioctl("FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id)); } #endif @@ -549,11 +565,11 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req) wrq->u.data.length = strlen(out_str); if (copy_to_user(wrq->u.data.pointer, (char *)out_str, wrq->u.data.length)) { - lbs_pr_debug(1, "FWT_LIST: Copy to user failed!\n"); + lbs_deb_ioctl("FWT_LIST: Copy to user failed!\n"); return -EFAULT; } - LEAVE(); + lbs_deb_leave(LBS_DEB_IOCTL); return 0; } @@ -573,7 +589,8 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req) char *pbuf = out_str; int ret; - ENTER(); + lbs_deb_enter(LBS_DEB_IOCTL); + if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) return -EFAULT; @@ -581,8 +598,8 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req) #ifdef DEBUG { - lbs_pr_debug(1, "FWT_LIST_ROUTE: line is %s\n", in_str); - lbs_pr_debug(1, "FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id)); + lbs_deb_ioctl("FWT_LIST_ROUTE: line is %s\n", in_str); + lbs_deb_ioctl("FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id)); } #endif @@ -608,11 +625,11 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req) wrq->u.data.length = strlen(out_str); if (copy_to_user(wrq->u.data.pointer, (char *)out_str, wrq->u.data.length)) { - lbs_pr_debug(1, "FWT_LIST_ROUTE: Copy to user failed!\n"); + lbs_deb_ioctl("FWT_LIST_ROUTE: Copy to user failed!\n"); return -EFAULT; } - LEAVE(); + lbs_deb_leave(LBS_DEB_IOCTL); return 0; } @@ -632,7 +649,8 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req) char *pbuf = out_str; int ret; - ENTER(); + lbs_deb_enter(LBS_DEB_IOCTL); + if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) return -EFAULT; @@ -641,8 +659,8 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req) #ifdef DEBUG { - lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: line is %s\n", in_str); - lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id)); + lbs_deb_ioctl("FWT_LIST_NEIGHBOR: line is %s\n", in_str); + lbs_deb_ioctl("FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id)); } #endif @@ -663,11 +681,11 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req) wrq->u.data.length = strlen(out_str); if (copy_to_user(wrq->u.data.pointer, (char *)out_str, wrq->u.data.length)) { - lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: Copy to user failed!\n"); + lbs_deb_ioctl("FWT_LIST_NEIGHBOR: Copy to user failed!\n"); return -EFAULT; } - LEAVE(); + lbs_deb_leave(LBS_DEB_IOCTL); return 0; } @@ -684,9 +702,9 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req) static struct cmd_ds_fwt_access fwt_access; int ret; - ENTER(); + lbs_deb_enter(LBS_DEB_IOCTL); - lbs_pr_debug(1, "FWT: cleaning up\n"); + lbs_deb_ioctl("FWT: cleaning up\n"); memset(&fwt_access, 0, sizeof(fwt_access)); @@ -700,7 +718,7 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req) else return -EFAULT; - LEAVE(); + lbs_deb_leave(LBS_DEB_IOCTL); return 0; } @@ -716,9 +734,9 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req) static struct cmd_ds_fwt_access fwt_access; int ret; - ENTER(); + lbs_deb_enter(LBS_DEB_IOCTL); - lbs_pr_debug(1, "FWT: getting time\n"); + lbs_deb_ioctl("FWT: getting time\n"); memset(&fwt_access, 0, sizeof(fwt_access)); @@ -732,7 +750,7 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req) else return -EFAULT; - LEAVE(); + lbs_deb_leave(LBS_DEB_IOCTL); return 0; } @@ -748,7 +766,7 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req) struct cmd_ds_mesh_access mesh_access; int ret; - ENTER(); + lbs_deb_enter(LBS_DEB_IOCTL); memset(&mesh_access, 0, sizeof(mesh_access)); @@ -762,7 +780,7 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req) else return -EFAULT; - LEAVE(); + lbs_deb_leave(LBS_DEB_IOCTL); return 0; } @@ -777,7 +795,7 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl) struct cmd_ds_mesh_access mesh_access; int ret; - ENTER(); + lbs_deb_enter(LBS_DEB_IOCTL); if( (ttl > 0xff) || (ttl < 0) ) return -EINVAL; @@ -793,7 +811,7 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl) if (ret != 0) ret = -EFAULT; - LEAVE(); + lbs_deb_leave(LBS_DEB_IOCTL); return ret; } @@ -815,9 +833,9 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) wlan_adapter *adapter = priv->adapter; struct iwreq *wrq = (struct iwreq *)req; - ENTER(); + lbs_deb_enter(LBS_DEB_IOCTL); - lbs_pr_debug(1, "libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd); + lbs_deb_ioctl("libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd); switch (cmd) { case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */ switch (wrq->u.data.flags) { @@ -937,7 +955,7 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) (data, wrq->u.data.pointer, sizeof(int) * wrq->u.data.length)) { - lbs_pr_debug(1, + lbs_deb_ioctl( "Copy from user failed\n"); return -EFAULT; } @@ -970,7 +988,7 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) if (copy_to_user(wrq->u.data.pointer, data, sizeof(int) * gpio->header.len)) { - lbs_pr_debug(1, "Copy to user failed\n"); + lbs_deb_ioctl("Copy to user failed\n"); return -EFAULT; } @@ -984,7 +1002,8 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) ret = -EINVAL; break; } - LEAVE(); + + lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret); return ret; } |