Re: [PATCH v2 04/10] staging: media: zoran: add debugfs

From: Dan Carpenter
Date: Tue Nov 02 2021 - 13:41:25 EST


On Sun, Oct 17, 2021 at 10:05:06PM +0200, LABBE Corentin wrote:
> Le Thu, Oct 14, 2021 at 10:37:52AM +0300, Dan Carpenter a écrit :
> > On Wed, Oct 13, 2021 at 06:58:06PM +0000, Corentin Labbe wrote:
> > > +config VIDEO_ZORAN_DEBUG
> > > + bool "Enable zoran debugfs"
> > > + depends on VIDEO_ZORAN
> > > + depends on DEBUG_FS
> > > + help
> > > + Say y to enable zoran debug file.
> > > + This will create /sys/kernel/debug/CARD_NAME/debug for displaying
> > > + stats and debug information.
> >
> > Why bother with a CONFIG? Just make it always on?
> >
>
> Hello
>
> I love to provides choice to user (and so avoid a dep on DEBUG_FS), even if I think I am the only one remaining user.

Sorry, for the delay, I was on vacation.

No, there is no depends on DEBUG_FS in the method that I am describing.

How that works is when DEBUG_FS is turned on then it's on for everything,
but when it's disabled it's disabled for everything. You do not need
the "depends on DEBUG_FS" and if you make this an option the it feels
like it should be a selects DEBUG_FS instead.

How this normally works is that when you have debugfs disabled, there
are dummy files in the debugfs .h files. I bet the compiler can tell
most of those are empty and removes them. So if you have DEBUG_FS then
it doesn't use that much more memory than when VIDEO_ZORAN_DEBUG is
disabled.

I don't know if I'm being clear at all #jetlag.

It should be easy to check. Just remove the "depends on DEBUG_FS" and
enable VIDEO_ZORAN_DEBUG. Disable DEBUG_FS. It should still build fine
because of the dummy functions. That's build 1. Then disable
VIDEO_ZORAN_DEBUG and that's build 2. See how much memory difference
there is between 1 and 2.

regards,
dan carpenter