Skip to contentSkip to conversation

dw_dmac: few cleanups to the driver

PATCH Superseded Andy Shevchenko 4 participants 17 messages Oct 17, 2012 – Oct 18, 2012 dmaengine

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover dw_dmac: few cleanups to the driver

There are few cleanups to the driver which partialy acked and reviewed.

Since v1:
- patch 1/4 ("use helper macro module_platform_driver()") is removed from the
series: it brings issues rather than cleans up
- patch 2/4 ("add module alias") is postponed

Andy Shevchenko (2):
dw_dmac: change {dev_}printk() to corresponding macros
dw_dmac: don't call platform_get_drvdata twice

Heikki Krogerus (2):
dmaengine: dw_dmac: remove CLK dependency
dmaengine: dw_dmac: amend description and indentation

 drivers/dma/Kconfig   |    1 -
 drivers/dma/dw_dmac.c |   25 +++++++++++--------------
 2 files changed, 11 insertions(+), 15 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v2 1/4 dmaengine: dw_dmac: remove CLK dependency

From: Heikki Krogerus <[email protected]>

This driver could be used on different platforms. Thus, the HAVE_CLK dependency is dropped away.

---
 drivers/dma/Kconfig |    1 -
 1 file changed, 1 deletion(-)
drivers/dma/Kconfig +0 -1
index 677cd6e..df32537 100644
@@ -83,7 +83,6 @@ config INTEL_IOP_ADMA
 
 config DW_DMAC
 	tristate "Synopsys DesignWare AHB DMA support"
-	depends on HAVE_CLK
 	select DMA_ENGINE
 	default y if CPU_AT32AP7000
 	help
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH v2 2/4 dmaengine: dw_dmac: amend description and indentation

In reply to Andy Shevchenko

From: Heikki Krogerus <[email protected]>

The driver will be used as a core part for various implementations of the DesignWare DMA device. The patch adjusts description on the top and corrects paragraph indentation in few places across the code.

---
 drivers/dma/dw_dmac.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/dma/dw_dmac.c +3 -3
index c4b0eb3..c27c125 100644
@@ -1,6 +1,5 @@
 /*
- * Driver for the Synopsys DesignWare DMA Controller (aka DMACA on
- * AVR32 systems.)
+ * Core driver for the Synopsys DesignWare DMA Controller
  *
  * Copyright (C) 2007-2008 Atmel Corporation
  * Copyright (C) 2010-2011 ST Microelectronics
@@ -9,6 +8,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+
 #include <linux/bitops.h>
 #include <linux/clk.h>
 #include <linux/delay.h>
@@ -222,7 +222,6 @@ static inline void dwc_dump_chan_regs(struct dw_dma_chan *dwc)
 		channel_readl(dwc, CTL_LO));
 }
 
-
 static inline void dwc_chan_disable(struct dw_dma *dw, struct dw_dma_chan *dwc)
 {
 	channel_clear_bit(dw, CH_EN, dwc->mask);
@@ -1679,6 +1678,7 @@ static int dw_resume_noirq(struct device *dev)
 
 	clk_prepare_enable(dw->clk);
 	dma_writel(dw, CFG, DW_CFG_DMA_EN);
+
 	return 0;
 }
 
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH v2 3/4 dw_dmac: change {dev_}printk() to corresponding macros

In reply to Andy Shevchenko
---
 drivers/dma/dw_dmac.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/dma/dw_dmac.c +6 -9
index c27c125..60b172a 100644
@@ -456,9 +456,8 @@ static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
 
 static inline void dwc_dump_lli(struct dw_dma_chan *dwc, struct dw_lli *lli)
 {
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"  desc: s0x%x d0x%x l0x%x c0x%x:%x\n",
-			lli->sar, lli->dar, lli->llp, lli->ctlhi, lli->ctllo);
+	dev_crit(chan2dev(&dwc->chan), "  desc: s0x%x d0x%x l0x%x c0x%x:%x\n",
+		 lli->sar, lli->dar, lli->llp, lli->ctlhi, lli->ctllo);
 }
 
 static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
@@ -492,10 +491,8 @@ static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
 	 * controller flagged an error instead of scribbling over
 	 * random memory locations.
 	 */
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"Bad descriptor submitted for DMA!\n");
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"  cookie: %d\n", bad_desc->txd.cookie);
+	dev_crit(chan2dev(&dwc->chan), "Bad descriptor submitted for DMA!\n");
+	dev_crit(chan2dev(&dwc->chan), "  cookie: %d\n", bad_desc->txd.cookie);
 	dwc_dump_lli(dwc, &bad_desc->lli);
 	list_for_each_entry(child, &bad_desc->tx_list, desc_node)
 		dwc_dump_lli(dwc, &child->lli);
@@ -1625,8 +1622,8 @@ static int __devinit dw_probe(struct platform_device *pdev)
 
 	dma_writel(dw, CFG, DW_CFG_DMA_EN);
 
-	printk(KERN_INFO "%s: DesignWare DMA Controller, %d channels\n",
-			dev_name(&pdev->dev), nr_channels);
+	pr_info("%s: DesignWare DMA Controller, %d channels\n",
+		dev_name(&pdev->dev), nr_channels);
 
 	dma_async_device_register(&dw->dma);
 
Signature · 1 line
1.7.10.4
#5 lore raw

Re: [PATCHv2 3/4] dw_dmac: change {dev_}printk() to corresponding macros

In reply to Andy Shevchenko

Hi,

Quoted 10 lines · Andy Shevchenko
---
 drivers/dma/dw_dmac.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/dma/dw_dmac.c +0 -0
index c27c125..60b172a 100644

drivers/dma/dw_dmac.c static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc) · line 460

Quoted 8 lines
drivers/dma/dw_dmac.c +2 -3
@@ -456,9 +456,8 @@ static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
 
 static inline void dwc_dump_lli(struct dw_dma_chan *dwc, struct dw_lli *lli)
 {
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"  desc: s0x%x d0x%x l0x%x c0x%x:%x\n",
-			lli->sar, lli->dar, lli->llp, lli->ctlhi, lli->ctllo);
+	dev_crit(chan2dev(&dwc->chan), "  desc: s0x%x d0x%x l0x%x c0x%x:%x\n",
+		 lli->sar, lli->dar, lli->llp, lli->ctlhi, lli->ctllo);

is this really critical ? To me it looks more like a debugging message.

drivers/dma/dw_dmac.c static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc) · line 495

Quoted 13 lines
drivers/dma/dw_dmac.c +2 -4
 }
 
 static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
@@ -492,10 +491,8 @@ static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
 	 * controller flagged an error instead of scribbling over
 	 * random memory locations.
 	 */
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"Bad descriptor submitted for DMA!\n");
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"  cookie: %d\n", bad_desc->txd.cookie);
+	dev_crit(chan2dev(&dwc->chan), "Bad descriptor submitted for DMA!\n");
+	dev_crit(chan2dev(&dwc->chan), "  cookie: %d\n", bad_desc->txd.cookie);

now this is critical, indeed. I would suggest using dev_WARN_ONCE() so that it's noisy enough to catch the failing user.

drivers/dma/dw_dmac.c static int __devinit dw_probe(struct platform_device *pdev) · line 1626

Quoted 11 lines
drivers/dma/dw_dmac.c +2 -2
 	dwc_dump_lli(dwc, &bad_desc->lli);
 	list_for_each_entry(child, &bad_desc->tx_list, desc_node)
 		dwc_dump_lli(dwc, &child->lli);
@@ -1625,8 +1622,8 @@ static int __devinit dw_probe(struct platform_device *pdev)
 
 	dma_writel(dw, CFG, DW_CFG_DMA_EN);
 
-	printk(KERN_INFO "%s: DesignWare DMA Controller, %d channels\n",
-			dev_name(&pdev->dev), nr_channels);
+	pr_info("%s: DesignWare DMA Controller, %d channels\n",
+		dev_name(&pdev->dev), nr_channels);

you have a struct device available in platform_device, please use dev_info() or dev_dbg().

Quoted 5 lines
drivers/dma/dw_dmac.c +0 -0
 	dma_async_device_register(&dw->dma);
 
Signature · 1 line
1.7.10.4
Signature · 1 line
balbi
#6 lore raw

Re: [PATCHv2 3/4] dw_dmac: change {dev_}printk() to corresponding macros

Quoted 14 lines · Felipe Balbi

Hi,

Quoted 11 lines · Andy Shevchenko
---
 drivers/dma/dw_dmac.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/dma/dw_dmac.c +0 -0
index c27c125..60b172a 100644
@@ -456,9 +456,8 @@ static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
 
Quoted 9 lines

drivers/dma/dw_dmac.c static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc) · line 460

Quoted 7 lines
drivers/dma/dw_dmac.c +2 -3
 static inline void dwc_dump_lli(struct dw_dma_chan *dwc, struct dw_lli *lli)
 {
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"  desc: s0x%x d0x%x l0x%x c0x%x:%x\n",
-			lli->sar, lli->dar, lli->llp, lli->ctlhi, lli->ctllo);
+	dev_crit(chan2dev(&dwc->chan), "  desc: s0x%x d0x%x l0x%x c0x%x:%x\n",
+		 lli->sar, lli->dar, lli->llp, lli->ctlhi, lli->ctllo);

is this really critical ? To me it looks more like a debugging message.

This one is used in two cases, where one is marked as "error", another - "critical"

Quoted 17 lines
Quoted 5 lines
drivers/dma/dw_dmac.c +0 -0
 }
 
 static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)

drivers/dma/dw_dmac.c static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc) · line 495

Quoted 9 lines
drivers/dma/dw_dmac.c +2 -4
@@ -492,10 +491,8 @@ static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
 	 * controller flagged an error instead of scribbling over
 	 * random memory locations.
 	 */
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"Bad descriptor submitted for DMA!\n");
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"  cookie: %d\n", bad_desc->txd.cookie);
+	dev_crit(chan2dev(&dwc->chan), "Bad descriptor submitted for DMA!\n");
+	dev_crit(chan2dev(&dwc->chan), "  cookie: %d\n", bad_desc->txd.cookie);

now this is critical, indeed. I would suggest using dev_WARN_ONCE() so that it's noisy enough to catch the failing user.

To this and upper comment, there is an explanation why it's critical. I guess the WARN_ONCE is not good enough, for example if we have more than one user making such noise.

Quoted 8 lines
Quoted 8 lines
drivers/dma/dw_dmac.c +0 -0
 	dwc_dump_lli(dwc, &bad_desc->lli);
 	list_for_each_entry(child, &bad_desc->tx_list, desc_node)
 		dwc_dump_lli(dwc, &child->lli);
@@ -1625,8 +1622,8 @@ static int __devinit dw_probe(struct platform_device *pdev)
 
 	dma_writel(dw, CFG, DW_CFG_DMA_EN);
 
Quoted 7 lines

drivers/dma/dw_dmac.c static int __devinit dw_probe(struct platform_device *pdev) · line 1626

Quoted 4 lines
drivers/dma/dw_dmac.c +2 -2
-	printk(KERN_INFO "%s: DesignWare DMA Controller, %d channels\n",
-			dev_name(&pdev->dev), nr_channels);
+	pr_info("%s: DesignWare DMA Controller, %d channels\n",
+		dev_name(&pdev->dev), nr_channels);

you have a struct device available in platform_device, please use dev_info() or dev_dbg().

Agreed.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#7 lore raw

Re: [PATCHv2 3/4] dw_dmac: change {dev_}printk() to corresponding macros

Quoted 24 lines · Andy Shevchenko
Quoted 14 lines · Felipe Balbi

Hi,

Quoted 11 lines · Andy Shevchenko
---
 drivers/dma/dw_dmac.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/dma/dw_dmac.c +0 -0
index c27c125..60b172a 100644
@@ -456,9 +456,8 @@ static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
 
Quoted 9 lines

drivers/dma/dw_dmac.c static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc) · line 460

Quoted 7 lines
drivers/dma/dw_dmac.c +2 -3
 static inline void dwc_dump_lli(struct dw_dma_chan *dwc, struct dw_lli *lli)
 {
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"  desc: s0x%x d0x%x l0x%x c0x%x:%x\n",
-			lli->sar, lli->dar, lli->llp, lli->ctlhi, lli->ctllo);
+	dev_crit(chan2dev(&dwc->chan), "  desc: s0x%x d0x%x l0x%x c0x%x:%x\n",
+		 lli->sar, lli->dar, lli->llp, lli->ctlhi, lli->ctllo);

is this really critical ? To me it looks more like a debugging message.

Quoted 2 lines

This one is used in two cases, where one is marked as "error", another - "critical"

fair enough

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
drivers/dma/dw_dmac.c +0 -1
 static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
@@ -492,10 +491,8 @@ static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
 	 * controller flagged an error instead of scribbling over
 	 * random memory locations.
 	 */
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
Quoted 8 lines

drivers/dma/dw_dmac.c static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc) · line 495

Quoted 5 lines
drivers/dma/dw_dmac.c +2 -3
-			"Bad descriptor submitted for DMA!\n");
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"  cookie: %d\n", bad_desc->txd.cookie);
+	dev_crit(chan2dev(&dwc->chan), "Bad descriptor submitted for DMA!\n");
+	dev_crit(chan2dev(&dwc->chan), "  cookie: %d\n", bad_desc->txd.cookie);

now this is critical, indeed. I would suggest using dev_WARN_ONCE() so that it's noisy enough to catch the failing user.

Quoted 3 lines

To this and upper comment, there is an explanation why it's critical. I guess the WARN_ONCE is not good enough, for example if we have more than one user making such noise.

then use dev_WARN()

Signature · 1 line
balbi
#8 lore raw

Re: [PATCHv2 3/4] dw_dmac: change {dev_}printk() to corresponding macros

Quoted 19 lines · Felipe Balbi
Quoted 18 lines · Andy Shevchenko
Quoted 17 lines · Felipe Balbi

Hi,

drivers/dma/dw_dmac.c static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc) · line 495

Quoted 12 lines
drivers/dma/dw_dmac.c +2 -4
@@ -492,10 +491,8 @@ static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
 	 * controller flagged an error instead of scribbling over
 	 * random memory locations.
 	 */
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"Bad descriptor submitted for DMA!\n");
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"  cookie: %d\n", bad_desc->txd.cookie);
+	dev_crit(chan2dev(&dwc->chan), "Bad descriptor submitted for DMA!\n");
+	dev_crit(chan2dev(&dwc->chan), "  cookie: %d\n", bad_desc->txd.cookie);

now this is critical, indeed. I would suggest using dev_WARN_ONCE() so that it's noisy enough to catch the failing user.

Quoted 5 lines
Quoted 3 lines

To this and upper comment, there is an explanation why it's critical. I guess the WARN_ONCE is not good enough, for example if we have more than one user making such noise.

then use dev_WARN()

I can't see how dev_WARN could be more useful here than the dev_crit. In current message we have channel and cookie to link back to the user. What does WARN add meaningful?

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#9 lore raw

Re: [PATCHv2 3/4] dw_dmac: change {dev_}printk() to corresponding macros

Quoted 20 lines · Andy Shevchenko
Quoted 19 lines · Felipe Balbi
Quoted 18 lines · Andy Shevchenko
Quoted 17 lines · Felipe Balbi

Hi,

drivers/dma/dw_dmac.c static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc) · line 495

Quoted 12 lines
drivers/dma/dw_dmac.c +2 -4
@@ -492,10 +491,8 @@ static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
 	 * controller flagged an error instead of scribbling over
 	 * random memory locations.
 	 */
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"Bad descriptor submitted for DMA!\n");
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"  cookie: %d\n", bad_desc->txd.cookie);
+	dev_crit(chan2dev(&dwc->chan), "Bad descriptor submitted for DMA!\n");
+	dev_crit(chan2dev(&dwc->chan), "  cookie: %d\n", bad_desc->txd.cookie);

now this is critical, indeed. I would suggest using dev_WARN_ONCE() so that it's noisy enough to catch the failing user.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

To this and upper comment, there is an explanation why it's critical. I guess the WARN_ONCE is not good enough, for example if we have more than one user making such noise.

then use dev_WARN()

I can't see how dev_WARN could be more useful here than the dev_crit. In current message we have channel and cookie to link back to the user. What does WARN add meaningful?

a dump_stack()

Signature · 1 line
balbi
#10 lore raw

Re: [PATCHv2 3/4] dw_dmac: change {dev_}printk() to corresponding macros

Quoted 24 lines · Felipe Balbi
Quoted 23 lines · Andy Shevchenko
Quoted 22 lines · Felipe Balbi
Quoted 20 lines · Andy Shevchenko
Quoted 15 lines · Felipe Balbi

drivers/dma/dw_dmac.c static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc) · line 495

Quoted 12 lines
drivers/dma/dw_dmac.c +2 -4
@@ -492,10 +491,8 @@ static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
 	 * controller flagged an error instead of scribbling over
 	 * random memory locations.
 	 */
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"Bad descriptor submitted for DMA!\n");
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"  cookie: %d\n", bad_desc->txd.cookie);
+	dev_crit(chan2dev(&dwc->chan), "Bad descriptor submitted for DMA!\n");
+	dev_crit(chan2dev(&dwc->chan), "  cookie: %d\n", bad_desc->txd.cookie);

now this is critical, indeed. I would suggest using dev_WARN_ONCE() so that it's noisy enough to catch the failing user.

To this and upper comment, there is an explanation why it's critical. I guess the WARN_ONCE is not good enough, for example if we have more than one user making such noise.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

then use dev_WARN()

I can't see how dev_WARN could be more useful here than the dev_crit. In current message we have channel and cookie to link back to the user. What does WARN add meaningful?

a dump_stack()

How could it be useful? The dwc_handle_error is called from a tasklet that is called from scheduler asynchronously. The tasklet is queued in interrupt handler.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#11 lore raw

Re: [PATCHv2 3/4] dw_dmac: change {dev_}printk() to corresponding macros

Hi,

Quoted 30 lines · Andy Shevchenko
Quoted 29 lines · Felipe Balbi
Quoted 27 lines · Andy Shevchenko
Quoted 18 lines · Felipe Balbi
Quoted 17 lines · Andy Shevchenko
Quoted 15 lines · Felipe Balbi

drivers/dma/dw_dmac.c static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc) · line 495

Quoted 12 lines
drivers/dma/dw_dmac.c +2 -4
@@ -492,10 +491,8 @@ static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
 	 * controller flagged an error instead of scribbling over
 	 * random memory locations.
 	 */
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"Bad descriptor submitted for DMA!\n");
-	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"  cookie: %d\n", bad_desc->txd.cookie);
+	dev_crit(chan2dev(&dwc->chan), "Bad descriptor submitted for DMA!\n");
+	dev_crit(chan2dev(&dwc->chan), "  cookie: %d\n", bad_desc->txd.cookie);

now this is critical, indeed. I would suggest using dev_WARN_ONCE() so that it's noisy enough to catch the failing user.

Quoted 5 lines
Quoted 3 lines

To this and upper comment, there is an explanation why it's critical. I guess the WARN_ONCE is not good enough, for example if we have more than one user making such noise.

then use dev_WARN()

I can't see how dev_WARN could be more useful here than the dev_crit. In current message we have channel and cookie to link back to the user. What does WARN add meaningful?

Quoted 5 lines
Quoted 1 line

a dump_stack()

How could it be useful? The dwc_handle_error is called from a tasklet that is called from scheduler asynchronously. The tasklet is queued in interrupt handler.

even if it's not useful, it's a lot more verbose and more likely to get user's attention. If someone's passing broken DMA descriptor, it should be a really big fat warning so we can get user reports early enoough.

Anyway, it's your call, I don't mind really.

Signature · 1 line
balbi
#12 lore raw

Re: [PATCHv2 3/4] dw_dmac: change {dev_}printk() to corresponding macros

Quoted 33 lines · Felipe Balbi
Quoted 32 lines · Andy Shevchenko
Quoted 30 lines · Felipe Balbi
Quoted 19 lines · Andy Shevchenko
Quoted 18 lines · Felipe Balbi
Quoted 17 lines · Andy Shevchenko
Quoted 15 lines · Felipe Balbi

drivers/dma/dw_dmac.c static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc) · line 495

Quoted 12 lines
drivers/dma/dw_dmac.c +2 -4
@@ -492,10 +491,8 @@ static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
   * controller flagged an error instead of scribbling over
   * random memory locations.
   */
- dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-                 "Bad descriptor submitted for DMA!\n");
- dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-                 "  cookie: %d\n", bad_desc->txd.cookie);
+ dev_crit(chan2dev(&dwc->chan), "Bad descriptor submitted for DMA!\n");
+ dev_crit(chan2dev(&dwc->chan), "  cookie: %d\n", bad_desc->txd.cookie);

now this is critical, indeed. I would suggest using dev_WARN_ONCE() so that it's noisy enough to catch the failing user.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

To this and upper comment, there is an explanation why it's critical. I guess the WARN_ONCE is not good enough, for example if we have more than one user making such noise.

then use dev_WARN()

I can't see how dev_WARN could be more useful here than the dev_crit. In current message we have channel and cookie to link back to the user. What does WARN add meaningful?

a dump_stack()

Quoted 7 lines
Quoted 3 lines

How could it be useful? The dwc_handle_error is called from a tasklet that is called from scheduler asynchronously. The tasklet is queued in interrupt handler.

even if it's not useful, it's a lot more verbose and more likely to get user's attention. If someone's passing broken DMA descriptor, it should be a really big fat warning so we can get user reports early enoough.

I will do separate patch for this. If Viresh and/or Vinoud is okay with it, user will see fat message.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#13 lore raw

PATCH v2 4/4 dw_dmac: don't call platform_get_drvdata twice

In reply to Andy Shevchenko
---
 drivers/dma/dw_dmac.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/dw_dmac.c +2 -2
index 60b172a..7d2b438 100644
@@ -1653,7 +1653,7 @@ static void dw_shutdown(struct platform_device *pdev)
 {
 	struct dw_dma	*dw = platform_get_drvdata(pdev);
 
-	dw_dma_off(platform_get_drvdata(pdev));
+	dw_dma_off(dw);
 	clk_disable_unprepare(dw->clk);
 }
 
@@ -1662,7 +1662,7 @@ static int dw_suspend_noirq(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct dw_dma	*dw = platform_get_drvdata(pdev);
 
-	dw_dma_off(platform_get_drvdata(pdev));
+	dw_dma_off(dw);
 	clk_disable_unprepare(dw->clk);
 
 	return 0;
Signature · 1 line
1.7.10.4
Reviewed-by on v2 4/4
#15 lore raw

Re: [PATCHv2 4/4] dw_dmac: don't call platform_get_drvdata twice

In reply to Andy Shevchenko

On Wed, Oct 17, 2012 at 01:31:18PM +0300, Andy Shevchenko wrote:

I would suggest adding a commit log, but if maintainer is fine without, I'm fine too :-p

Quoted 1 line

looks good:

Quoted 29 lines
---
 drivers/dma/dw_dmac.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/dw_dmac.c +2 -2
index 60b172a..7d2b438 100644
@@ -1653,7 +1653,7 @@ static void dw_shutdown(struct platform_device *pdev)
 {
 	struct dw_dma	*dw = platform_get_drvdata(pdev);
 
-	dw_dma_off(platform_get_drvdata(pdev));
+	dw_dma_off(dw);
 	clk_disable_unprepare(dw->clk);
 }
 
@@ -1662,7 +1662,7 @@ static int dw_suspend_noirq(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct dw_dma	*dw = platform_get_drvdata(pdev);
 
-	dw_dma_off(platform_get_drvdata(pdev));
+	dw_dma_off(dw);
 	clk_disable_unprepare(dw->clk);
 
 	return 0;
Signature · 1 line
1.7.10.4
Signature · 1 line
balbi
#16 lore raw

Re: [PATCHv2 4/4] dw_dmac: don't call platform_get_drvdata twice

Quoted 4 lines · Felipe Balbi

On Wed, Oct 17, 2012 at 01:31:18PM +0300, Andy Shevchenko wrote:

I would suggest adding a commit log, but if maintainer is fine without, I'm fine too :-p

Should be there. But i am bored of giving this review comment now :)

--
viresh