From: Arnd Bergmann <arnd@arndb.de>
To: Oded Gabbay <oded.gabbay@gmail.com>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mike Rapoport <rppt@linux.ibm.com>, linux-kernel@vger.kernel.org
Subject: [PATCH] misc: habanalabs: avoid HWMON dependency
Date: Mon, 4 Mar 2019 21:04:02 +0100 [thread overview]
Message-ID: <20190304200412.1269035-1-arnd@arndb.de> (raw)
When CONFIG_HWMON is disabled, we currently get a link error for this driver:
ERROR: "hwmon_device_unregister" [drivers/misc/habanalabs/habanalabs.ko] undefined!
ERROR: "hwmon_device_register_with_info" [drivers/misc/habanalabs/habanalabs.ko] undefined!
As the hardware monitoring is not a required part of the functionality,
make it possible to compile without HWMON by ignoring all that functionality
depending on the configuration.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/misc/habanalabs/hwmon.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/habanalabs/hwmon.c b/drivers/misc/habanalabs/hwmon.c
index 77facd25c4a2..933746639831 100644
--- a/drivers/misc/habanalabs/hwmon.c
+++ b/drivers/misc/habanalabs/hwmon.c
@@ -423,7 +423,7 @@ int hl_hwmon_init(struct hl_device *hdev)
struct device *dev = hdev->pdev ? &hdev->pdev->dev : hdev->dev;
int rc;
- if ((hdev->hwmon_initialized) || !(hdev->fw_loading))
+ if (!IS_ENABLED(CONFIG_HWMON) || (hdev->hwmon_initialized) || !(hdev->fw_loading))
return 0;
if (hdev->hl_chip_info->info) {
@@ -451,7 +451,7 @@ int hl_hwmon_init(struct hl_device *hdev)
void hl_hwmon_fini(struct hl_device *hdev)
{
- if (!hdev->hwmon_initialized)
+ if (!IS_ENABLED(CONFIG_HWMON) || !hdev->hwmon_initialized)
return;
hwmon_device_unregister(hdev->hwmon_dev);
--
2.20.0
next reply other threads:[~2019-03-04 20:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-04 20:04 Arnd Bergmann [this message]
2019-03-04 20:21 ` Oded Gabbay
2019-03-04 21:12 ` Arnd Bergmann
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=20190304200412.1269035-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oded.gabbay@gmail.com \
--cc=rppt@linux.ibm.com \
/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®