Skip to contentSkip to conversation

various fixes

PATCH Superseded Bartosz Markowski 2 participants 10 messages Apr 18, 2013 – Apr 22, 2013 Qualcomm Atheros ATH10K wireless driver

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover various fixes

Fix since V1:
* rename core suspend/resume functions
* split reindentation and new error path
* remove all excessive CONFIG_PM_SLEEP in one patch.

Bartosz Markowski (7):
ath10k: move suspend/resume exports to core.c file
ath10k: remove excessive ifdef checks
ath10k: fix pointer casts in debug code
ath10k: shift extern variable where it belongs
ath10k: remove unnecessary NULL check
ath10k: reindent ath10k_pci_suspend
ath10k: return error if suspend command fails

 drivers/net/wireless/ath/ath10k/core.c  |   23 +++++++++++++
 drivers/net/wireless/ath/ath10k/core.h  |    5 +--
 drivers/net/wireless/ath/ath10k/debug.h |    6 ++--
 drivers/net/wireless/ath/ath10k/hif.h   |    2 --
 drivers/net/wireless/ath/ath10k/htc.c   |    3 +-
 drivers/net/wireless/ath/ath10k/pci.c   |   54 ++++++++++++++++---------------
 drivers/net/wireless/ath/ath10k/pci.h   |    2 ++
 drivers/net/wireless/ath/ath10k/wmi.c   |    9 ------
 8 files changed, 60 insertions(+), 44 deletions(-)
Signature · 1 line
1.7.10
#1 lore raw

PATCH v2 1/7 ath10k: move suspend/resume exports to core.c file

---
 drivers/net/wireless/ath/ath10k/core.c |   25 +++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/core.h |    3 +++
 drivers/net/wireless/ath/ath10k/pci.c  |    6 +++---
 drivers/net/wireless/ath/ath10k/wmi.c  |    7 -------
 4 files changed, 31 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +25 -0
index 213c851..e4bdec4 100644
@@ -663,6 +663,31 @@ void ath10k_core_unregister(struct ath10k *ar)
 }
 EXPORT_SYMBOL(ath10k_core_unregister);
 
+#if defined(CONFIG_PM_SLEEP)
+int ath10k_core_target_suspend(struct ath10k *ar) {
+	int ret;
+
+	ath10k_dbg(ATH10K_DBG_CORE, "%s: called", __func__);
+
+	ret = ath10k_wmi_pdev_suspend_target(ar);
+
+	return ret;
+}
+EXPORT_SYMBOL(ath10k_core_target_suspend);
+
+int ath10k_core_target_resume(struct ath10k *ar) {
+
+	int ret;
+
+	ath10k_dbg(ATH10K_DBG_CORE, "%s: called", __func__);
+
+	ret = ath10k_wmi_pdev_resume_target(ar);
+
+	return ret;
+}
+EXPORT_SYMBOL(ath10k_core_target_resume);
+#endif
+
 MODULE_AUTHOR("Qualcomm Atheros");
 MODULE_DESCRIPTION("Core module for AR9888 PCIe devices.");
 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/ath/ath10k/core.h +3 -0
index 193ac31..00cf53a 100644
@@ -370,5 +370,8 @@ void ath10k_core_destroy(struct ath10k *ar);
 int ath10k_core_register(struct ath10k *ar);
 void ath10k_core_unregister(struct ath10k *ar);
 
+int ath10k_pdev_suspend_target(struct ath10k *ar);
+int ath10k_pdev_resume_target(struct ath10k *ar);
+
 void ath10k_remain_on_channel_reset(unsigned long ptr);
 #endif /* _CORE_H_ */
drivers/net/wireless/ath/ath10k/pci.c +3 -3
index ce77f9f..2f141fea 100644
@@ -2420,7 +2420,7 @@ static int ath10k_pci_suspend(struct device *device)
 	if (!ar_pci)
 		return -ENODEV;
 
-	if (!ath10k_wmi_pdev_suspend_target(ar)) {
+	if (!ath10k_pdev_suspend_target(ar)) {
 		left = wait_event_interruptible_timeout(ar->event_queue,
 					ar->is_target_paused == true,
 					1 * HZ);
@@ -2490,9 +2490,9 @@ static int ath10k_pci_resume(struct device *device)
 			pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
 	}
 
-	ret = ath10k_wmi_pdev_resume_target(ar);
+	ret = ath10k_pdev_resume_target(ar);
 	if (ret)
-		ath10k_warn("ath10k_wmi_pdev_resume_target: %d\n", ret);
+		ath10k_warn("target resume failed: %d\n", ret);
 
 	return ret;
 }
drivers/net/wireless/ath/ath10k/wmi.c +0 -7
index 4b44957..45cbb60 100644
@@ -1230,19 +1230,13 @@ int ath10k_wmi_pdev_suspend_target(struct ath10k *ar)
 	cmd = (void *)skb->data;
 	cmd->suspend_opt = WMI_PDEV_SUSPEND;
 
-	ath10k_dbg(ATH10K_DBG_WMI, "%s: called", __func__);
-
 	return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_SUSPEND_CMDID);
 }
-EXPORT_SYMBOL(ath10k_wmi_pdev_suspend_target);
-
 
 int ath10k_wmi_pdev_resume_target(struct ath10k *ar)
 {
 	struct sk_buff *skb;
 
-	ath10k_dbg(ATH10K_DBG_WMI, "%s: called", __func__);
-
 	skb = ath10k_wmi_alloc_skb(0);
 	if (skb == NULL) {
 		ath10k_warn("%s: ath10k_wmi_alloc_skb() failed\n", __func__);
@@ -1251,7 +1245,6 @@ int ath10k_wmi_pdev_resume_target(struct ath10k *ar)
 
 	return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_RESUME_CMDID);
 }
-EXPORT_SYMBOL(ath10k_wmi_pdev_resume_target);
 #endif /* CONFIG_PM_SLEEP */
 
 int ath10k_wmi_pdev_set_param(struct ath10k *ar, enum wmi_pdev_param id,
Signature · 1 line
1.7.10
#2 lore raw

PATCH v2 1/7 ath10k: move suspend/resume exports to core.c file

Quoted 8 lines · Markowski Bartosz
---
  drivers/net/wireless/ath/ath10k/core.c |   25 +++++++++++++++++++++++++
  drivers/net/wireless/ath/ath10k/core.h |    3 +++
  drivers/net/wireless/ath/ath10k/pci.c  |    6 +++---
  drivers/net/wireless/ath/ath10k/wmi.c  |    7 -------
  4 files changed, 31 insertions(+), 10 deletions(-)

bah, I forgot about the prototypes. Drop this one, I will send a v3 for this patch only.

#3 lore raw

PATCH v2 2/7 ath10k: remove excessive ifdef checks

In reply to Bartosz Markowski

No need to check CONFIG_PM_SLEEP everywhere, the PCI suspend hooks is the only place we need to check it.

---
 drivers/net/wireless/ath/ath10k/core.c |    2 --
 drivers/net/wireless/ath/ath10k/core.h |    2 --
 drivers/net/wireless/ath/ath10k/wmi.c  |    2 --
 3 files changed, 6 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +0 -2
index e4bdec4..c91e602 100644
@@ -663,7 +663,6 @@ void ath10k_core_unregister(struct ath10k *ar)
 }
 EXPORT_SYMBOL(ath10k_core_unregister);
 
-#if defined(CONFIG_PM_SLEEP)
 int ath10k_core_target_suspend(struct ath10k *ar) {
 	int ret;
 
@@ -686,7 +685,6 @@ int ath10k_core_target_resume(struct ath10k *ar) {
 	return ret;
 }
 EXPORT_SYMBOL(ath10k_core_target_resume);
-#endif
 
 MODULE_AUTHOR("Qualcomm Atheros");
 MODULE_DESCRIPTION("Core module for AR9888 PCIe devices.");
drivers/net/wireless/ath/ath10k/core.h +0 -2
index 00cf53a..c585a67 100644
@@ -276,10 +276,8 @@ struct ath10k {
 		void *wmi;
 	} modules;
 
-#if defined(CONFIG_PM_SLEEP)
 	wait_queue_head_t event_queue;
 	bool is_target_paused;
-#endif
 
 	struct ath10k_bmi bmi;
 
drivers/net/wireless/ath/ath10k/wmi.c +0 -2
index 45cbb60..e0b6291 100644
@@ -1217,7 +1217,6 @@ int ath10k_wmi_pdev_set_channel(struct ath10k *ar, const struct wmi_channel_arg
 	return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_SET_CHANNEL_CMDID);
 }
 
-#if defined(CONFIG_PM_SLEEP)
 int ath10k_wmi_pdev_suspend_target(struct ath10k *ar)
 {
 	struct wmi_pdev_suspend_cmd *cmd;
@@ -1245,7 +1244,6 @@ int ath10k_wmi_pdev_resume_target(struct ath10k *ar)
 
 	return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_RESUME_CMDID);
 }
-#endif /* CONFIG_PM_SLEEP */
 
 int ath10k_wmi_pdev_set_param(struct ath10k *ar, enum wmi_pdev_param id,
 			      u32 value)
Signature · 1 line
1.7.10
#4 lore raw

PATCH v2 3/7 ath10k: fix pointer casts in debug code

In reply to Bartosz Markowski
---
 drivers/net/wireless/ath/ath10k/debug.h |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/debug.h +3 -3
index dc4847b..681e400 100644
@@ -70,7 +70,7 @@ static inline void ath10k_debug_read_target_stats(struct ath10k *ar,
 	num_peer_stats = __le32_to_cpu(ev->num_peer_stats); /* 0 or max peers */
 
 	if (num_pdev_stats) {
-		struct wmi_pdev_stats *pdev_stats = (void *)tmp;
+		struct wmi_pdev_stats *pdev_stats = (struct wmi_pdev_stats *)tmp;
 
 		fw_stats->ch_noise_floor = __le32_to_cpu(pdev_stats->chan_nf);
 		fw_stats->tx_frame_count = __le32_to_cpu(pdev_stats->tx_frame_count);
@@ -127,7 +127,7 @@ static inline void ath10k_debug_read_target_stats(struct ath10k *ar,
 		struct wmi_vdev_stats *vdev_stats;
 
 		for (i = 0; i < num_vdev_stats; i++) {
-			vdev_stats = (void *)tmp;
+			vdev_stats = (struct wmi_vdev_stats *)tmp;
 			tmp += sizeof(struct wmi_vdev_stats);
 		}
 	}
@@ -138,7 +138,7 @@ static inline void ath10k_debug_read_target_stats(struct ath10k *ar,
 		fw_stats->peers = num_peer_stats;
 
 		for (i = 0; i < num_peer_stats; i++) {
-			peer_stats = (void *)tmp;
+			peer_stats = (struct wmi_peer_stats *)tmp;
 
 			WMI_MAC_ADDR_TO_CHAR_ARRAY(&peer_stats->peer_macaddr,
 						   fw_stats->peer_stat[i].peer_macaddr);
Signature · 1 line
1.7.10
#5 lore raw

PATCH v2 4/7 ath10k: shift extern variable where it belongs

In reply to Bartosz Markowski

ath10k_target_ps is PCI specific

---
 drivers/net/wireless/ath/ath10k/hif.h |    2 --
 drivers/net/wireless/ath/ath10k/pci.h |    2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/hif.h +0 -2
index e9e202e..66f1d1f 100644
@@ -21,8 +21,6 @@
 #include <linux/kernel.h>
 #include "core.h"
 
-extern unsigned int ath10k_target_ps;
-
 #define HIF_TYPE_AR9888  1
 
 /* FW dump area */
drivers/net/wireless/ath/ath10k/pci.h +2 -0
index d6ffd84..708c087 100644
@@ -351,6 +351,8 @@ void ath10k_pci_target_ps_control(struct ath10k *ar,
 				  bool sleep_ok,
 				  bool wait_for_it);
 
+extern unsigned int ath10k_target_ps;
+
 static inline void TARGET_ACCESS_BEGIN(struct ath10k *ar)
 {
 	if (ath10k_target_ps)
Signature · 1 line
1.7.10
#6 lore raw

PATCH v2 5/7 ath10k: remove unnecessary NULL check

In reply to Bartosz Markowski
---
 drivers/net/wireless/ath/ath10k/htc.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/htc.c +1 -2
index ff4b1bf..299b9e6 100644
@@ -622,8 +622,7 @@ static int ath10k_htc_rx_completion_handler(struct ath10k *ar,
 	/* skb is now owned by the rx completion handler */
 	skb = NULL;
 out:
-	if (skb != NULL)
-		kfree_skb(skb);
+	kfree_skb(skb);
 
 	return status;
 }
Signature · 1 line
1.7.10
#7 lore raw

PATCH v2 6/7 ath10k: reindent ath10k_pci_suspend

In reply to Bartosz Markowski
---
 drivers/net/wireless/ath/ath10k/pci.c |   50 +++++++++++++++++----------------
 1 file changed, 26 insertions(+), 24 deletions(-)
drivers/net/wireless/ath/ath10k/pci.c +26 -24
index 2f141fea..3e841dd 100644
@@ -2420,33 +2420,35 @@ static int ath10k_pci_suspend(struct device *device)
 	if (!ar_pci)
 		return -ENODEV;
 
-	if (!ath10k_pdev_suspend_target(ar)) {
-		left = wait_event_interruptible_timeout(ar->event_queue,
-					ar->is_target_paused == true,
-					1 * HZ);
-
-		if (!left) {
-			ath10k_warn("failed to receive target pasused"
-				   " event [left=%d]\n", left);
-			return -EIO;
-		}
-		/*
-		 * reset is_target_paused and host can check that in next time,
-		 * or it will always be TRUE and host just skip the waiting
-		 * condition, it causes target assert due to host already
-		 * suspend
-		 */
-		ar->is_target_paused = false;
+	if (ath10k_pdev_suspend_target(ar))
+		return 0;
 
-		pci_read_config_dword(pdev, ATH10K_PCI_PM_CONTROL, &val);
+	left = wait_event_interruptible_timeout(ar->event_queue,
+						ar->is_target_paused == true,
+						1 * HZ);
 
-		if ((val & 0x000000ff) != 0x3) {
-			pci_save_state(pdev);
-			pci_disable_device(pdev);
-			pci_write_config_dword(pdev, ATH10K_PCI_PM_CONTROL,
-					       (val & 0xffffff00) | 0x03);
-		}
+	if (!left) {
+		ath10k_warn("failed to receive target pasused"
+			    " event [left=%d]\n", left);
+		return -EIO;
 	}
+	/*
+	 * reset is_target_paused and host can check that in next time,
+	 * or it will always be TRUE and host just skip the waiting
+	 * condition, it causes target assert due to host already
+	 * suspend
+	 */
+	ar->is_target_paused = false;
+
+	pci_read_config_dword(pdev, ATH10K_PCI_PM_CONTROL, &val);
+
+	if ((val & 0x000000ff) != 0x3) {
+		pci_save_state(pdev);
+		pci_disable_device(pdev);
+		pci_write_config_dword(pdev, ATH10K_PCI_PM_CONTROL,
+				       (val & 0xffffff00) | 0x03);
+	}
+
 	return 0;
 }
 
Signature · 1 line
1.7.10
#8 lore raw

PATCH v2 7/7 ath10k: return error if suspend command fails

In reply to Bartosz Markowski
---
 drivers/net/wireless/ath/ath10k/pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/pci.c +1 -1
index 3e841dd..22b533b 100644
@@ -2421,7 +2421,7 @@ static int ath10k_pci_suspend(struct device *device)
 		return -ENODEV;
 
 	if (ath10k_pdev_suspend_target(ar))
-		return 0;
+		return -EIO;
 
 	left = wait_event_interruptible_timeout(ar->event_queue,
 						ar->is_target_paused == true,
Signature · 1 line
1.7.10
#9 lore raw

v2 cover various fixes

In reply to Bartosz Markowski
Quoted 5 lines · Bartosz Markowski

Fix since V1:
* rename core suspend/resume functions
* split reindentation and new error path
* remove all excessive CONFIG_PM_SLEEP in one patch.

Quoted 8 lines

Bartosz Markowski (7):
ath10k: move suspend/resume exports to core.c file
ath10k: remove excessive ifdef checks
ath10k: fix pointer casts in debug code
ath10k: shift extern variable where it belongs
ath10k: remove unnecessary NULL check
ath10k: reindent ath10k_pci_suspend
ath10k: return error if suspend command fails

Patch 1 not applied as you resent it separately.

Patches 2-5 applied, but with conflicts. Please check

Patches 6-7 not applied due to conflicts, please resend.

Signature · 1 line
Kalle Valo