Re: [RESEND PATCH] ath11k: use MHI provided APIs to allocate and free MHI controller

2020-12-11 Thread Kalle Valo
Bhaumik Bhatt  wrote:

> Use MHI provided APIs to allocate and free MHI controller to
> improve MHI host driver handling. This also fixes a memory leak
> as the MHI controller was allocated but never freed.
> 
> Signed-off-by: Bhaumik Bhatt 
> Reviewed-by: Manivannan Sadhasivam 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

57449b07eafc ath11k: use MHI provided APIs to allocate and free MHI controller

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/1605634436-36506-1-git-send-email-bbh...@codeaurora.org/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



[RESEND PATCH] ath11k: use MHI provided APIs to allocate and free MHI controller

2020-11-17 Thread Bhaumik Bhatt
Use MHI provided APIs to allocate and free MHI controller to
improve MHI host driver handling. This also fixes a memory leak
as the MHI controller was allocated but never freed.

Signed-off-by: Bhaumik Bhatt 
Reviewed-by: Manivannan Sadhasivam 
---
 drivers/net/wireless/ath/ath11k/mhi.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/mhi.c 
b/drivers/net/wireless/ath/ath11k/mhi.c
index aded9a7..1c9d9dc 100644
--- a/drivers/net/wireless/ath/ath11k/mhi.c
+++ b/drivers/net/wireless/ath/ath11k/mhi.c
@@ -218,7 +218,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
struct mhi_controller *mhi_ctrl;
int ret;
 
-   mhi_ctrl = kzalloc(sizeof(*mhi_ctrl), GFP_KERNEL);
+   mhi_ctrl = mhi_alloc_controller();
if (!mhi_ctrl)
return -ENOMEM;
 
@@ -234,7 +234,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
ret = ath11k_mhi_get_msi(ab_pci);
if (ret) {
ath11k_err(ab, "failed to get msi for mhi\n");
-   kfree(mhi_ctrl);
+   mhi_free_controller(mhi_ctrl);
return ret;
}
 
@@ -252,7 +252,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
ret = mhi_register_controller(mhi_ctrl, _mhi_config);
if (ret) {
ath11k_err(ab, "failed to register to mhi bus, err = %d\n", 
ret);
-   kfree(mhi_ctrl);
+   mhi_free_controller(mhi_ctrl);
return ret;
}
 
@@ -265,6 +265,7 @@ void ath11k_mhi_unregister(struct ath11k_pci *ab_pci)
 
mhi_unregister_controller(mhi_ctrl);
kfree(mhi_ctrl->irq);
+   mhi_free_controller(mhi_ctrl);
 }
 
 static char *ath11k_mhi_state_to_str(enum ath11k_mhi_state mhi_state)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



Re: [PATCH] ath11k: use MHI provided APIs to allocate and free MHI controller

2020-11-17 Thread Bhaumik Bhatt

On 2020-11-16 11:14 PM, Kalle Valo wrote:

Bhaumik Bhatt  writes:


Use MHI provided APIs to allocate and free MHI controller to
improve MHI host driver handling.


How does it improve the handling?

Main reason is we want to ensure the MHI controller is zero-initialized 
and
we want to mandate it as it is better to have it under our control in 
case
we also want to allocate and track peripheral data/memory related to the 
MHI

controller.

This also fixes a memory leak as the MHI controller was allocated but
never freed.

Signed-off-by: Bhaumik Bhatt 
---
 drivers/net/wireless/ath/ath11k/mhi.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)


For ath11k patches please CC ath11k and linux-wireless lists so that
patchwork sees it. So you need to resend this.

Is this a new API? I need to understand if there are any dependencies
between mhi and ath trees, or if I can apply this directly to my 
ath.git

tree.


This one should be dependent on the patch [1] which exists on mainline 
and

should already part of your tree if you're on any 5.10 RC.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/bus/mhi?h=v5.10-rc4=f42dfbe8f712127031e7b9bc938a1c33cec2ff57


Thanks,
Bhaumik
---
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum,

a Linux Foundation Collaborative Project


Re: [PATCH] ath11k: use MHI provided APIs to allocate and free MHI controller

2020-11-16 Thread Kalle Valo
Bhaumik Bhatt  writes:

> Use MHI provided APIs to allocate and free MHI controller to
> improve MHI host driver handling.

How does it improve the handling?

> This also fixes a memory leak as the MHI controller was allocated but
> never freed.
>
> Signed-off-by: Bhaumik Bhatt 
> ---
>  drivers/net/wireless/ath/ath11k/mhi.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)

For ath11k patches please CC ath11k and linux-wireless lists so that
patchwork sees it. So you need to resend this.

Is this a new API? I need to understand if there are any dependencies
between mhi and ath trees, or if I can apply this directly to my ath.git
tree.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


Re: [PATCH] ath11k: use MHI provided APIs to allocate and free MHI controller

2020-11-16 Thread Manivannan Sadhasivam
+ath11k list

On Mon, Nov 16, 2020 at 04:01:40PM -0800, Bhaumik Bhatt wrote:
> Use MHI provided APIs to allocate and free MHI controller to
> improve MHI host driver handling. This also fixes a memory leak
> as the MHI controller was allocated but never freed.
> 
> Signed-off-by: Bhaumik Bhatt 

Reviewed-by: Manivannan Sadhasivam 

Thanks,
Mani

> ---
>  drivers/net/wireless/ath/ath11k/mhi.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath11k/mhi.c 
> b/drivers/net/wireless/ath/ath11k/mhi.c
> index aded9a7..1c9d9dc 100644
> --- a/drivers/net/wireless/ath/ath11k/mhi.c
> +++ b/drivers/net/wireless/ath/ath11k/mhi.c
> @@ -218,7 +218,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
>   struct mhi_controller *mhi_ctrl;
>   int ret;
>  
> - mhi_ctrl = kzalloc(sizeof(*mhi_ctrl), GFP_KERNEL);
> + mhi_ctrl = mhi_alloc_controller();
>   if (!mhi_ctrl)
>   return -ENOMEM;
>  
> @@ -234,7 +234,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
>   ret = ath11k_mhi_get_msi(ab_pci);
>   if (ret) {
>   ath11k_err(ab, "failed to get msi for mhi\n");
> - kfree(mhi_ctrl);
> + mhi_free_controller(mhi_ctrl);
>   return ret;
>   }
>  
> @@ -252,7 +252,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
>   ret = mhi_register_controller(mhi_ctrl, _mhi_config);
>   if (ret) {
>   ath11k_err(ab, "failed to register to mhi bus, err = %d\n", 
> ret);
> - kfree(mhi_ctrl);
> + mhi_free_controller(mhi_ctrl);
>   return ret;
>   }
>  
> @@ -265,6 +265,7 @@ void ath11k_mhi_unregister(struct ath11k_pci *ab_pci)
>  
>   mhi_unregister_controller(mhi_ctrl);
>   kfree(mhi_ctrl->irq);
> + mhi_free_controller(mhi_ctrl);
>  }
>  
>  static char *ath11k_mhi_state_to_str(enum ath11k_mhi_state mhi_state)
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 


[PATCH] ath11k: use MHI provided APIs to allocate and free MHI controller

2020-11-16 Thread Bhaumik Bhatt
Use MHI provided APIs to allocate and free MHI controller to
improve MHI host driver handling. This also fixes a memory leak
as the MHI controller was allocated but never freed.

Signed-off-by: Bhaumik Bhatt 
---
 drivers/net/wireless/ath/ath11k/mhi.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/mhi.c 
b/drivers/net/wireless/ath/ath11k/mhi.c
index aded9a7..1c9d9dc 100644
--- a/drivers/net/wireless/ath/ath11k/mhi.c
+++ b/drivers/net/wireless/ath/ath11k/mhi.c
@@ -218,7 +218,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
struct mhi_controller *mhi_ctrl;
int ret;
 
-   mhi_ctrl = kzalloc(sizeof(*mhi_ctrl), GFP_KERNEL);
+   mhi_ctrl = mhi_alloc_controller();
if (!mhi_ctrl)
return -ENOMEM;
 
@@ -234,7 +234,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
ret = ath11k_mhi_get_msi(ab_pci);
if (ret) {
ath11k_err(ab, "failed to get msi for mhi\n");
-   kfree(mhi_ctrl);
+   mhi_free_controller(mhi_ctrl);
return ret;
}
 
@@ -252,7 +252,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
ret = mhi_register_controller(mhi_ctrl, _mhi_config);
if (ret) {
ath11k_err(ab, "failed to register to mhi bus, err = %d\n", 
ret);
-   kfree(mhi_ctrl);
+   mhi_free_controller(mhi_ctrl);
return ret;
}
 
@@ -265,6 +265,7 @@ void ath11k_mhi_unregister(struct ath11k_pci *ab_pci)
 
mhi_unregister_controller(mhi_ctrl);
kfree(mhi_ctrl->irq);
+   mhi_free_controller(mhi_ctrl);
 }
 
 static char *ath11k_mhi_state_to_str(enum ath11k_mhi_state mhi_state)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project