diff mbox

[v5,3/4] dmaengine: pl330: Store pointer to slave device

Message ID 1484657338-26338-4-git-send-email-m.szyprowski@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Marek Szyprowski Jan. 17, 2017, 12:48 p.m. UTC
Store the pointer to slave device, which requested our channel. It will be
later used to implement runtime PM of PL330 DMA controller. Although
DMA channels might be requested many times, each DMA peripheral channel is
physically dedicated only for specific hardware, so there should be only
one slave device for each channel.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/dma/pl330.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Krzysztof Kozlowski Jan. 17, 2017, 5:29 p.m. UTC | #1
On Tue, Jan 17, 2017 at 01:48:57PM +0100, Marek Szyprowski wrote:
> Store the pointer to slave device, which requested our channel. It will be
> later used to implement runtime PM of PL330 DMA controller. Although
> DMA channels might be requested many times, each DMA peripheral channel is
> physically dedicated only for specific hardware, so there should be only
> one slave device for each channel.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Acked-by: Arnd Bergmann <arnd@arndb.de>

Any particular reason for removing my Reviewed-by? Any changes here?

Best regards,
Krzysztof

> ---
>  drivers/dma/pl330.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> index b6b2cc912380..c77a3494659c 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -450,6 +450,7 @@ struct dma_pl330_chan {
>  
>  	/* for runtime pm tracking */
>  	bool active;
> +	struct device *slave;
>  };
>  
>  struct pl330_dmac {
> @@ -2093,6 +2094,14 @@ static struct dma_chan *of_dma_pl330_xlate(struct of_phandle_args *dma_spec,
>  	if (chan_id >= pl330->num_peripherals)
>  		return NULL;
>  
> +	if (!pl330->peripherals[chan_id].slave) {
> +		pl330->peripherals[chan_id].slave = slave;
> +	} else if (pl330->peripherals[chan_id].slave != slave) {
> +		dev_err(pl330->ddma.dev,
> +			"Can't use same channel with multiple slave devices!\n");
> +		return NULL;
> +	}
> +
>  	return dma_get_slave_channel(&pl330->peripherals[chan_id].chan);
>  }
>  
> -- 
> 1.9.1
>
Marek Szyprowski Jan. 18, 2017, 7:07 a.m. UTC | #2
Hi Krzysztof,

On 2017-01-17 18:29, Krzysztof Kozlowski wrote:
> On Tue, Jan 17, 2017 at 01:48:57PM +0100, Marek Szyprowski wrote:
>> Store the pointer to slave device, which requested our channel. It will be
>> later used to implement runtime PM of PL330 DMA controller. Although
>> DMA channels might be requested many times, each DMA peripheral channel is
>> physically dedicated only for specific hardware, so there should be only
>> one slave device for each channel.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> Acked-by: Arnd Bergmann <arnd@arndb.de>
> Any particular reason for removing my Reviewed-by? Any changes here?

No changes here. I'm sorry, the tag got lost during rebase.

> Best regards,
> Krzysztof
>
>> ---
>>   drivers/dma/pl330.c | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
>> index b6b2cc912380..c77a3494659c 100644
>> --- a/drivers/dma/pl330.c
>> +++ b/drivers/dma/pl330.c
>> @@ -450,6 +450,7 @@ struct dma_pl330_chan {
>>   
>>   	/* for runtime pm tracking */
>>   	bool active;
>> +	struct device *slave;
>>   };
>>   
>>   struct pl330_dmac {
>> @@ -2093,6 +2094,14 @@ static struct dma_chan *of_dma_pl330_xlate(struct of_phandle_args *dma_spec,
>>   	if (chan_id >= pl330->num_peripherals)
>>   		return NULL;
>>   
>> +	if (!pl330->peripherals[chan_id].slave) {
>> +		pl330->peripherals[chan_id].slave = slave;
>> +	} else if (pl330->peripherals[chan_id].slave != slave) {
>> +		dev_err(pl330->ddma.dev,
>> +			"Can't use same channel with multiple slave devices!\n");
>> +		return NULL;
>> +	}
>> +
>>   	return dma_get_slave_channel(&pl330->peripherals[chan_id].chan);
>>   }
>>   
>> -- 
>> 1.9.1
>>
>
>

Best regards
Krzysztof Kozlowski Jan. 18, 2017, 2:13 p.m. UTC | #3
On Wed, Jan 18, 2017 at 08:07:22AM +0100, Marek Szyprowski wrote:
> Hi Krzysztof,
> 
> On 2017-01-17 18:29, Krzysztof Kozlowski wrote:
> > On Tue, Jan 17, 2017 at 01:48:57PM +0100, Marek Szyprowski wrote:
> > > Store the pointer to slave device, which requested our channel. It will be
> > > later used to implement runtime PM of PL330 DMA controller. Although
> > > DMA channels might be requested many times, each DMA peripheral channel is
> > > physically dedicated only for specific hardware, so there should be only
> > > one slave device for each channel.
> > > 
> > > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> > > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > Any particular reason for removing my Reviewed-by? Any changes here?
> 
> No changes here. I'm sorry, the tag got lost during rebase.

Okay:
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof
diff mbox

Patch

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index b6b2cc912380..c77a3494659c 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -450,6 +450,7 @@  struct dma_pl330_chan {
 
 	/* for runtime pm tracking */
 	bool active;
+	struct device *slave;
 };
 
 struct pl330_dmac {
@@ -2093,6 +2094,14 @@  static struct dma_chan *of_dma_pl330_xlate(struct of_phandle_args *dma_spec,
 	if (chan_id >= pl330->num_peripherals)
 		return NULL;
 
+	if (!pl330->peripherals[chan_id].slave) {
+		pl330->peripherals[chan_id].slave = slave;
+	} else if (pl330->peripherals[chan_id].slave != slave) {
+		dev_err(pl330->ddma.dev,
+			"Can't use same channel with multiple slave devices!\n");
+		return NULL;
+	}
+
 	return dma_get_slave_channel(&pl330->peripherals[chan_id].chan);
 }