diff mbox

dmaengine: dw: Make error prints unique

Message ID 1425977210-19745-1-git-send-email-jarkko.nikula@linux.intel.com (mailing list archive)
State Superseded
Headers show

Commit Message

Jarkko Nikula March 10, 2015, 8:46 a.m. UTC
The same error message is printed from different functions and another from
different switch cases. Add a function name and DMA direction to these cases
in order to make it easier to grep sources from the error log.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/dma/dw/core.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Viresh Kumar March 10, 2015, 8:52 a.m. UTC | #1
On Tue, Mar 10, 2015 at 2:16 PM, Jarkko Nikula
<jarkko.nikula@linux.intel.com> wrote:
> The same error message is printed from different functions and another from
> different switch cases. Add a function name and DMA direction to these cases
> in order to make it easier to grep sources from the error log.

Make sure you run this before sending it again:

scripts/checkpatch.pl --strict

Good if you already have.

> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> ---
>  drivers/dma/dw/core.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
> index a8ad05291b27..ed765e819b0f 100644
> --- a/drivers/dma/dw/core.c
> +++ b/drivers/dma/dw/core.c
> @@ -230,7 +230,8 @@ static void dwc_dostart(struct dw_dma_chan *dwc, struct dw_desc *first)
>         /* ASSERT:  channel is idle */
>         if (dma_readl(dw, CH_EN) & dwc->mask) {
>                 dev_err(chan2dev(&dwc->chan),
> -                       "BUG: Attempted to start non-idle channel\n");
> +                       "BUG: Attempted to start non-idle channel in %s()\n",
> +                       __func__);

Instead: "%s: BUG: Attempted to start non-idle channel\n"

That's the more standard way of doing this..

>                 dwc_dump_chan_regs(dwc);
>
>                 /* The tasklet will hopefully advance the queue... */
> @@ -816,7 +817,8 @@ slave_sg_todev_fill_desc:
>                         desc = dwc_desc_get(dwc);
>                         if (!desc) {
>                                 dev_err(chan2dev(chan),
> -                                       "not enough descriptors available\n");
> +                                       "not enough descriptors available. Dir %d\n",
> +                                       direction);

This is different then the log you had, either update log or split the patch..

Its always better to use complete words in actual prints and so
s/Dir/Direction:

>                                 goto err_desc_get;
>                         }
>
> @@ -876,7 +878,8 @@ slave_sg_fromdev_fill_desc:
>                         desc = dwc_desc_get(dwc);
>                         if (!desc) {
>                                 dev_err(chan2dev(chan),
> -                                               "not enough descriptors available\n");
> +                                       "not enough descriptors available. Dir %d\n",
> +                                       direction);
>                                 goto err_desc_get;
>                         }
>
> @@ -1261,7 +1264,8 @@ int dw_dma_cyclic_start(struct dma_chan *chan)
>         /* Assert channel is idle */
>         if (dma_readl(dw, CH_EN) & dwc->mask) {
>                 dev_err(chan2dev(&dwc->chan),
> -                       "BUG: Attempted to start non-idle channel\n");
> +                       "BUG: Attempted to start non-idle channel in %s()\n",
> +                       __func__);
>                 dwc_dump_chan_regs(dwc);
>                 spin_unlock_irqrestore(&dwc->lock, flags);
>                 return -EBUSY;

Same for other two as well..
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index a8ad05291b27..ed765e819b0f 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -230,7 +230,8 @@  static void dwc_dostart(struct dw_dma_chan *dwc, struct dw_desc *first)
 	/* ASSERT:  channel is idle */
 	if (dma_readl(dw, CH_EN) & dwc->mask) {
 		dev_err(chan2dev(&dwc->chan),
-			"BUG: Attempted to start non-idle channel\n");
+			"BUG: Attempted to start non-idle channel in %s()\n",
+			__func__);
 		dwc_dump_chan_regs(dwc);
 
 		/* The tasklet will hopefully advance the queue... */
@@ -816,7 +817,8 @@  slave_sg_todev_fill_desc:
 			desc = dwc_desc_get(dwc);
 			if (!desc) {
 				dev_err(chan2dev(chan),
-					"not enough descriptors available\n");
+					"not enough descriptors available. Dir %d\n",
+					direction);
 				goto err_desc_get;
 			}
 
@@ -876,7 +878,8 @@  slave_sg_fromdev_fill_desc:
 			desc = dwc_desc_get(dwc);
 			if (!desc) {
 				dev_err(chan2dev(chan),
-						"not enough descriptors available\n");
+					"not enough descriptors available. Dir %d\n",
+					direction);
 				goto err_desc_get;
 			}
 
@@ -1261,7 +1264,8 @@  int dw_dma_cyclic_start(struct dma_chan *chan)
 	/* Assert channel is idle */
 	if (dma_readl(dw, CH_EN) & dwc->mask) {
 		dev_err(chan2dev(&dwc->chan),
-			"BUG: Attempted to start non-idle channel\n");
+			"BUG: Attempted to start non-idle channel in %s()\n",
+			__func__);
 		dwc_dump_chan_regs(dwc);
 		spin_unlock_irqrestore(&dwc->lock, flags);
 		return -EBUSY;