From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 05/59] dmaengine: Make channel allocation callbacks optional
Date: Thu, 23 Oct 2014 00:05:13 +0300 [thread overview]
Message-ID: <17062495.59UaxHxT3Y@avalon> (raw)
In-Reply-To: <1413992653-21963-6-git-send-email-maxime.ripard@free-electrons.com>
Hi Maxime,
Thank you for the patch.
On Wednesday 22 October 2014 17:43:19 Maxime Ripard wrote:
> Nowadays, some drivers don't have anything in there channel allocation
> callbacks anymore.
>
> Remove the BUG_ON if those callbacks aren't implemented, in order to allow
> drivers to not implement them.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/dma/dmaengine.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index 72f10e2f5c32..9b2cd74b8f2e 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -235,9 +235,11 @@ static int dma_chan_get(struct dma_chan *chan)
> return -ENODEV;
>
> /* allocate upon first client reference */
> - ret = chan->device->device_alloc_chan_resources(chan);
> - if (ret < 0)
> - goto err_out;
> + if (chan->device->device_alloc_chan_resources) {
> + ret = chan->device->device_alloc_chan_resources(chan);
> + if (ret < 0)
> + goto err_out;
> + }
>
> if (!dma_has_cap(DMA_PRIVATE, chan->device->cap_mask))
> balance_ref_count(chan);
> @@ -259,11 +261,15 @@ err_out:
> */
> static void dma_chan_put(struct dma_chan *chan)
> {
> + /* This channel is not in use, bail out */
> if (!chan->client_count)
> - return; /* this channel failed alloc_chan_resources */
> + return;
> +
> chan->client_count--;
> module_put(dma_chan_to_owner(chan));
> - if (chan->client_count == 0)
> +
> + /* This channel is not in use anymore, free it */
> + if (!chan->client_count && chan->device->device_free_chan_resources)
> chan->device->device_free_chan_resources(chan);
> }
>
> @@ -819,8 +825,6 @@ int dma_async_device_register(struct dma_device *device)
> BUG_ON(dma_has_cap(DMA_INTERLEAVE, device->cap_mask) &&
> !device->device_prep_interleaved_dma);
>
> - BUG_ON(!device->device_alloc_chan_resources);
> - BUG_ON(!device->device_free_chan_resources);
> BUG_ON(!device->device_tx_status);
> BUG_ON(!device->device_issue_pending);
> BUG_ON(!device->dev);
--
Regards,
Laurent Pinchart
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: dmaengine@vger.kernel.org, "Vinod Koul" <vinod.koul@intel.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
"Antoine Ténart" <antoine@free-electrons.com>,
lars@metafoo.de, "Russell King" <linux@arm.linux.org.uk>,
"Dan Williams" <dan.j.williams@intel.com>
Subject: Re: [PATCH v3 05/59] dmaengine: Make channel allocation callbacks optional
Date: Thu, 23 Oct 2014 00:05:13 +0300 [thread overview]
Message-ID: <17062495.59UaxHxT3Y@avalon> (raw)
In-Reply-To: <1413992653-21963-6-git-send-email-maxime.ripard@free-electrons.com>
Hi Maxime,
Thank you for the patch.
On Wednesday 22 October 2014 17:43:19 Maxime Ripard wrote:
> Nowadays, some drivers don't have anything in there channel allocation
> callbacks anymore.
>
> Remove the BUG_ON if those callbacks aren't implemented, in order to allow
> drivers to not implement them.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/dma/dmaengine.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index 72f10e2f5c32..9b2cd74b8f2e 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -235,9 +235,11 @@ static int dma_chan_get(struct dma_chan *chan)
> return -ENODEV;
>
> /* allocate upon first client reference */
> - ret = chan->device->device_alloc_chan_resources(chan);
> - if (ret < 0)
> - goto err_out;
> + if (chan->device->device_alloc_chan_resources) {
> + ret = chan->device->device_alloc_chan_resources(chan);
> + if (ret < 0)
> + goto err_out;
> + }
>
> if (!dma_has_cap(DMA_PRIVATE, chan->device->cap_mask))
> balance_ref_count(chan);
> @@ -259,11 +261,15 @@ err_out:
> */
> static void dma_chan_put(struct dma_chan *chan)
> {
> + /* This channel is not in use, bail out */
> if (!chan->client_count)
> - return; /* this channel failed alloc_chan_resources */
> + return;
> +
> chan->client_count--;
> module_put(dma_chan_to_owner(chan));
> - if (chan->client_count == 0)
> +
> + /* This channel is not in use anymore, free it */
> + if (!chan->client_count && chan->device->device_free_chan_resources)
> chan->device->device_free_chan_resources(chan);
> }
>
> @@ -819,8 +825,6 @@ int dma_async_device_register(struct dma_device *device)
> BUG_ON(dma_has_cap(DMA_INTERLEAVE, device->cap_mask) &&
> !device->device_prep_interleaved_dma);
>
> - BUG_ON(!device->device_alloc_chan_resources);
> - BUG_ON(!device->device_free_chan_resources);
> BUG_ON(!device->device_tx_status);
> BUG_ON(!device->device_issue_pending);
> BUG_ON(!device->dev);
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2014-10-22 21:05 UTC|newest]
Thread overview: 141+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-22 15:43 [PATCH v3 00/59] dmaengine: Implement generic slave capabilities retrieval Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 01/59] crypto: ux500: Use dmaengine_terminate_all API Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 02/59] serial: at91: Use dmaengine_slave_config API Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 03/59] dmaengine: Make the destination abbreviation coherent Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 04/59] dmaengine: Rework dma_chan_get Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 21:27 ` Laurent Pinchart
2014-10-22 21:27 ` Laurent Pinchart
2014-10-22 15:43 ` [PATCH v3 05/59] dmaengine: Make channel allocation callbacks optional Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 21:05 ` Laurent Pinchart [this message]
2014-10-22 21:05 ` Laurent Pinchart
2014-10-22 15:43 ` [PATCH v3 06/59] dmaengine: Introduce a device_config callback Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 07/59] dmaengine: split out pause/resume operations from device_control Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 08/59] dmaengine: Add device_terminate_all callback Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 09/59] dmaengine: Remove the need to declare device_control Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 21:06 ` Laurent Pinchart
2014-10-22 21:06 ` Laurent Pinchart
2014-10-22 15:43 ` [PATCH v3 10/59] dmaengine: Create a generic dma_slave_caps callback Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 11/59] dmaengine: Move slave caps to dma_device Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 21:06 ` Laurent Pinchart
2014-10-22 21:06 ` Laurent Pinchart
2014-10-22 15:43 ` [PATCH v3 12/59] dmaengine: pl08x: Split device_control Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 13/59] dmaengine: hdmac: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 14/59] dmaengine: bcm2835: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 15/59] dmaengine: coh901318: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 16/59] dmaengine: cppi41: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 17/59] dmaengine: jz4740: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 18/59] dmaengine: dw: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 19/59] dmaengine: edma: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 20/59] dmaengine: ep93xx: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 21/59] dmaengine: fsl-edma: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 22/59] dmaengine: imx: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 23/59] dmaengine: imx-sdma: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 24/59] dmaengine: intel-mid-dma: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 25/59] dmaengine: ipu-idmac: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 26/59] dmaengine: k3: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 27/59] dmaengine: mmp-pdma: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 28/59] dmaengine: mmp-tdma: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 29/59] dmaengine: moxart: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 30/59] dmaengine: fsl-dma: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 31/59] dmaengine: mpc512x: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 32/59] dmaengine: mxs: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 33/59] dmaengine: nbpfaxi: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 34/59] dmaengine: omap: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 35/59] dmaengine: pl330: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 36/59] dmaengine: bam-dma: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 37/59] dmaengine: s3c24xx: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 38/59] dmaengine: sa11x0: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 39/59] dmaengine: sh: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 40/59] dmaengine: sirf: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 41/59] dmaengine: sun6i: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 42/59] dmaengine: d40: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 43/59] dmaengine: tegra20: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 44/59] dmaengine: xilinx: " Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:43 ` [PATCH v3 45/59] dmaengine: mv_xor: Remove device_control Maxime Ripard
2014-10-22 15:43 ` Maxime Ripard
2014-10-22 15:44 ` [PATCH v3 46/59] dmaengine: pch-dma: Rename device_control Maxime Ripard
2014-10-22 15:44 ` Maxime Ripard
2014-10-22 15:44 ` [PATCH v3 47/59] dmaengine: td: " Maxime Ripard
2014-10-22 15:44 ` Maxime Ripard
2014-10-22 15:44 ` [PATCH v3 48/59] dmaengine: txx9: " Maxime Ripard
2014-10-22 15:44 ` Maxime Ripard
2014-10-22 15:44 ` [PATCH v3 49/59] dmaengine: rapidio: tsi721: " Maxime Ripard
2014-10-22 15:44 ` Maxime Ripard
2014-10-22 15:44 ` [PATCH v3 50/59] dmaengine: bcm2835: Declare slave capabilities for the generic code Maxime Ripard
2014-10-22 15:44 ` Maxime Ripard
2014-10-22 15:44 ` [PATCH v3 51/59] dmaengine: fsl-edma: " Maxime Ripard
2014-10-22 15:44 ` Maxime Ripard
2014-10-22 15:44 ` [PATCH v3 52/59] dmaengine: edma: " Maxime Ripard
2014-10-22 15:44 ` Maxime Ripard
2014-10-22 15:44 ` [PATCH v3 53/59] dmaengine: nbpfaxi: " Maxime Ripard
2014-10-22 15:44 ` Maxime Ripard
2014-10-22 15:44 ` [PATCH v3 54/59] dmaengine: omap: " Maxime Ripard
2014-10-22 15:44 ` Maxime Ripard
2014-10-22 15:44 ` [PATCH v3 55/59] dmaengine: pl330: " Maxime Ripard
2014-10-22 15:44 ` Maxime Ripard
2014-10-22 15:44 ` [PATCH v3 56/59] dmaengine: sirf: " Maxime Ripard
2014-10-22 15:44 ` Maxime Ripard
2014-10-22 15:44 ` [PATCH v3 57/59] dmaengine: sun6i: " Maxime Ripard
2014-10-22 15:44 ` Maxime Ripard
2014-10-22 15:44 ` [PATCH v3 58/59] dmaengine: Add a warning for drivers not using the generic slave caps retrieval Maxime Ripard
2014-10-22 15:44 ` Maxime Ripard
2014-10-22 21:21 ` Laurent Pinchart
2014-10-22 21:21 ` Laurent Pinchart
2014-10-23 13:19 ` Maxime Ripard
2014-10-23 13:19 ` Maxime Ripard
2014-10-23 13:38 ` Laurent Pinchart
2014-10-23 13:38 ` Laurent Pinchart
2014-10-23 13:46 ` Maxime Ripard
2014-10-23 13:46 ` Maxime Ripard
2014-10-22 15:44 ` [PATCH v3 59/59] dmaengine: Remove device_control and device_slave_caps Maxime Ripard
2014-10-22 15:44 ` Maxime Ripard
2014-10-22 21:22 ` Laurent Pinchart
2014-10-22 21:22 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17062495.59UaxHxT3Y@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.