diff mbox series

[5/5] wifi: ath11k: thermal: don't try to register multiple times

Message ID 20240221024725.10057-6-quic_bqiang@quicinc.com
State New
Headers show
Series wifi: ath11k: prepare for hibernation support | expand

Commit Message

Baochen Qiang Feb. 21, 2024, 2:47 a.m. UTC
From: Kalle Valo <quic_kvalo@quicinc.com>

Every time the firmware boots we call ath11k_core_qmi_firmware_ready() which
ends up calling ath11k_thermal_register(). So we try to register thermal
devices multiple times. And when we power off the firmware during
suspend/hibernation (implemented in the next patch) we get a warning in resume:

hwmon hwmon4: PM: parent phy0 should not be sleeping

Workaround this similarly like ath11k_mac_register() does by testing
ATH11K_FLAG_REGISTERED.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.30

Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/thermal.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Baochen Qiang Feb. 22, 2024, 2:34 a.m. UTC | #1
On 2/22/2024 1:15 AM, Jeff Johnson wrote:
> On 2/20/2024 6:47 PM, Baochen Qiang wrote:
>> From: Kalle Valo <quic_kvalo@quicinc.com>
>>
>> Every time the firmware boots we call ath11k_core_qmi_firmware_ready() which
>> ends up calling ath11k_thermal_register(). So we try to register thermal
>> devices multiple times. And when we power off the firmware during
>> suspend/hibernation (implemented in the next patch) we get a warning in resume:
>>
>> hwmon hwmon4: PM: parent phy0 should not be sleeping
>>
>> Workaround this similarly like ath11k_mac_register() does by testing
>> ATH11K_FLAG_REGISTERED.
>>
>> Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.30
>>
>> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
> 
> you need to add your own S-O-B
Oh, sorry for missing that.

Hi Kalle, I see you have put this series in pending branch. I am 
wondering if I need to send a v2 to add my S-O-B tag, or you have any 
other plan?

> 
>> ---
>>   drivers/net/wireless/ath/ath11k/thermal.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath11k/thermal.c b/drivers/net/wireless/ath/ath11k/thermal.c
>> index c29b11ab5bfa..41e7499f075f 100644
>> --- a/drivers/net/wireless/ath/ath11k/thermal.c
>> +++ b/drivers/net/wireless/ath/ath11k/thermal.c
>> @@ -1,7 +1,7 @@
>>   // SPDX-License-Identifier: BSD-3-Clause-Clear
>>   /*
>>    * Copyright (c) 2020 The Linux Foundation. All rights reserved.
>> - * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
>> + * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
>>    */
>>   
>>   #include <linux/device.h>
>> @@ -163,6 +163,9 @@ int ath11k_thermal_register(struct ath11k_base *ab)
>>   	struct ath11k_pdev *pdev;
>>   	int i, ret;
>>   
>> +	if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags))
>> +		return 0;
>> +
>>   	for (i = 0; i < ab->num_radios; i++) {
>>   		pdev = &ab->pdevs[i];
>>   		ar = pdev->ar;
>
Kalle Valo Feb. 22, 2024, 6:25 a.m. UTC | #2
Baochen Qiang <quic_bqiang@quicinc.com> writes:

> On 2/22/2024 1:15 AM, Jeff Johnson wrote:
>> On 2/20/2024 6:47 PM, Baochen Qiang wrote:
>>> From: Kalle Valo <quic_kvalo@quicinc.com>
>>>
>>> Every time the firmware boots we call ath11k_core_qmi_firmware_ready() which
>>> ends up calling ath11k_thermal_register(). So we try to register thermal
>>> devices multiple times. And when we power off the firmware during
>>> suspend/hibernation (implemented in the next patch) we get a warning in resume:
>>>
>>> hwmon hwmon4: PM: parent phy0 should not be sleeping
>>>
>>> Workaround this similarly like ath11k_mac_register() does by testing
>>> ATH11K_FLAG_REGISTERED.
>>>
>>> Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.30
>>>
>>> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
>> you need to add your own S-O-B
> Oh, sorry for missing that.
>
> Hi Kalle, I see you have put this series in pending branch. I am
> wondering if I need to send a v2 to add my S-O-B tag, or you have any
> other plan?

I can add it in the pending branch if you send it to me as a reply to
this mail. s-o-b is like a signature so I won't add it on my own.
Baochen Qiang Feb. 22, 2024, 7:43 a.m. UTC | #3
On 2/22/2024 2:25 PM, Kalle Valo wrote:
> Baochen Qiang <quic_bqiang@quicinc.com> writes:
> 
>> On 2/22/2024 1:15 AM, Jeff Johnson wrote:
>>> On 2/20/2024 6:47 PM, Baochen Qiang wrote:
>>>> From: Kalle Valo <quic_kvalo@quicinc.com>
>>>>
>>>> Every time the firmware boots we call ath11k_core_qmi_firmware_ready() which
>>>> ends up calling ath11k_thermal_register(). So we try to register thermal
>>>> devices multiple times. And when we power off the firmware during
>>>> suspend/hibernation (implemented in the next patch) we get a warning in resume:
>>>>
>>>> hwmon hwmon4: PM: parent phy0 should not be sleeping
>>>>
>>>> Workaround this similarly like ath11k_mac_register() does by testing
>>>> ATH11K_FLAG_REGISTERED.
>>>>
>>>> Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.30
>>>>
>>>> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
>>> you need to add your own S-O-B
>> Oh, sorry for missing that.
>>
>> Hi Kalle, I see you have put this series in pending branch. I am
>> wondering if I need to send a v2 to add my S-O-B tag, or you have any
>> other plan?
> 
> I can add it in the pending branch if you send it to me as a reply to
> this mail. s-o-b is like a signature so I won't add it on my own.
Understood Kalle. So please help add below tag to this patch in pending 
branch:
	Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
>
Kalle Valo Feb. 22, 2024, 2:58 p.m. UTC | #4
Baochen Qiang <quic_bqiang@quicinc.com> writes:

> On 2/22/2024 2:25 PM, Kalle Valo wrote:
>> Baochen Qiang <quic_bqiang@quicinc.com> writes:
>> 
>>> On 2/22/2024 1:15 AM, Jeff Johnson wrote:
>>>> On 2/20/2024 6:47 PM, Baochen Qiang wrote:
>>>>> From: Kalle Valo <quic_kvalo@quicinc.com>
>>>>>
>>>>> Every time the firmware boots we call ath11k_core_qmi_firmware_ready() which
>>>>> ends up calling ath11k_thermal_register(). So we try to register thermal
>>>>> devices multiple times. And when we power off the firmware during
>>>>> suspend/hibernation (implemented in the next patch) we get a warning in resume:
>>>>>
>>>>> hwmon hwmon4: PM: parent phy0 should not be sleeping
>>>>>
>>>>> Workaround this similarly like ath11k_mac_register() does by testing
>>>>> ATH11K_FLAG_REGISTERED.
>>>>>
>>>>> Tested-on: WCN6855 hw2.0 PCI
>>>>> WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.30
>>>>>
>>>>> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
>>>> you need to add your own S-O-B
>>> Oh, sorry for missing that.
>>>
>>> Hi Kalle, I see you have put this series in pending branch. I am
>>> wondering if I need to send a v2 to add my S-O-B tag, or you have any
>>> other plan?
>> I can add it in the pending branch if you send it to me as a reply
>> to
>> this mail. s-o-b is like a signature so I won't add it on my own.
> Understood Kalle. So please help add below tag to this patch in
> pending branch:
> 	Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>

Thanks, added:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=a88f2007763465f2be307c3a5ed542233bc3c77e
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath11k/thermal.c b/drivers/net/wireless/ath/ath11k/thermal.c
index c29b11ab5bfa..41e7499f075f 100644
--- a/drivers/net/wireless/ath/ath11k/thermal.c
+++ b/drivers/net/wireless/ath/ath11k/thermal.c
@@ -1,7 +1,7 @@ 
 // SPDX-License-Identifier: BSD-3-Clause-Clear
 /*
  * Copyright (c) 2020 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <linux/device.h>
@@ -163,6 +163,9 @@  int ath11k_thermal_register(struct ath11k_base *ab)
 	struct ath11k_pdev *pdev;
 	int i, ret;
 
+	if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags))
+		return 0;
+
 	for (i = 0; i < ab->num_radios; i++) {
 		pdev = &ab->pdevs[i];
 		ar = pdev->ar;