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

From: Peter Ujfalusi
Date: Mon Mar 02 2020 - 05:28:56 EST


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 */


- PÃter

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