From: peter.ujfalusi@ti.com (Peter Ujfalusi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] dmaengine: ti-dma-crossbar: dra7: Use bitops instead of idr
Date: Fri, 30 Oct 2015 10:02:47 +0200 [thread overview]
Message-ID: <56332427.6000805@ti.com> (raw)
In-Reply-To: <1446107331-30041-2-git-send-email-peter.ujfalusi@ti.com>
For the record...
On 10/29/2015 10:28 AM, Peter Ujfalusi wrote:
> The use of idr was nice, but it was a bit heavy and we did not need the
> features it provides. Using simple bitmap to track allocated DMA channels
> is adequate here and it will be easier to add support for reserving
> channels later on.
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> - map->xbar_out = idr_alloc(&xbar->map_idr, NULL, 0, xbar->dma_requests,
> - GFP_KERNEL);
> + mutex_lock(&xbar->mutex);
> + map->xbar_out = find_next_zero_bit(xbar->dma_inuse, xbar->dma_requests,
> + 0);
find_first_zero_bit() ;)
> + mutex_unlock(&xbar->mutex);
> + if (map->xbar_out) {
Well, this is obviously wrong... Should have been:
if (map->xbar_out == xbar->dma_requests) {
> + dev_err(&pdev->dev, "Run out of free DMA requests\n");
> + kfree(map);
> + return ERR_PTR(-ENOMEM);
> + }
> + set_bit(map->xbar_out, xbar->dma_inuse);
> +
--
P?ter
next prev parent reply other threads:[~2015-10-30 8:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-29 8:28 [PATCH 0/3] dmaengine: ti-dma-crossbar: channel reserving and edma3-tcc support Peter Ujfalusi
2015-10-29 8:28 ` [PATCH 1/3] dmaengine: ti-dma-crossbar: dra7: Use bitops instead of idr Peter Ujfalusi
2015-10-30 8:02 ` Peter Ujfalusi [this message]
2015-10-29 8:28 ` [PATCH 2/3] dmaengine: ti-dma-crossbar: dra7: Support for reserving DMA event ranges Peter Ujfalusi
2015-10-29 8:28 ` [PATCH 3/3] dmaengine: ti-dma-crossbar: dra7: Support for eDMA with new bindings Peter Ujfalusi
2015-10-30 7:20 ` [PATCH 0/3] dmaengine: ti-dma-crossbar: channel reserving and edma3-tcc support Peter Ujfalusi
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=56332427.6000805@ti.com \
--to=peter.ujfalusi@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).