Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1259290

Re: [PATCH 1/3] dmaengine: ti-dma-crossbar: dra7: Use bitops instead of idr

From Peter Ujfalusi <peter.ujfalusi@ti.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/3] dmaengine: ti-dma-crossbar: dra7: Use bitops instead of idr
Date 2015-10-30 09:10 +0100
Message-ID <qpcV3-3mx-9@gated-at.bofh.it> (permalink)
References <qoQKS-6cM-41@gated-at.bofh.it> <qoQUy-6fX-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] dmaengine: ti-dma-crossbar: channel reserving and edma3-tcc support Peter Ujfalusi <peter.ujfalusi@ti.com> - 2015-10-29 09:30 +0100
  [PATCH 1/3] dmaengine: ti-dma-crossbar: dra7: Use bitops instead of idr Peter Ujfalusi <peter.ujfalusi@ti.com> - 2015-10-29 09:40 +0100
    Re: [PATCH 1/3] dmaengine: ti-dma-crossbar: dra7: Use bitops instead  of idr Peter Ujfalusi <peter.ujfalusi@ti.com> - 2015-10-30 09:10 +0100
  [PATCH 3/3] dmaengine: ti-dma-crossbar: dra7: Support for eDMA with new bindings Peter Ujfalusi <peter.ujfalusi@ti.com> - 2015-10-29 09:40 +0100
  [PATCH 2/3] dmaengine: ti-dma-crossbar: dra7: Support for reserving DMA event ranges Peter Ujfalusi <peter.ujfalusi@ti.com> - 2015-10-29 09:40 +0100
  Re: [PATCH 0/3] dmaengine: ti-dma-crossbar: channel reserving and  edma3-tcc support Peter Ujfalusi <peter.ujfalusi@ti.com> - 2015-10-30 08:30 +0100

csiph-web