Skip to content

Commit 3c814be

Browse files
author
Vinod Koul
committed
Merge branch 'topic/dw' into for-linus
2 parents 877d842 + 1222934 commit 3c814be

3 files changed

Lines changed: 40 additions & 24 deletions

File tree

‎drivers/dma/dw/core.c‎

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,22 +1493,33 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
14931493
dw->regs = chip->regs;
14941494
chip->dw = dw;
14951495

1496+
dw->clk = devm_clk_get(chip->dev, "hclk");
1497+
if (IS_ERR(dw->clk))
1498+
return PTR_ERR(dw->clk);
1499+
err = clk_prepare_enable(dw->clk);
1500+
if (err)
1501+
return err;
1502+
14961503
dw_params = dma_read_byaddr(chip->regs, DW_PARAMS);
14971504
autocfg = dw_params >> DW_PARAMS_EN & 0x1;
14981505

14991506
dev_dbg(chip->dev, "DW_PARAMS: 0x%08x\n", dw_params);
15001507

15011508
if (!pdata && autocfg) {
15021509
pdata = devm_kzalloc(chip->dev, sizeof(*pdata), GFP_KERNEL);
1503-
if (!pdata)
1504-
return -ENOMEM;
1510+
if (!pdata) {
1511+
err = -ENOMEM;
1512+
goto err_pdata;
1513+
}
15051514

15061515
/* Fill platform data with the default values */
15071516
pdata->is_private = true;
15081517
pdata->chan_allocation_order = CHAN_ALLOCATION_ASCENDING;
15091518
pdata->chan_priority = CHAN_PRIORITY_ASCENDING;
1510-
} else if (!pdata || pdata->nr_channels > DW_DMA_MAX_NR_CHANNELS)
1511-
return -EINVAL;
1519+
} else if (!pdata || pdata->nr_channels > DW_DMA_MAX_NR_CHANNELS) {
1520+
err = -EINVAL;
1521+
goto err_pdata;
1522+
}
15121523

15131524
if (autocfg)
15141525
nr_channels = (dw_params >> DW_PARAMS_NR_CHAN & 0x7) + 1;
@@ -1517,13 +1528,10 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
15171528

15181529
dw->chan = devm_kcalloc(chip->dev, nr_channels, sizeof(*dw->chan),
15191530
GFP_KERNEL);
1520-
if (!dw->chan)
1521-
return -ENOMEM;
1522-
1523-
dw->clk = devm_clk_get(chip->dev, "hclk");
1524-
if (IS_ERR(dw->clk))
1525-
return PTR_ERR(dw->clk);
1526-
clk_prepare_enable(dw->clk);
1531+
if (!dw->chan) {
1532+
err = -ENOMEM;
1533+
goto err_pdata;
1534+
}
15271535

15281536
/* Get hardware configuration parameters */
15291537
if (autocfg) {
@@ -1548,21 +1556,22 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
15481556
/* Disable BLOCK interrupts as well */
15491557
channel_clear_bit(dw, MASK.BLOCK, dw->all_chan_mask);
15501558

1551-
err = devm_request_irq(chip->dev, chip->irq, dw_dma_interrupt,
1552-
IRQF_SHARED, "dw_dmac", dw);
1553-
if (err)
1554-
return err;
1555-
15561559
/* Create a pool of consistent memory blocks for hardware descriptors */
15571560
dw->desc_pool = dmam_pool_create("dw_dmac_desc_pool", chip->dev,
15581561
sizeof(struct dw_desc), 4, 0);
15591562
if (!dw->desc_pool) {
15601563
dev_err(chip->dev, "No memory for descriptors dma pool\n");
1561-
return -ENOMEM;
1564+
err = -ENOMEM;
1565+
goto err_pdata;
15621566
}
15631567

15641568
tasklet_init(&dw->tasklet, dw_dma_tasklet, (unsigned long)dw);
15651569

1570+
err = request_irq(chip->irq, dw_dma_interrupt, IRQF_SHARED,
1571+
"dw_dmac", dw);
1572+
if (err)
1573+
goto err_pdata;
1574+
15661575
INIT_LIST_HEAD(&dw->dma.channels);
15671576
for (i = 0; i < nr_channels; i++) {
15681577
struct dw_dma_chan *dwc = &dw->chan[i];
@@ -1650,12 +1659,20 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
16501659

16511660
dma_writel(dw, CFG, DW_CFG_DMA_EN);
16521661

1662+
err = dma_async_device_register(&dw->dma);
1663+
if (err)
1664+
goto err_dma_register;
1665+
16531666
dev_info(chip->dev, "DesignWare DMA Controller, %d channels\n",
16541667
nr_channels);
16551668

1656-
dma_async_device_register(&dw->dma);
1657-
16581669
return 0;
1670+
1671+
err_dma_register:
1672+
free_irq(chip->irq, dw);
1673+
err_pdata:
1674+
clk_disable_unprepare(dw->clk);
1675+
return err;
16591676
}
16601677
EXPORT_SYMBOL_GPL(dw_dma_probe);
16611678

@@ -1667,6 +1684,7 @@ int dw_dma_remove(struct dw_dma_chip *chip)
16671684
dw_dma_off(dw);
16681685
dma_async_device_unregister(&dw->dma);
16691686

1687+
free_irq(chip->irq, dw);
16701688
tasklet_kill(&dw->tasklet);
16711689

16721690
list_for_each_entry_safe(dwc, _dwc, &dw->dma.channels,
@@ -1675,6 +1693,8 @@ int dw_dma_remove(struct dw_dma_chip *chip)
16751693
channel_clear_bit(dw, CH_EN, dwc->mask);
16761694
}
16771695

1696+
clk_disable_unprepare(dw->clk);
1697+
16781698
return 0;
16791699
}
16801700
EXPORT_SYMBOL_GPL(dw_dma_remove);

‎drivers/dma/sa11x0-dma.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,9 @@ struct sa11x0_dma_phy {
113113
struct sa11x0_dma_desc *txd_load;
114114
unsigned sg_done;
115115
struct sa11x0_dma_desc *txd_done;
116-
#ifdef CONFIG_PM_SLEEP
117116
u32 dbs[2];
118117
u32 dbt[2];
119118
u32 dcsr;
120-
#endif
121119
};
122120

123121
struct sa11x0_dma_dev {
@@ -984,7 +982,6 @@ static int sa11x0_dma_remove(struct platform_device *pdev)
984982
return 0;
985983
}
986984

987-
#ifdef CONFIG_PM_SLEEP
988985
static int sa11x0_dma_suspend(struct device *dev)
989986
{
990987
struct sa11x0_dma_dev *d = dev_get_drvdata(dev);
@@ -1054,7 +1051,6 @@ static int sa11x0_dma_resume(struct device *dev)
10541051

10551052
return 0;
10561053
}
1057-
#endif
10581054

10591055
static const struct dev_pm_ops sa11x0_dma_pm_ops = {
10601056
.suspend_noirq = sa11x0_dma_suspend,

‎include/linux/omap-dma.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
struct dma_chan;
1212

13-
#if defined(CONFIG_DMA_OMAP) || defined(CONFIG_DMA_OMAP_MODULE)
13+
#if defined(CONFIG_DMA_OMAP) || (defined(CONFIG_DMA_OMAP_MODULE) && defined(MODULE))
1414
bool omap_dma_filter_fn(struct dma_chan *, void *);
1515
#else
1616
static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)

0 commit comments

Comments
 (0)