From: Arnd Bergmann <arnd@kernel.org>
To: James Seo <james@equiv.tech>, Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>
Cc: Arnd Bergmann <arnd@arndb.de>,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] hwmon: hp-wmi-sensors: fix debugfs check
Date: Thu, 1 Jun 2023 23:31:54 +0200 [thread overview]
Message-ID: <20230601213216.3220550-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
Checking for Kconfig symbols with #if is wrong:
drivers/hwmon/hp-wmi-sensors.c:1141:5: error: "CONFIG_DEBUG_FS" is not defined, evaluates to 0 [-Werror=undef]
This could be an #ifdef, but an IS_ENABLED() check is even better to
give the best compile coverage.
Fixes: 602bef0fa281f ("hwmon: add HP WMI Sensors driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/hwmon/hp-wmi-sensors.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/hwmon/hp-wmi-sensors.c b/drivers/hwmon/hp-wmi-sensors.c
index 7218945bd03fc..ebe2fb5134805 100644
--- a/drivers/hwmon/hp-wmi-sensors.c
+++ b/drivers/hwmon/hp-wmi-sensors.c
@@ -1138,8 +1138,6 @@ static int hp_wmi_update_info(struct hp_wmi_sensors *state,
return ret;
}
-#if CONFIG_DEBUG_FS
-
static int basic_string_show(struct seq_file *seqf, void *ignored)
{
const char *str = seqf->private;
@@ -1341,16 +1339,6 @@ static void hp_wmi_debugfs_init(struct device *dev, struct hp_wmi_info *info,
}
}
-#else
-
-static void hp_wmi_debugfs_init(struct device *dev, struct hp_wmi_info *info,
- struct hp_wmi_platform_events *pevents,
- u8 icount, u8 pcount, bool is_new)
-{
-}
-
-#endif
-
static umode_t hp_wmi_hwmon_is_visible(const void *drvdata,
enum hwmon_sensor_types type,
u32 attr, int channel)
@@ -1959,7 +1947,8 @@ static int hp_wmi_sensors_init(struct hp_wmi_sensors *state)
if (err)
return err;
- hp_wmi_debugfs_init(dev, info, pevents, icount, pcount, is_new);
+ if (IS_ENABLED(CONFIG_DEBUG_FS))
+ hp_wmi_debugfs_init(dev, info, pevents, icount, pcount, is_new);
if (!count)
return 0; /* No connected sensors; debugfs only. */
--
2.39.2
next reply other threads:[~2023-06-01 21:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-01 21:31 Arnd Bergmann [this message]
2023-06-02 7:12 ` [PATCH] hwmon: hp-wmi-sensors: fix debugfs check James Seo
2023-06-02 21:38 ` Guenter Roeck
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=20230601213216.3220550-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--cc=james@equiv.tech \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.