mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] misc: habanalabs: avoid HWMON dependency
@ 2019-03-04 20:04 Arnd Bergmann
  2019-03-04 20:21 ` Oded Gabbay
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2019-03-04 20:04 UTC (permalink / raw)
  To: Oded Gabbay, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Mike Rapoport, linux-kernel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-04 21:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-04 20:04 [PATCH] misc: habanalabs: avoid HWMON dependency Arnd Bergmann
2019-03-04 20:21 ` Oded Gabbay
2019-03-04 21:12   ` Arnd Bergmann

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®