lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190304200412.1269035-1-arnd@arndb.de>
Date:   Mon,  4 Mar 2019 21:04:02 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Oded Gabbay <oded.gabbay@...il.com>, Arnd Bergmann <arnd@...db.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Mike Rapoport <rppt@...ux.ibm.com>, linux-kernel@...r.kernel.org
Subject: [PATCH] misc: habanalabs: avoid HWMON dependency

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@...db.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ