aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalle Valo <kvalo@qca.qualcomm.com>2013-03-09 05:01:43 -0500
committerKalle Valo <kvalo@qca.qualcomm.com>2013-03-18 07:37:46 -0400
commit4e1609c9eec2bf9971004fce8b65c0877d5ae600 (patch)
tree286dd81d06c4002966b0376fffb352c11248b17b
parentec1461dc30feb422af65ee849137f56e7f87f55e (diff)
ath6kl: fix usb related error handling and warnings
It was annoying to debug usb warm reboot initialisation problems as many usb related functions just ignored errors and it wasn't obvious from the kernel logs what was failing. Fix all that so that error messages are printed and errors are handled properly. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/htc_pipe.c10
-rw-r--r--drivers/net/wireless/ath/ath6kl/init.c10
-rw-r--r--drivers/net/wireless/ath/ath6kl/usb.c34
3 files changed, 33 insertions, 21 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/htc_pipe.c b/drivers/net/wireless/ath/ath6kl/htc_pipe.c
index 9adb56741bc3..c02d9d34f74d 100644
--- a/drivers/net/wireless/ath/ath6kl/htc_pipe.c
+++ b/drivers/net/wireless/ath/ath6kl/htc_pipe.c
@@ -1167,7 +1167,7 @@ static int htc_wait_recv_ctrl_message(struct htc_target *target)
1167 } 1167 }
1168 1168
1169 if (count <= 0) { 1169 if (count <= 0) {
1170 ath6kl_dbg(ATH6KL_DBG_HTC, "%s: Timeout!\n", __func__); 1170 ath6kl_warn("htc pipe control receive timeout!\n");
1171 return -ECOMM; 1171 return -ECOMM;
1172 } 1172 }
1173 1173
@@ -1581,16 +1581,16 @@ static int ath6kl_htc_pipe_wait_target(struct htc_target *target)
1581 return status; 1581 return status;
1582 1582
1583 if (target->pipe.ctrl_response_len < sizeof(*ready_msg)) { 1583 if (target->pipe.ctrl_response_len < sizeof(*ready_msg)) {
1584 ath6kl_dbg(ATH6KL_DBG_HTC, "invalid htc ready msg len:%d!\n", 1584 ath6kl_warn("invalid htc pipe ready msg len: %d\n",
1585 target->pipe.ctrl_response_len); 1585 target->pipe.ctrl_response_len);
1586 return -ECOMM; 1586 return -ECOMM;
1587 } 1587 }
1588 1588
1589 ready_msg = (struct htc_ready_ext_msg *) target->pipe.ctrl_response_buf; 1589 ready_msg = (struct htc_ready_ext_msg *) target->pipe.ctrl_response_buf;
1590 1590
1591 if (ready_msg->ver2_0_info.msg_id != cpu_to_le16(HTC_MSG_READY_ID)) { 1591 if (ready_msg->ver2_0_info.msg_id != cpu_to_le16(HTC_MSG_READY_ID)) {
1592 ath6kl_dbg(ATH6KL_DBG_HTC, "invalid htc ready msg : 0x%X !\n", 1592 ath6kl_warn("invalid htc pipe ready msg: 0x%x\n",
1593 ready_msg->ver2_0_info.msg_id); 1593 ready_msg->ver2_0_info.msg_id);
1594 return -ECOMM; 1594 return -ECOMM;
1595 } 1595 }
1596 1596
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index ae1e477ec0d2..8b01ec3d2b8c 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1657,13 +1657,15 @@ static int __ath6kl_init_hw_start(struct ath6kl *ar)
1657 * driver layer has to init BMI in order to set the host block 1657 * driver layer has to init BMI in order to set the host block
1658 * size. 1658 * size.
1659 */ 1659 */
1660 if (ath6kl_htc_wait_target(ar->htc_target)) { 1660 ret = ath6kl_htc_wait_target(ar->htc_target);
1661 ret = -EIO; 1661 if (ret) {
1662 ath6kl_err("htc wait target failed: %d\n", ret);
1662 goto err_power_off; 1663 goto err_power_off;
1663 } 1664 }
1664 1665
1665 if (ath6kl_init_service_ep(ar)) { 1666 ret = ath6kl_init_service_ep(ar);
1666 ret = -EIO; 1667 if (ret) {
1668 ath6kl_err("Endpoint service initilisation failed: %d\n", ret);
1667 goto err_cleanup_scatter; 1669 goto err_cleanup_scatter;
1668 } 1670 }
1669 1671
diff --git a/drivers/net/wireless/ath/ath6kl/usb.c b/drivers/net/wireless/ath/ath6kl/usb.c
index 5fcd342762de..63948f6c9f17 100644
--- a/drivers/net/wireless/ath/ath6kl/usb.c
+++ b/drivers/net/wireless/ath/ath6kl/usb.c
@@ -872,8 +872,9 @@ static int ath6kl_usb_submit_ctrl_out(struct ath6kl_usb *ar_usb,
872 size, 1000); 872 size, 1000);
873 873
874 if (ret < 0) { 874 if (ret < 0) {
875 ath6kl_dbg(ATH6KL_DBG_USB, "%s failed,result = %d\n", 875 ath6kl_warn("Failed to submit usb control message: %d\n", ret);
876 __func__, ret); 876 kfree(buf);
877 return ret;
877 } 878 }
878 879
879 kfree(buf); 880 kfree(buf);
@@ -903,8 +904,9 @@ static int ath6kl_usb_submit_ctrl_in(struct ath6kl_usb *ar_usb,
903 size, 2 * HZ); 904 size, 2 * HZ);
904 905
905 if (ret < 0) { 906 if (ret < 0) {
906 ath6kl_dbg(ATH6KL_DBG_USB, "%s failed,result = %d\n", 907 ath6kl_warn("Failed to read usb control message: %d\n", ret);
907 __func__, ret); 908 kfree(buf);
909 return ret;
908 } 910 }
909 911
910 memcpy((u8 *) data, buf, size); 912 memcpy((u8 *) data, buf, size);
@@ -961,8 +963,10 @@ static int ath6kl_usb_diag_read32(struct ath6kl *ar, u32 address, u32 *data)
961 ATH6KL_USB_CONTROL_REQ_DIAG_RESP, 963 ATH6KL_USB_CONTROL_REQ_DIAG_RESP,
962 ar_usb->diag_resp_buffer, &resp_len); 964 ar_usb->diag_resp_buffer, &resp_len);
963 965
964 if (ret) 966 if (ret) {
967 ath6kl_warn("diag read32 failed: %d\n", ret);
965 return ret; 968 return ret;
969 }
966 970
967 resp = (struct ath6kl_usb_ctrl_diag_resp_read *) 971 resp = (struct ath6kl_usb_ctrl_diag_resp_read *)
968 ar_usb->diag_resp_buffer; 972 ar_usb->diag_resp_buffer;
@@ -976,6 +980,7 @@ static int ath6kl_usb_diag_write32(struct ath6kl *ar, u32 address, __le32 data)
976{ 980{
977 struct ath6kl_usb *ar_usb = ar->hif_priv; 981 struct ath6kl_usb *ar_usb = ar->hif_priv;
978 struct ath6kl_usb_ctrl_diag_cmd_write *cmd; 982 struct ath6kl_usb_ctrl_diag_cmd_write *cmd;
983 int ret;
979 984
980 cmd = (struct ath6kl_usb_ctrl_diag_cmd_write *) ar_usb->diag_cmd_buffer; 985 cmd = (struct ath6kl_usb_ctrl_diag_cmd_write *) ar_usb->diag_cmd_buffer;
981 986
@@ -984,12 +989,17 @@ static int ath6kl_usb_diag_write32(struct ath6kl *ar, u32 address, __le32 data)
984 cmd->address = cpu_to_le32(address); 989 cmd->address = cpu_to_le32(address);
985 cmd->value = data; 990 cmd->value = data;
986 991
987 return ath6kl_usb_ctrl_msg_exchange(ar_usb, 992 ret = ath6kl_usb_ctrl_msg_exchange(ar_usb,
988 ATH6KL_USB_CONTROL_REQ_DIAG_CMD, 993 ATH6KL_USB_CONTROL_REQ_DIAG_CMD,
989 (u8 *) cmd, 994 (u8 *) cmd,
990 sizeof(*cmd), 995 sizeof(*cmd),
991 0, NULL, NULL); 996 0, NULL, NULL);
997 if (ret) {
998 ath6kl_warn("diag_write32 failed: %d\n", ret);
999 return ret;
1000 }
992 1001
1002 return 0;
993} 1003}
994 1004
995static int ath6kl_usb_bmi_read(struct ath6kl *ar, u8 *buf, u32 len) 1005static int ath6kl_usb_bmi_read(struct ath6kl *ar, u8 *buf, u32 len)
@@ -1001,7 +1011,7 @@ static int ath6kl_usb_bmi_read(struct ath6kl *ar, u8 *buf, u32 len)
1001 ret = ath6kl_usb_submit_ctrl_in(ar_usb, 1011 ret = ath6kl_usb_submit_ctrl_in(ar_usb,
1002 ATH6KL_USB_CONTROL_REQ_RECV_BMI_RESP, 1012 ATH6KL_USB_CONTROL_REQ_RECV_BMI_RESP,
1003 0, 0, buf, len); 1013 0, 0, buf, len);
1004 if (ret != 0) { 1014 if (ret) {
1005 ath6kl_err("Unable to read the bmi data from the device: %d\n", 1015 ath6kl_err("Unable to read the bmi data from the device: %d\n",
1006 ret); 1016 ret);
1007 return ret; 1017 return ret;
@@ -1019,7 +1029,7 @@ static int ath6kl_usb_bmi_write(struct ath6kl *ar, u8 *buf, u32 len)
1019 ret = ath6kl_usb_submit_ctrl_out(ar_usb, 1029 ret = ath6kl_usb_submit_ctrl_out(ar_usb,
1020 ATH6KL_USB_CONTROL_REQ_SEND_BMI_CMD, 1030 ATH6KL_USB_CONTROL_REQ_SEND_BMI_CMD,
1021 0, 0, buf, len); 1031 0, 0, buf, len);
1022 if (ret != 0) { 1032 if (ret) {
1023 ath6kl_err("unable to send the bmi data to the device: %d\n", 1033 ath6kl_err("unable to send the bmi data to the device: %d\n",
1024 ret); 1034 ret);
1025 return ret; 1035 return ret;