Re: [PATCH v4 1/2] dmaengine: Add basic debugfs support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux