Re: [PATCH v3 3/9] fsldma: use channel name in printk output

From: Dan Williams
Date: Mon Mar 21 2011 - 20:50:07 EST


On Thu, Mar 3, 2011 at 9:54 AM, Ira W. Snyder <iws@xxxxxxxxxxxxxxxx> wrote:
> This makes debugging the driver much easier when multiple channels are
> running concurrently. In addition, you can see how much descriptor
> memory each channel has allocated via the dmapool API in sysfs.
>
> Signed-off-by: Ira W. Snyder <iws@xxxxxxxxxxxxxxxx>
> ---
>  drivers/dma/fsldma.c |   69 +++++++++++++++++++++++++------------------------
>  drivers/dma/fsldma.h |    1 +
>  2 files changed, 36 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
> index 2e1af45..e535cd1 100644
> --- a/drivers/dma/fsldma.c
> +++ b/drivers/dma/fsldma.c
> @@ -37,7 +37,12 @@
>
>  #include "fsldma.h"
>
> -static const char msg_ld_oom[] = "No free memory for link descriptor\n";
> +#define chan_dbg(chan, fmt, arg...)                                    \
> +       dev_dbg(chan->dev, "%s: " fmt, chan->name, ##arg)
> +#define chan_err(chan, fmt, arg...)                                    \
> +       dev_err(chan->dev, "%s: " fmt, chan->name, ##arg)
> +

I already have this applied, but if you want to send an incremental
cleanup patch you could achieve a similar effect without increasing
the size of fsldma_chan by using the class device that is created by
dma_async_device_register.

Something like:

#define to_chan_dev(chan) (&chan->common.dev->device)
#define chan_err(chan, fmt, arg...) \
dev_err(chan->dev, "%s: " fmt, dev_name(to_chan_dev(chan)), ##arg)

...where dev_name() returns something like "dma0chan0".

--
Dan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/