From: Guenter Roeck <linux@roeck-us.net>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: Jean Delvare <jdelvare@suse.com>,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: (core) Avoid ifdef in C source file
Date: Fri, 15 Nov 2024 08:36:36 -0800 [thread overview]
Message-ID: <51c9b886-be97-4fe4-bc22-35d1c727b93c@roeck-us.net> (raw)
In-Reply-To: <3dfa3859-cef0-4311-b0c5-ff1c04284e88@roeck-us.net>
On Fri, Nov 15, 2024 at 08:34:47AM -0800, Guenter Roeck wrote:
> On Fri, Nov 15, 2024 at 08:31:29AM -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@weissschuh.net>
> > > ---
> >
> > 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.
>
> Ah, no, that didn't work, because if CONFIG_THERMAL=n there isn't
> even an external declaration for thermal_zone_device_update().
>
allnoconfig+CONFIG_HWMON:
drivers/hwmon//hwmon.c: In function ‘hwmon_thermal_notify’:
drivers/hwmon//hwmon.c:302:25: error: implicit declaration of function ‘thermal_zone_device_update’; did you mean ‘thermal_zone_device_disable’? [-Werror=implicit-function-declaration]
302 | thermal_zone_device_update(tzdata->tzd,
Guenter
prev parent reply other threads:[~2024-11-15 16:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 4:39 Thomas Weißschuh
2024-11-13 6:52 ` Guenter Roeck
2024-11-14 4:40 ` Thomas Weißschuh
2024-11-14 6:51 ` Guenter Roeck
2024-11-14 7:27 ` Thomas Weißschuh
2024-11-14 14:40 ` Guenter Roeck
2024-11-14 16:07 ` Thomas Weißschuh
2024-11-15 16:31 ` Guenter Roeck
2024-11-15 16:33 ` Thomas Weißschuh
2024-11-15 16:34 ` Guenter Roeck
2024-11-15 16:36 ` Guenter Roeck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51c9b886-be97-4fe4-bc22-35d1c727b93c@roeck-us.net \
--to=linux@roeck-us.net \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®