dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Vinod Koul <vkoul@kernel.org>
Cc: <dmaengine@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<dan.j.williams@intel.com>, <geert@linux-m68k.org>
Subject: Re: [PATCH v4 1/2] dmaengine: Add basic debugfs support
Date: Mon, 2 Mar 2020 13:53:52 +0200	[thread overview]
Message-ID: <be7d4df5-121b-0eec-b68c-fa3b5cffc8c9@ti.com> (raw)
In-Reply-To: <7b4f244d-0855-f979-414d-e2d3cb0f0c2f@ti.com>



On 02/03/2020 12.28, Peter Ujfalusi wrote:
> Hi Vinod,
> 
> On 02/03/2020 9.11, Vinod Koul wrote:
>>> diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h
>>> index e8a320c9e57c..72cd7fe33638 100644
>>> --- a/drivers/dma/dmaengine.h
>>> +++ b/drivers/dma/dmaengine.h
>>> @@ -182,4 +182,10 @@ dmaengine_desc_callback_valid(struct dmaengine_desc_callback *cb)
>>>  struct dma_chan *dma_get_slave_channel(struct dma_chan *chan);
>>>  struct dma_chan *dma_get_any_slave_channel(struct dma_device *device);
>>>  
>>> +#ifdef CONFIG_DEBUG_FS
>>> +#include <linux/debugfs.h>
>>> +
>>> +struct dentry *dmaengine_get_debugfs_root(void);
>>
>> this needs to have an else defined with NULL return so that we dont
>> force users to wrap the code under CONFIG_DEBUG_FS..
> 
> Drivers would anyways should have their debugfs related code wrapped
> within ifdef. There is no point of having the code complied when it can
> not be used (no debugfs support).
> 
> But I can add the  else case if we really want to:
> 
> #ifdef CONFIG_DEBUG_FS
> #include <linux/debugfs.h>
> 
> struct dentry *dmaengine_get_debugfs_root(void);
> 
> #else
> struct dentry;
> static inline struct dentry *dmaengine_get_debugfs_root(void)
> {
> 	return NULL;
> }
> #endif /* CONFIG_DEBUG_FS */

It might be even better if the core creates directories for the dma
controllers in dma_async_device_register() and removes the whole
directory in dma_async_device_unregister()

Then drivers can get their per device root via:
#ifdef CONFIG_DEBUG_FS
static inline struct dentry *
dmaengine_get_debugfs_root(struct dma_device *dma_dev) {
	return dma_dev->dbg_dev_root;
}
#else
struct dentry;
static inline struct dentry *
dmaengine_get_debugfs_root(struct dma_device *dma_dev)
{
	return NULL;
}
#endif /* CONFIG_DEBUG_FS */

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

  reply	other threads:[~2020-03-02 11:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28 13:07 [PATCH v4 0/2] dmaengine: Initial debugfs support Peter Ujfalusi
2020-02-28 13:07 ` [PATCH v4 1/2] dmaengine: Add basic " Peter Ujfalusi
2020-03-02  7:11   ` Vinod Koul
2020-03-02 10:28     ` Peter Ujfalusi
2020-03-02 11:53       ` Peter Ujfalusi [this message]
2020-03-03  4:27         ` Vinod Koul
2020-02-28 13:07 ` [PATCH v4 2/2] dmaengine: ti: k3-udma: Implement custom dbg_summary_show for debugfs Peter Ujfalusi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be7d4df5-121b-0eec-b68c-fa3b5cffc8c9@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).