Re: [PATCH] module: Allow DEFAULT_SYMBOL_NAMESPACE be set after export.h included

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 30 Dec 2024 13:54:45 +0100
Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx> wrote:

> Hello David,
> 
> On Mon, Dec 30, 2024 at 12:03:03PM +0000, David Laight wrote:
> > On Mon, 30 Dec 2024 10:42:55 +0100
> > Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx> wrote:
> >   
> > > On Sun, Dec 29, 2024 at 12:59:36AM +0000, David Laight wrote:  
> > > > On Sat, 28 Dec 2024 15:29:24 -0800
> > > > Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> > > >     
> > > > > On Sat, 28 Dec 2024 at 10:43, David Laight <david.laight.linux@xxxxxxxxx> wrote:    
> > > > > >
> > > > > > Instead just default DEFAULT_SYMBOL_NAMESPACE to "" and remove the
> > > > > > extra _EXPORT_SYMBOL() wrapper.
> > > > > >
> > > > > > This lets DEFAULT_SYMBOL_NAMESPACE be defined after export.h is included.      
> > > > > 
> > > > > Grr. This is horribly ugly.    
> > > > 
> > > > I thought it was a neater 'ugly' than the current definitions in export.h
> > > >     
> > > > > I think the i2c code should just be fixed to use the proper "define
> > > > > namespace early".    
> > > > 
> > > > The i2c changes were needed because I found the code wouldn't compile.
> > > > It is pretty easy mistake to make and will happen again.    
> > > 
> > > There is
> > > https://lore.kernel.org/linux-i2c/20241203173640.1648939-2-u.kleine-koenig@xxxxxxxxxxxx
> > > that moves the DEFAULT_SYMBOL_NAMESPACE above the #include block for the
> > > i2c driver. Though it seems I missed ...master.c. (I'll address that.)
> > >   
> > > > and does - I missed drivers/pwm/pwm-lpss.c drivers/hwmon/nct6775-core.c
> > > > and drivers/pwm/pwm-lpss.c    
> > > 
> > > drivers/pwm/pwm-lpss.c is addressed by
> > > https://lore.kernel.org/linux-pwm/cover.1733245406.git.ukleinek@xxxxxxxxxx
> > > 
> > > the hwmon driver is addressed by
> > > https://lore.kernel.org/linux-hwmon/20241203173149.1648456-2-u.kleine-koenig@xxxxxxxxxxxx
> > > (and applied in next)
> > > 
> > > There is also drivers/gpio/gpio-idio-16.c (which I guess you intended to
> > > list instead of the pwm driver twice), which I sent a patch for at
> > > https://lore.kernel.org/linux-gpio/20241203172631.1647792-2-u.kleine-koenig@xxxxxxxxxxxx
> > > (also already applied in next).  
> > 
> > 
> > With all those applied it is probably worth applying my change to export.h
> > (which is all I really wanted to do - until the build failures.)
> > 
> > diff --git a/include/linux/export.h b/include/linux/export.h
> > index 2633df4d31e6..6cea1c3982cd 100644
> > --- a/include/linux/export.h
> > +++ b/include/linux/export.h
> > @@ -59,14 +59,12 @@
> > 
> >  #endif
> > 
> > -#ifdef DEFAULT_SYMBOL_NAMESPACE
> > -#define _EXPORT_SYMBOL(sym, license)   __EXPORT_SYMBOL(sym, license, DEFAULT_SYMBOL_NAMESPACE)  
> 
> If you keep the above definition (without the #ifdef), you don't need to
> touch the definitions of EXPORT_SYMBOL and EXPORT_SYMBOL_GPL below.
> Probably a matter of taste.

The extra wrapper just makes it harder to read (and will be immeasurably slower to
compile).

> > -#else
> > -#define _EXPORT_SYMBOL(sym, license)   __EXPORT_SYMBOL(sym, license, "")
> > +#ifndef DEFAULT_SYMBOL_NAMESPACE
> > +#define DEFAULT_SYMBOL_NAMESPACE ""
> >  #endif
> > 
> > -#define EXPORT_SYMBOL(sym)             _EXPORT_SYMBOL(sym, "")
> > -#define EXPORT_SYMBOL_GPL(sym)         _EXPORT_SYMBOL(sym, "GPL")
> > +#define EXPORT_SYMBOL(sym)             __EXPORT_SYMBOL(sym, "", DEFAULT_SYMBOL_NAMESPACE)
> > +#define EXPORT_SYMBOL_GPL(sym)         __EXPORT_SYMBOL(sym, "GPL", DEFAULT_SYMBOL_NAMESPACE)
> >  #define EXPORT_SYMBOL_NS(sym, ns)      __EXPORT_SYMBOL(sym, "", ns)
> >  #define EXPORT_SYMBOL_NS_GPL(sym, ns)  __EXPORT_SYMBOL(sym, "GPL", ns)
> > 
> > It would be 'nice' to get that into 6.13 (along with the other changes that
> > remove __stringify()) - but it is getting late in the rc cycle now.  
> 
> I'm pretty sure we won't get all my changes into v6.13.

Indeed: Linus would have to like them and 'just apply them' :-)

	David

> 
> Best regards
> Uwe






[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux