All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] dmaengine: move module_/dma_device_put() after route free
@ 2019-12-24  5:03 Vinod Koul
  2019-12-24  5:03 ` [PATCH 2/2] dmaengine: print more meaningful error message Vinod Koul
  2019-12-25  2:26 ` [PATCH 1/2] dmaengine: move module_/dma_device_put() after route free Logan Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Vinod Koul @ 2019-12-24  5:03 UTC (permalink / raw)
  To: dmaengine; +Cc: Vinod Koul, Logan Gunthorpe

We call dma_device_put() and module_put() after invoking
.device_free_chan_resources callback, but we should also take care of
router devices and invoke this after .route_free callback. So move it
after .route_free

Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
 drivers/dma/dmaengine.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index e316abe3672d..0505ea5b002f 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -427,15 +427,15 @@ static void dma_chan_put(struct dma_chan *chan)
 		chan->device->device_free_chan_resources(chan);
 	}
 
-	dma_device_put(chan->device);
-	module_put(dma_chan_to_owner(chan));
-
 	/* If the channel is used via a DMA request router, free the mapping */
 	if (chan->router && chan->router->route_free) {
 		chan->router->route_free(chan->router->dev, chan->route_data);
 		chan->router = NULL;
 		chan->route_data = NULL;
 	}
+
+	dma_device_put(chan->device);
+	module_put(dma_chan_to_owner(chan));
 }
 
 enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie)
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] dmaengine: print more meaningful error message
  2019-12-24  5:03 [PATCH 1/2] dmaengine: move module_/dma_device_put() after route free Vinod Koul
@ 2019-12-24  5:03 ` Vinod Koul
  2019-12-25  2:26 ` [PATCH 1/2] dmaengine: move module_/dma_device_put() after route free Logan Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2019-12-24  5:03 UTC (permalink / raw)
  To: dmaengine; +Cc: Vinod Koul, Logan Gunthorpe

error log for dma_channel_table_init() failure pointed a mere
"initialization failure", which is not very helpful message, so print
additional details like function name and error code.

Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
 drivers/dma/dmaengine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 0505ea5b002f..4ac77456e830 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -206,7 +206,7 @@ static int __init dma_channel_table_init(void)
 	}
 
 	if (err) {
-		pr_err("initialization failure\n");
+		pr_err("dmaengine dma_channel_table_init failure: %d\n", err);
 		for_each_dma_cap_mask(cap, dma_cap_mask_all)
 			free_percpu(channel_table[cap]);
 	}
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] dmaengine: move module_/dma_device_put() after route free
  2019-12-24  5:03 [PATCH 1/2] dmaengine: move module_/dma_device_put() after route free Vinod Koul
  2019-12-24  5:03 ` [PATCH 2/2] dmaengine: print more meaningful error message Vinod Koul
@ 2019-12-25  2:26 ` Logan Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Logan Gunthorpe @ 2019-12-25  2:26 UTC (permalink / raw)
  To: Vinod Koul, dmaengine



On 2019-12-23 10:03 p.m., Vinod Koul wrote:
> We call dma_device_put() and module_put() after invoking
> .device_free_chan_resources callback, but we should also take care of
> router devices and invoke this after .route_free callback. So move it
> after .route_free
> 
> Signed-off-by: Vinod Koul <vkoul@kernel.org>

Makes sense.

Reviewed-by: Logan Gunthorpe <logang@deltatee.com>

> ---
>  drivers/dma/dmaengine.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index e316abe3672d..0505ea5b002f 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -427,15 +427,15 @@ static void dma_chan_put(struct dma_chan *chan)
>  		chan->device->device_free_chan_resources(chan);
>  	}
>  
> -	dma_device_put(chan->device);
> -	module_put(dma_chan_to_owner(chan));
> -
>  	/* If the channel is used via a DMA request router, free the mapping */
>  	if (chan->router && chan->router->route_free) {
>  		chan->router->route_free(chan->router->dev, chan->route_data);
>  		chan->router = NULL;
>  		chan->route_data = NULL;
>  	}
> +
> +	dma_device_put(chan->device);
> +	module_put(dma_chan_to_owner(chan));
>  }
>  
>  enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie)
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-25  2:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-24  5:03 [PATCH 1/2] dmaengine: move module_/dma_device_put() after route free Vinod Koul
2019-12-24  5:03 ` [PATCH 2/2] dmaengine: print more meaningful error message Vinod Koul
2019-12-25  2:26 ` [PATCH 1/2] dmaengine: move module_/dma_device_put() after route free Logan Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.