Re: [PATCH v23 4/8] crash: memory and CPU hotplug sysfs attributes

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

 



On Tue, Jun 13 2023 at 14:58, Eric DeVolder wrote:
> On 6/13/23 10:24, Eric DeVolder wrote:
>> On 6/13/23 03:03, Greg KH wrote:
>>> All of these #ifdefs should all be removed and instead use the
>>> is_visible() callback to determine if the attribute is shown or not,
>>> using the IS_ENABLED() test in the function.
>> 
>> ok, I'll correct this.
>
> I've been examining drivers/base/cacheinfo.c as a template for how to remove the
> #ifdefs and use the is_visible() callback for the drivers/base/cpu|memory.c files.
>
> I'm attempting to apply this technique to drivers/base/cpu.c. In this file, there
> are features that are compiled in/out based on the CONFIG settings, for example 
> CONFIG_ARCH_CPU_PROBE_RELEASE. My attempts at applying the technique thus far have
> resulted in link-time errors for missing symbols, ie. arch_cpu_probe() and
> arch_cpu_release().
>
> As I understand it, to use IS_ENABLED(XYZ) to guard-band conditional code, the contents
> of that code still needs to be compile-able (eg. no references to struct members with
> surrounding #ifdef CONFIG_XYZ) and link-able (eg. any called functions must also be
> compiled).

You can't obviously reference anything which is #ifdeffed out in a data
structure. But functions is a different story. All you needs is a
declaration.

void foo(void);

     if (IS_ENABLED(FOO))
     	foo();

Builds correctly if FOO=n and foo() is not built in. The wonders of dead
code elimination.

Thanks,

        tglx



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux