aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Ujfalusi2016-10-13 08:31:21 -0500
committerTero Kristo2016-10-14 01:27:09 -0500
commitd8018fd6a3743039560102163012c78976f83d6c (patch)
treef260fe8600db24d64bbb4a183bf302730b71ab5c
parentcc2f93de6f83e7c23b124cfb0aa2d1317a1b5071 (diff)
downloadgraphics-kernel-feature-tree-d8018fd6a3743039560102163012c78976f83d6c.tar.gz
graphics-kernel-feature-tree-d8018fd6a3743039560102163012c78976f83d6c.tar.xz
graphics-kernel-feature-tree-d8018fd6a3743039560102163012c78976f83d6c.zip
dmaengine: omap-dma: Dynamically allocate memory for lch_map
commit 2d1a9a946faebfedd660a1f1c2b90984fff41f91 upstream. On OMAP1 platforms we do not have 32 channels available. Allocate the lch_map based on the available channels. This way we are not going to have more visible channels then it is available on the platform. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r--drivers/dma/omap-dma.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
index cd2bcc10f1e2..9baf8be12e77 100644
--- a/drivers/dma/omap-dma.c
+++ b/drivers/dma/omap-dma.c
@@ -35,7 +35,7 @@ struct omap_dmadev {
35 unsigned dma_requests; 35 unsigned dma_requests;
36 spinlock_t irq_lock; 36 spinlock_t irq_lock;
37 uint32_t irq_enable_mask; 37 uint32_t irq_enable_mask;
38 struct omap_chan *lch_map[OMAP_SDMA_CHANNELS]; 38 struct omap_chan **lch_map;
39}; 39};
40 40
41struct omap_chan { 41struct omap_chan {
@@ -1223,16 +1223,24 @@ static int omap_dma_probe(struct platform_device *pdev)
1223 spin_lock_init(&od->lock); 1223 spin_lock_init(&od->lock);
1224 spin_lock_init(&od->irq_lock); 1224 spin_lock_init(&od->irq_lock);
1225 1225
1226 od->dma_requests = OMAP_SDMA_REQUESTS; 1226 if (!pdev->dev.of_node) {
1227 if (pdev->dev.of_node && of_property_read_u32(pdev->dev.of_node, 1227 od->dma_requests = od->plat->dma_attr->lch_count;
1228 "dma-requests", 1228 if (unlikely(!od->dma_requests))
1229 &od->dma_requests)) { 1229 od->dma_requests = OMAP_SDMA_REQUESTS;
1230 } else if (of_property_read_u32(pdev->dev.of_node, "dma-requests",
1231 &od->dma_requests)) {
1230 dev_info(&pdev->dev, 1232 dev_info(&pdev->dev,
1231 "Missing dma-requests property, using %u.\n", 1233 "Missing dma-requests property, using %u.\n",
1232 OMAP_SDMA_REQUESTS); 1234 OMAP_SDMA_REQUESTS);
1235 od->dma_requests = OMAP_SDMA_REQUESTS;
1233 } 1236 }
1234 1237
1235 for (i = 0; i < OMAP_SDMA_CHANNELS; i++) { 1238 od->lch_map = devm_kcalloc(&pdev->dev, od->dma_requests,
1239 sizeof(*od->lch_map), GFP_KERNEL);
1240 if (!od->lch_map)
1241 return -ENOMEM;
1242
1243 for (i = 0; i < od->dma_requests; i++) {
1236 rc = omap_dma_chan_init(od); 1244 rc = omap_dma_chan_init(od);
1237 if (rc) { 1245 if (rc) {
1238 omap_dma_free(od); 1246 omap_dma_free(od);