Message ID | 20240830094118.15458-3-liaoyuanhong@vivo.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | dmaengine:Use devm_clk_get_enabled() helpers | expand |
On 30/08/2024 at 11:41, Liao Yuanhong wrote: > Use devm_clk_get_enabled() instead of clk functions in at_hdmac. I don't see how it could work: so please disregard at_hdmac when playing with "simplification". No subsequent version of this thing please. NACK (again). Best regards, Nicolas > Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com> > --- > v2:remove modifications related to the resume operation. > --- > drivers/dma/at_hdmac.c | 16 ++-------------- > 1 file changed, 2 insertions(+), 14 deletions(-) > > diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c > index 40052d1bd0b5..2274aeb58271 100644 > --- a/drivers/dma/at_hdmac.c > +++ b/drivers/dma/at_hdmac.c > @@ -1975,20 +1975,16 @@ static int __init at_dma_probe(struct platform_device *pdev) > atdma->dma_device.cap_mask = plat_dat->cap_mask; > atdma->all_chan_mask = (1 << plat_dat->nr_channels) - 1; > > - atdma->clk = devm_clk_get(&pdev->dev, "dma_clk"); > + atdma->clk = devm_clk_get_enabled(&pdev->dev, "dma_clk"); > if (IS_ERR(atdma->clk)) > return PTR_ERR(atdma->clk); > > - err = clk_prepare_enable(atdma->clk); > - if (err) > - return err; > - > /* force dma off, just in case */ > at_dma_off(atdma); > > err = request_irq(irq, at_dma_interrupt, 0, "at_hdmac", atdma); > if (err) > - goto err_irq; > + return err; > > platform_set_drvdata(pdev, atdma); > > @@ -2105,8 +2101,6 @@ static int __init at_dma_probe(struct platform_device *pdev) > dma_pool_destroy(atdma->lli_pool); > err_desc_pool_create: > free_irq(platform_get_irq(pdev, 0), atdma); > -err_irq: > - clk_disable_unprepare(atdma->clk); > return err; > } > > @@ -2130,16 +2124,11 @@ static void at_dma_remove(struct platform_device *pdev) > atc_disable_chan_irq(atdma, chan->chan_id); > list_del(&chan->device_node); > } > - > - clk_disable_unprepare(atdma->clk); > } > > static void at_dma_shutdown(struct platform_device *pdev) > { > - struct at_dma *atdma = platform_get_drvdata(pdev); > - > at_dma_off(platform_get_drvdata(pdev)); > - clk_disable_unprepare(atdma->clk); > } > > static int at_dma_prepare(struct device *dev) > @@ -2194,7 +2183,6 @@ static int at_dma_suspend_noirq(struct device *dev) > > /* disable DMA controller */ > at_dma_off(atdma); > - clk_disable_unprepare(atdma->clk); > return 0; > } > > -- > 2.25.1 > >
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 40052d1bd0b5..2274aeb58271 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1975,20 +1975,16 @@ static int __init at_dma_probe(struct platform_device *pdev) atdma->dma_device.cap_mask = plat_dat->cap_mask; atdma->all_chan_mask = (1 << plat_dat->nr_channels) - 1; - atdma->clk = devm_clk_get(&pdev->dev, "dma_clk"); + atdma->clk = devm_clk_get_enabled(&pdev->dev, "dma_clk"); if (IS_ERR(atdma->clk)) return PTR_ERR(atdma->clk); - err = clk_prepare_enable(atdma->clk); - if (err) - return err; - /* force dma off, just in case */ at_dma_off(atdma); err = request_irq(irq, at_dma_interrupt, 0, "at_hdmac", atdma); if (err) - goto err_irq; + return err; platform_set_drvdata(pdev, atdma); @@ -2105,8 +2101,6 @@ static int __init at_dma_probe(struct platform_device *pdev) dma_pool_destroy(atdma->lli_pool); err_desc_pool_create: free_irq(platform_get_irq(pdev, 0), atdma); -err_irq: - clk_disable_unprepare(atdma->clk); return err; } @@ -2130,16 +2124,11 @@ static void at_dma_remove(struct platform_device *pdev) atc_disable_chan_irq(atdma, chan->chan_id); list_del(&chan->device_node); } - - clk_disable_unprepare(atdma->clk); } static void at_dma_shutdown(struct platform_device *pdev) { - struct at_dma *atdma = platform_get_drvdata(pdev); - at_dma_off(platform_get_drvdata(pdev)); - clk_disable_unprepare(atdma->clk); } static int at_dma_prepare(struct device *dev) @@ -2194,7 +2183,6 @@ static int at_dma_suspend_noirq(struct device *dev) /* disable DMA controller */ at_dma_off(atdma); - clk_disable_unprepare(atdma->clk); return 0; }
Use devm_clk_get_enabled() instead of clk functions in at_hdmac. Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com> --- v2:remove modifications related to the resume operation. --- drivers/dma/at_hdmac.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-)