aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/shdma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/shdma.c')
-rw-r--r--drivers/dma/shdma.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index 636e40925b16..028330044201 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -343,7 +343,7 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
343 343
344 dmae_set_dmars(sh_chan, cfg->mid_rid); 344 dmae_set_dmars(sh_chan, cfg->mid_rid);
345 dmae_set_chcr(sh_chan, cfg->chcr); 345 dmae_set_chcr(sh_chan, cfg->chcr);
346 } else if ((sh_dmae_readl(sh_chan, CHCR) & 0xf00) != 0x400) { 346 } else {
347 dmae_init(sh_chan); 347 dmae_init(sh_chan);
348 } 348 }
349 349
@@ -1144,6 +1144,8 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
1144 /* platform data */ 1144 /* platform data */
1145 shdev->pdata = pdata; 1145 shdev->pdata = pdata;
1146 1146
1147 platform_set_drvdata(pdev, shdev);
1148
1147 pm_runtime_enable(&pdev->dev); 1149 pm_runtime_enable(&pdev->dev);
1148 pm_runtime_get_sync(&pdev->dev); 1150 pm_runtime_get_sync(&pdev->dev);
1149 1151
@@ -1219,6 +1221,11 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
1219 } else { 1221 } else {
1220 do { 1222 do {
1221 for (i = chanirq_res->start; i <= chanirq_res->end; i++) { 1223 for (i = chanirq_res->start; i <= chanirq_res->end; i++) {
1224 if (irq_cnt >= SH_DMAC_MAX_CHANNELS) {
1225 irq_cap = 1;
1226 break;
1227 }
1228
1222 if ((errirq_res->flags & IORESOURCE_BITS) == 1229 if ((errirq_res->flags & IORESOURCE_BITS) ==
1223 IORESOURCE_IRQ_SHAREABLE) 1230 IORESOURCE_IRQ_SHAREABLE)
1224 chan_flag[irq_cnt] = IRQF_SHARED; 1231 chan_flag[irq_cnt] = IRQF_SHARED;
@@ -1228,15 +1235,11 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
1228 "Found IRQ %d for channel %d\n", 1235 "Found IRQ %d for channel %d\n",
1229 i, irq_cnt); 1236 i, irq_cnt);
1230 chan_irq[irq_cnt++] = i; 1237 chan_irq[irq_cnt++] = i;
1231
1232 if (irq_cnt >= SH_DMAC_MAX_CHANNELS)
1233 break;
1234 } 1238 }
1235 1239
1236 if (irq_cnt >= SH_DMAC_MAX_CHANNELS) { 1240 if (irq_cnt >= SH_DMAC_MAX_CHANNELS)
1237 irq_cap = 1;
1238 break; 1241 break;
1239 } 1242
1240 chanirq_res = platform_get_resource(pdev, 1243 chanirq_res = platform_get_resource(pdev,
1241 IORESOURCE_IRQ, ++irqres); 1244 IORESOURCE_IRQ, ++irqres);
1242 } while (irq_cnt < pdata->channel_num && chanirq_res); 1245 } while (irq_cnt < pdata->channel_num && chanirq_res);
@@ -1256,7 +1259,6 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
1256 1259
1257 pm_runtime_put(&pdev->dev); 1260 pm_runtime_put(&pdev->dev);
1258 1261
1259 platform_set_drvdata(pdev, shdev);
1260 dma_async_device_register(&shdev->common); 1262 dma_async_device_register(&shdev->common);
1261 1263
1262 return err; 1264 return err;
@@ -1278,6 +1280,8 @@ rst_err:
1278 1280
1279 if (dmars) 1281 if (dmars)
1280 iounmap(shdev->dmars); 1282 iounmap(shdev->dmars);
1283
1284 platform_set_drvdata(pdev, NULL);
1281emapdmars: 1285emapdmars:
1282 iounmap(shdev->chan_reg); 1286 iounmap(shdev->chan_reg);
1283 synchronize_rcu(); 1287 synchronize_rcu();
@@ -1316,6 +1320,8 @@ static int __exit sh_dmae_remove(struct platform_device *pdev)
1316 iounmap(shdev->dmars); 1320 iounmap(shdev->dmars);
1317 iounmap(shdev->chan_reg); 1321 iounmap(shdev->chan_reg);
1318 1322
1323 platform_set_drvdata(pdev, NULL);
1324
1319 synchronize_rcu(); 1325 synchronize_rcu();
1320 kfree(shdev); 1326 kfree(shdev);
1321 1327