diff mbox

[V4,04/10] dmaengine: qcom_hidma: configure DMA and MSI for OF

Message ID 1475115167-5898-5-git-send-email-okaya@codeaurora.org (mailing list archive)
State Changes Requested
Headers show

Commit Message

Sinan Kaya Sept. 29, 2016, 2:12 a.m. UTC
Configure the DMA bindings for the device tree based firmware.

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 drivers/dma/qcom/hidma_mgmt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Vinod Koul Oct. 1, 2016, 6:17 a.m. UTC | #1
On Wed, Sep 28, 2016 at 10:12:41PM -0400, Sinan Kaya wrote:
> Configure the DMA bindings for the device tree based firmware.
> 
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
> ---
>  drivers/dma/qcom/hidma_mgmt.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c
> index 82f36e4..e8f6b84 100644
> --- a/drivers/dma/qcom/hidma_mgmt.c
> +++ b/drivers/dma/qcom/hidma_mgmt.c
> @@ -375,8 +375,11 @@ static int __init hidma_mgmt_of_populate_channels(struct device_node *np)
>  			ret = PTR_ERR(new_pdev);
>  			goto out;
>  		}
> +		of_node_get(child);
> +		new_pdev->dev.of_node = child;
>  		of_dma_configure(&new_pdev->dev, child);
> -
> +		of_msi_configure(&new_pdev->dev, child);
> +		of_node_put(child);

should this be done unconditionally? Dont we needto call this only for
platforms with msi?

>  		kfree(res);
>  		res = NULL;
>  	}
> -- 
> 1.9.1
>
Sinan Kaya Oct. 1, 2016, 3:15 p.m. UTC | #2
On 10/1/2016 2:17 AM, Vinod Koul wrote:
> On Wed, Sep 28, 2016 at 10:12:41PM -0400, Sinan Kaya wrote:
>> Configure the DMA bindings for the device tree based firmware.
>>
>> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
>> ---
>>  drivers/dma/qcom/hidma_mgmt.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c
>> index 82f36e4..e8f6b84 100644
>> --- a/drivers/dma/qcom/hidma_mgmt.c
>> +++ b/drivers/dma/qcom/hidma_mgmt.c
>> @@ -375,8 +375,11 @@ static int __init hidma_mgmt_of_populate_channels(struct device_node *np)
>>  			ret = PTR_ERR(new_pdev);
>>  			goto out;
>>  		}
>> +		of_node_get(child);
>> +		new_pdev->dev.of_node = child;
>>  		of_dma_configure(&new_pdev->dev, child);
>> -
>> +		of_msi_configure(&new_pdev->dev, child);
>> +		of_node_put(child);
> 
> should this be done unconditionally? Dont we needto call this only for
> platforms with msi?

I followed the pattern in of_platform_device_create_pdata function. of_msi_configure does
nothing if MSI is not enabled as irq_find_matching_host returns NULL. It didn't have any
side effects on my testing either.


> 
>>  		kfree(res);
>>  		res = NULL;
>>  	}
>> -- 
>> 1.9.1
>>
>
Vinod Koul Oct. 3, 2016, 3:38 a.m. UTC | #3
On Sat, Oct 01, 2016 at 11:15:00AM -0400, Sinan Kaya wrote:
> On 10/1/2016 2:17 AM, Vinod Koul wrote:
> > On Wed, Sep 28, 2016 at 10:12:41PM -0400, Sinan Kaya wrote:
> >> Configure the DMA bindings for the device tree based firmware.
> >>
> >> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
> >> ---
> >>  drivers/dma/qcom/hidma_mgmt.c | 5 ++++-
> >>  1 file changed, 4 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c
> >> index 82f36e4..e8f6b84 100644
> >> --- a/drivers/dma/qcom/hidma_mgmt.c
> >> +++ b/drivers/dma/qcom/hidma_mgmt.c
> >> @@ -375,8 +375,11 @@ static int __init hidma_mgmt_of_populate_channels(struct device_node *np)
> >>  			ret = PTR_ERR(new_pdev);
> >>  			goto out;
> >>  		}
> >> +		of_node_get(child);
> >> +		new_pdev->dev.of_node = child;
> >>  		of_dma_configure(&new_pdev->dev, child);
> >> -
> >> +		of_msi_configure(&new_pdev->dev, child);
> >> +		of_node_put(child);
> > 
> > should this be done unconditionally? Dont we needto call this only for
> > platforms with msi?
> 
> I followed the pattern in of_platform_device_create_pdata function. of_msi_configure does
> nothing if MSI is not enabled as irq_find_matching_host returns NULL. It didn't have any
> side effects on my testing either.

yeah later on I did look up the of_msi_configure() and I suspected this. I
think it would be worthwhile to document this assumption here.

Thanks
Sinan Kaya Oct. 3, 2016, 1:39 p.m. UTC | #4
On 10/2/2016 11:38 PM, Vinod Koul wrote:
>> I followed the pattern in of_platform_device_create_pdata function. of_msi_configure does
>> > nothing if MSI is not enabled as irq_find_matching_host returns NULL. It didn't have any
>> > side effects on my testing either.
> yeah later on I did look up the of_msi_configure() and I suspected this. I
> think it would be worthwhile to document this assumption here.

Sure, let me do that.
diff mbox

Patch

diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c
index 82f36e4..e8f6b84 100644
--- a/drivers/dma/qcom/hidma_mgmt.c
+++ b/drivers/dma/qcom/hidma_mgmt.c
@@ -375,8 +375,11 @@  static int __init hidma_mgmt_of_populate_channels(struct device_node *np)
 			ret = PTR_ERR(new_pdev);
 			goto out;
 		}
+		of_node_get(child);
+		new_pdev->dev.of_node = child;
 		of_dma_configure(&new_pdev->dev, child);
-
+		of_msi_configure(&new_pdev->dev, child);
+		of_node_put(child);
 		kfree(res);
 		res = NULL;
 	}