[PATCH] mtd: Introduce an expert mode for forensics and debugging purposes
Geert Uytterhoeven
geert at linux-m68k.org
Thu Jan 27 03:57:06 PST 2022
Hi Miquel,
On Thu, Jan 27, 2022 at 12:18 PM Miquel Raynal
<miquel.raynal at bootlin.com> wrote:
> geert at linux-m68k.org wrote on Thu, 27 Jan 2022 12:07:31 +0100:
> > On Thu, Jan 27, 2022 at 11:46 AM Miquel Raynal
> > <miquel.raynal at bootlin.com> wrote:
> > > > What about letting drivers/mtd/mtdcore.c export a simple function
> > > > mtd_check_expert_analysis_mode() that calls the WARN_ONCE(...) if
> > > > CONFIG_DEBUG_FS=y, else providing a dummy?
> > > > The backtrace will identify the caller anyway.
> > >
> > > I took the time to address your comments. You're right a single exported
> > > function is better.
> > >
> > > However I don't see the need for a CONFIG_DEBUG_FS check here, if unset
> > > the boolean will stay false forever, I believe we don't need to bother
> > > with it.
> >
> > If CONFIG_DEBUG_FS=n, there is no need for the code or the export,
> > so the check can become a dummy.
>
> Agreed, but I truly don't like using #ifdefs when I can skip these, I
> think they darken the code and prevent good build coverage.
>
> Using if (IS_ENABLED()) is an option but would not bring the memory
> savings that we could expect with an #ifdef, so I don't see the point
> here.
>
> Should we use unlikely() to give branch predictors a clue about what is
> going to happen?
That will be thwarted by the out-of-line call to the exported symbol.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-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
More information about the linux-mtd
mailing list