ath10k: rename struct wmi_struct -> struct ath10k_wmi
PATCH 1/7 ath10k: rename struct wmi_struct -> struct ath10k_wmi
--- drivers/net/wireless/ath/ath10k/wmi.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/net/wireless/ath/ath10k/wmi.c +14 -14
@@ -23,7 +23,7 @@#include "wmi.h" #include "mac.h" -struct wmi_struct { +struct ath10k_wmi {struct ath10k *ar;enum htc_endpoint_id eid;
@@ -38,7 +38,7 @@ struct wmi_struct {void ath10k_wmi_flush_tx (struct ath10k *ar) { -struct wmi_struct *wmi = ar->modules.wmi; +struct ath10k_wmi *wmi = ar->modules.wmi;int ret; ret = wait_event_timeout(wmi->wq,
@@ -55,7 +55,7 @@ void ath10k_wmi_flush_tx(struct ath10k *ar)int ath10k_wmi_wait_for_service_ready (struct ath10k *ar) { -struct wmi_struct *wmi = ar->modules.wmi; +struct ath10k_wmi *wmi = ar->modules.wmi;int ret; ret =wait_for_completion_timeout (&wmi->service_ready,WMI_SERVICE_READY_TIMEOUT_HZ );
@@ -64,7 +64,7 @@ int ath10k_wmi_wait_for_service_ready(struct ath10k *ar)int ath10k_wmi_wait_for_unified_ready (struct ath10k *ar) { -struct wmi_struct *wmi = ar->modules.wmi; +struct ath10k_wmi *wmi = ar->modules.wmi;int ret; ret =wait_for_completion_timeout (&wmi->unified_ready,WMI_UNIFIED_READY_TIMEOUT_HZ );
@@ -92,7 +92,7 @@ static struct sk_buff *ath10k_wmi_alloc_skb(u32 len)static void ath10k_wmi_htc_tx_complete (struct sk_buff *skb) {struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb); -struct wmi_struct *wmi = skb_cb->htc.priv; +struct ath10k_wmi *wmi = skb_cb->htc.priv;dev_kfree_skb (skb);
@@ -105,7 +105,7 @@ static int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, enum wmi_cmd_id cmd_id) {struct ath10k_skb_cb *skb_cb =ATH10K_SKB_CB (skb); -struct wmi_struct *wmi = ar->modules.wmi; +struct ath10k_wmi *wmi = ar->modules.wmi;struct wmi_cmd_hdr *cmd_hdr;int status;
@@ -841,7 +841,7 @@ static void ath10k_wmi_event_vdev_install_key_complete(struct ath10k *ar,static void ath10k_wmi_service_ready_event_rx (struct ath10k *ar,struct sk_buff *skb) {struct ath_common *common =ath10k_common (ar); -struct wmi_struct *wmi = ar->modules.wmi; +struct ath10k_wmi *wmi = ar->modules.wmi;struct wmi_service_ready_event *ev = (void *)skb->data;if (skb->len <sizeof (*ev)) {
@@ -899,7 +899,7 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar, struct sk_buffstatic int ath10k_wmi_ready_event_rx (struct ath10k *ar,struct sk_buff *skb) {struct wmi_ready_event *ev = (void *)skb->data; -struct wmi_struct *wmi = ar->modules.wmi; +struct ath10k_wmi *wmi = ar->modules.wmi;if (WARN_ON (skb->len <sizeof (*ev)))return -EINVAL ;
@@ -925,7 +925,7 @@ static int ath10k_wmi_ready_event_rx(struct ath10k *ar, struct sk_buff *skb)return 0 ; } -static void ath10k_wmi_event_process (struct wmi_struct *wmi,struct sk_buff *skb) +static void ath10k_wmi_event_process (struct ath10k_wmi *wmi,struct sk_buff *skb) {struct ath10k *ar = wmi->ar;struct wmi_cmd_hdr *cmd_hdr;
@@ -1055,7 +1055,7 @@ static void ath10k_wmi_event_process(struct wmi_struct *wmi, struct sk_buff *skbstatic void ath10k_wmi_event_work (struct work_struct *work) { - struct wmi_struct *wmi = container_of(work, struct wmi_struct, + struct ath10k_wmi *wmi = container_of(work, struct ath10k_wmi, wmi_event_work);struct sk_buff *skb;
@@ -1070,7 +1070,7 @@ static void ath10k_wmi_event_work(struct work_struct *work)static void ath10k_wmi_process_rx (void *ptr,struct sk_buff *skb) { -struct wmi_struct *wmi = ptr; +struct ath10k_wmi *wmi = ptr;struct wmi_cmd_hdr *cmd_hdr = (struct wmi_cmd_hdr *)skb->data;enum wmi_event_id event_id =__le16_to_cpu (cmd_hdr->cmd_id);
@@ -1096,7 +1096,7 @@ static void ath10k_wmi_process_rx(void *ptr, struct sk_buff *skb)/* WMI Initialization functions */ int ath10k_wmi_attach (struct ath10k *ar) { -struct wmi_struct *wmi; +struct ath10k_wmi *wmi; wmi =kzalloc (sizeof (*wmi),GFP_KERNEL );if (!wmi)
@@ -1116,7 +1116,7 @@ int ath10k_wmi_attach(struct ath10k *ar)void ath10k_wmi_detach (struct ath10k *ar) { -struct wmi_struct *wmi = ar->modules.wmi; +struct ath10k_wmi *wmi = ar->modules.wmi;struct sk_buff *skb;/* HTC should've drained the packets already */
@@ -1141,7 +1141,7 @@ int ath10k_wmi_connect_htc_service(struct ath10k *ar)int status;struct htc_service_connect_req connect;struct htc_service_connect_resp response; -struct wmi_struct *wmi = ar->modules.wmi; +struct ath10k_wmi *wmi = ar->modules.wmi;memset (&connect,0 ,sizeof (connect));memset (&response,0 ,sizeof (response));
Signature · 1 line
1.7.10
PATCH 2/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
@@ -663,6 +663,31 @@ void ath10k_core_unregister(struct ath10k *ar) }EXPORT_SYMBOL (ath10k_core_unregister); +#if defined(CONFIG_PM_SLEEP ) +int ath10k_pdev_suspend_target (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_pdev_suspend_target); + +int ath10k_pdev_resume_target (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_pdev_resume_target); +#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
@@ -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
@@ -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
@@ -1229,19 +1229,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__);
@@ -1250,7 +1244,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
PATCH 2/7 ath10k: move suspend/resume exports to core.c file
Quoted 19 lines · Bartosz Markowski
drivers/net/wireless/ath/ath10k/core.c +13
-0@@ -663,6 +663,31 @@ void ath10k_core_unregister(struct ath10k *ar) }EXPORT_SYMBOL (ath10k_core_unregister); +#if defined(CONFIG_PM_SLEEP ) +int ath10k_pdev_suspend_target (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_pdev_suspend_target); + +int ath10k_pdev_resume_target (struct ath10k *ar) {
drivers/net/wireless/ath/ath10k/core.c void ath10k_core_unregister(struct ath10k *ar) · line 688
Quoted 10 lines
drivers/net/wireless/ath/ath10k/core.c +10
-0+ +int ret; + +ath10k_dbg (ATH10K_DBG_CORE ,"%s: called" , __func__); + + ret =ath10k_wmi_pdev_resume_target (ar); + +return ret; +} +EXPORT_SYMBOL (ath10k_pdev_resume_target);
Please rename them to ath10k_core_suspend() and _resume() or something like that.
Signature · 1 line
Kalle Valo
PATCH 3/7 ath10k: remove excessive ifdef checks
In reply to Bartosz MarkowskiNo 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/wmi.c | 2 -- 2 files changed, 4 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +0 -2
@@ -663,7 +663,6 @@ void ath10k_core_unregister(struct ath10k *ar) }EXPORT_SYMBOL (ath10k_core_unregister); -#if defined(CONFIG_PM_SLEEP )int ath10k_pdev_suspend_target (struct ath10k *ar) {int ret;
@@ -686,7 +685,6 @@ int ath10k_pdev_resume_target(struct ath10k *ar) {return ret; }EXPORT_SYMBOL (ath10k_pdev_resume_target); -#endif MODULE_AUTHOR ("Qualcomm Atheros" );MODULE_DESCRIPTION ("Core module for AR9888 PCIe devices." );
drivers/net/wireless/ath/ath10k/wmi.c +0 -2
@@ -1216,7 +1216,6 @@ int ath10k_wmi_pdev_set_channel(struct ath10k *ar, const struct wmi_channel_argreturn 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;
@@ -1244,7 +1243,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
PATCH 3/7 ath10k: remove excessive ifdef checks
Quoted 2 lines · Bartosz Markowski
No need to check
CONFIG_PM_SLEEPeverywhere, the PCI suspend hooks is the only place we need to check it.
The PM_SLEEP wrappers are required for OpenWrt.
Sujith
PATCH 3/7 ath10k: remove excessive ifdef checks
Quoted 6 lines · Sujith Manoharan
Quoted 2 lines · Bartosz Markowski
No need to check
CONFIG_PM_SLEEPeverywhere, the PCI suspend hooks is the only place we need to check it.The
PM_SLEEPwrappers are required for OpenWrt.Sujith
Everywhere? The PCI suspend/resume callbacks are still wrapped up.
-Bartosz
PATCH 3/7 ath10k: remove excessive ifdef checks
Quoted 1 line · Markowski Bartosz
Everywhere? The PCI suspend/resume callbacks are still wrapped up.
Sorry, I didn't even look at the patch. ;)
Sujith
PATCH 4/7 ath10k: reindent ath10k_pci_suspend
In reply to Bartosz MarkowskiAlso throw an error to PCI if WMI suspend command fails.
--- drivers/net/wireless/ath/ath10k/pci.c | 50 +++++++++++++++++---------------- 1 file changed, 26 insertions(+), 24 deletions(-)
drivers/net/wireless/ath/ath10k/pci.c +26 -24
@@ -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 -EIO ; -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
PATCH 4/7 ath10k: reindent ath10k_pci_suspend
Quoted 3 lines · Bartosz Markowski
Also throw an error to PCI if WMI suspend command fails.
Signed-off-by Bartosz Markowski <[email protected]>
Separate patches for reindent and the new error, please.
Signature · 1 line
Kalle Valo
PATCH 5/7 ath10k: fix pointer casts in debug code
In reply to Bartosz Markowski--- drivers/net/wireless/ath/ath10k/core.h | 2 -- drivers/net/wireless/ath/ath10k/debug.h | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath10k/core.h +0 -2
@@ -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/debug.h +3 -3
@@ -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
PATCH 5/7 ath10k: fix pointer casts in debug code
Quoted 11 lines · Bartosz Markowski
Signed-off-by Bartosz Markowski <[email protected]>--- drivers/net/wireless/ath/ath10k/core.h | 2 -- drivers/net/wireless/ath/ath10k/debug.h | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-)drivers/net/wireless/ath/ath10k/core.h +0
-0
drivers/net/wireless/ath/ath10k/core.h struct ath10k { · line 282
Quoted 7 lines
drivers/net/wireless/ath/ath10k/core.h +0
-2@@ -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
I think this is leftovers from a previous patch.
Signature · 1 line
Kalle Valo
PATCH 6/7 ath10k: shift extern variable where it belongs
In reply to Bartosz Markowskiath10k_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
@@ -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
@@ -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
PATCH 7/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
@@ -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
PATCH 1/7 ath10k: rename struct wmi_struct -> struct ath10k_wmi
In reply to Bartosz MarkowskiQuoted 4 lines · Bartosz Markowski
Signed-off-by Bartosz Markowski <[email protected]>--- drivers/net/wireless/ath/ath10k/wmi.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
This is something I've actually done in one of my patches I posted yesterday morning.
-- Pozdrawiam / Best regards, Michal Kazior.
PATCH 1/7 ath10k: rename struct wmi_struct -> struct ath10k_wmi
Quoted 8 lines · Michal Kazior
Quoted 4 lines · Bartosz Markowski
Signed-off-by Bartosz Markowski <[email protected]>--- drivers/net/wireless/ath/ath10k/wmi.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)This is something I've actually done in one of my patches I posted yesterday morning.
Sorry Michal, I had to miss it.
Please drop this patch then.
-Bartosz