lkml.org 
[lkml]   [2020]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 1/2] dmaengine: Add basic debugfs support
On 02-03-20, 13:53, Peter Ujfalusi wrote:
>
>
> 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()

hmmm, i think makes sense and dentry can be part of dma_device

>
> 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;
> }

right!

> #else
> struct dentry;
> static inline struct dentry *
> dmaengine_get_debugfs_root(struct dma_device *dma_dev)
> {
> return NULL;
> }
> #endif /* CONFIG_DEBUG_FS */

--
~Vinod

\
 
 \ /
  Last update: 2020-03-03 05:28    [W:0.050 / U:7.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site