Re: [PATCH] hwmon: (core) Avoid ifdef in C source file
From: Thomas Weißschuh
Date: Fri Nov 15 2024 - 12:14:11 EST
On 2024-11-15 08:31:27-0800, Guenter Roeck wrote:
> Hi Thomas,
>
> On Wed, Nov 13, 2024 at 05:39:16AM +0100, Thomas Weißschuh wrote:
> > Using an #ifdef in a C source files to have different definitions
> > of the same symbol makes the code harder to read and understand.
> > Furthermore it makes it harder to test compilation of the different
> > branches.
> >
> > Replace the ifdeffery with IS_ENABLED() which is just a normal
> > conditional.
> > The resulting binary is still the same as before as the compiler
> > optimizes away all the unused code and definitions.
> >
> > Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
> > ---
>
> I decided to apply the patch despite my concerns about the lack
> of dummy functions. Let's see if it blows up in our face; if so,
> I'll revert it.
It will blow up because of the missing declaration/stub for
thermal_zone_device_update()
Thomas