ath10k: fix build error when hwmon is off
authorKalle Valo <kvalo@qca.qualcomm.com>
Wed, 7 Jan 2015 15:04:10 +0000 (17:04 +0200)
committerKalle Valo <kvalo@qca.qualcomm.com>
Fri, 9 Jan 2015 16:12:36 +0000 (18:12 +0200)
kbuild reported a linking error:

ERROR: "devm_hwmon_device_register_with_groups"
[drivers/net/wireless/ath/ath10k/ath10k_core.ko] undefined!

Fix it by returning early and letting the compiler to optimise out the function
call.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/thermal.c

index d93913538d180bcbe7df7f45d945806b481304e6..b14ae8d135f637bf442db547ad979aff653fa4e8 100644 (file)
@@ -213,6 +213,11 @@ int ath10k_thermal_register(struct ath10k *ar)
        if (ar->wmi.op_version != ATH10K_FW_WMI_OP_VERSION_10_2_4)
                return 0;
 
+       /* Avoid linking error on devm_hwmon_device_register_with_groups, I
+        * guess linux/hwmon.h is missing proper stubs. */
+       if (!config_enabled(HWMON))
+               return 0;
+
        hwmon_dev = devm_hwmon_device_register_with_groups(ar->dev,
                                                           "ath10k_hwmon", ar,
                                                           ath10k_hwmon_groups);