[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yn1SrtRHIjapcIjp@ravnborg.org>
Date: Thu, 12 May 2022 20:32:14 +0200
From: Sam Ravnborg <sam@...nborg.org>
To: Javier Martinez Canillas <javierm@...hat.com>
Cc: Guenter Roeck <linux@...ck-us.net>, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org, linux-fbdev@...r.kernel.org,
Daniel Vetter <daniel.vetter@...ll.ch>,
Helge Deller <deller@....de>,
Thomas Zimmermann <tzimmermann@...e.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
kernel test robot <lkp@...el.com>,
Jens Frederich <jfrederich@...il.com>,
Jon Nettleton <jon.nettleton@...il.com>,
linux-staging@...ts.linux.dev,
Daniel Vetter <daniel.vetter@...el.com>,
Daniel Vetter <daniel@...ll.ch>,
Matthew Wilcox <willy@...radead.org>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
Zhen Lei <thunder.leizhen@...wei.com>,
Alex Deucher <alexander.deucher@....com>,
Xiyu Yang <xiyuyang19@...an.edu.cn>,
Zheyu Ma <zheyuma97@...il.com>
Subject: Re: [PATCH v5 7/7] fbdev: Make registered_fb[] private to fbmem.c
On Wed, May 11, 2022 at 07:34:38PM +0200, Javier Martinez Canillas wrote:
> Hello Guenter,
>
> On 5/11/22 19:17, Guenter Roeck wrote:
> > On 5/11/22 10:00, Sam Ravnborg wrote:
>
> [snip]
>
> >>> struct fb_info *registered_fb[FB_MAX] __read_mostly;
> >>> -EXPORT_SYMBOL(registered_fb);
> >>> -
> >>> int num_registered_fb __read_mostly;
> >>> +#if IS_ENABLED(CONFIG_FB_OLPC_DCON)
> >>> +EXPORT_SYMBOL(registered_fb);
> >>> EXPORT_SYMBOL(num_registered_fb);
> >>> +#endif
> >>
> >> It is stuff like this I refer to as "ugly" in the comment above.
> >>
> >
> > My "solution" for that kind of thing is to use a namespace,
> > such as
> >
> > EXPORT_SYMBOL_NS(registered_fb, FB_OLPC_DCON);
> > EXPORT_SYMBOL_NS(num_registered_fb, FB_OLPC_DCON);
> >
>
> Using a namespace in this case is indeed a great idea I think.
>
> I've used in the past to limit the export of a symbol for within a driver
> that could be scattered across different compilations units, but it never
> occurred to me using it to limit symbols exported by core code.
>
> > and import it from the offending code. That avoids ifdefs
> > while at the same time limiting the use of the symbols
> > to the expected scope. Of course that could be abused but
> > that abuse would be obvious.
> >
>
> Agreed. For the next revision, besides using an namespaced export symbol
> as you suggested, I'll include a comment to make clear that it shouldn't
> by any other driver and FB_OLPC_DCON fixed instead.
A very nice compromise, thanks Guenter and Javier.
Sam
Powered by blists - more mailing lists