[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdWL=Jy-PHMU3NTuc2YT=oK7gGGrrj008_k0ATivPsPc8w@mail.gmail.com>
Date: Mon, 24 May 2021 11:51:42 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] debugfs: remove return value of debugfs_create_bool()
Hi Greg,
On Mon, May 24, 2021 at 11:41 AM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
> On Mon, May 24, 2021 at 11:11:32AM +0200, Geert Uytterhoeven wrote:
> > On Fri, May 21, 2021 at 10:28 PM Greg Kroah-Hartman
> > <gregkh@...uxfoundation.org> wrote:
> > > No one checks the return value of debugfs_create_bool(), as it's not
> > > needed, so make the return value void, so that no one tries to do so in
> >
> > Please explain in the patch description why it is not needed.
>
> Because you just do not need it, like almost all other debugfs calls
> now.
Why do I just not need it?
> > > the future.
> > >
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> >
> > > --- a/fs/debugfs/file.c
> > > +++ b/fs/debugfs/file.c
> > > @@ -836,20 +836,11 @@ static const struct file_operations fops_bool_wo = {
> > > * This function creates a file in debugfs with the given name that
> > > * contains the value of the variable @value. If the @mode variable is so
> > > * set, it can be read from, and written to.
> > > - *
> > > - * This function will return a pointer to a dentry if it succeeds. This
> > > - * pointer must be passed to the debugfs_remove() function when the file is
> > > - * to be removed (no automatic cleanup happens if your module is unloaded,
> >
> > Why isn't the above no longer true?
>
> Because there is no return value.
Why is there no longer a return value?
Please stop giving circular answers as justifications.
> > Are we no longer allowed to remove individual debugfs entries?
>
> It's not something that is almost ever needed.
Why not?
> > Do we always have to remove the whole parent directory and all its
> > contents together?
>
> For 99% of all debugfs usages, yes, that is true.
So 1% of the users still need it...
> If you really do need the file dentry, there is still a call to create
> it, and you can always query debugfs for the dentry after it is created
... and will have to duplicate debugfs_create_bool() and friends, but
with a return value. This may introduce bugs, and will complicate
maintenance, as any change to debugfs_create_bool() means all those
copies need to be found and updated, too.
> if you need it later on.
Which involves looking up something again...
Seriously, what's the added value of removing the return value from
debugfs_create_bool() and friends?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists