diff options
author | Guenter Roeck <linux@roeck-us.net> | 2016-08-12 09:28:15 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2016-09-09 00:34:16 -0400 |
commit | 86430c1a66fe490fc97b0970575c223e27dee49d (patch) | |
tree | 3a9cfc330173a7114a5a9b5896a4d3e33f115164 | |
parent | aa18cc911ae2f172429d59169e95726b8e63525c (diff) |
hwmon: (core) Avoid cyclic dependency between hwmon and thermal_sys
If both hwmon and thermal_sys are built as modules, and
CONFIG_THERMAL_HWMON is enabled, the following cyclic module dependency
is reported.
depmod: ERROR: Found 2 modules in dependency cycles!
depmod: ERROR: Cycle detected: hwmon -> thermal_sys -> hwmon
Fixes: e4bce763adb2 ("hwmon: (core) New hwmon registration API")
Reported-by: Vignesh R <vigneshr@ti.com>
Cc: Keerthy J <j-keerthy@ti.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/hwmon.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index fade170977e8..adae6848ffb2 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c | |||
@@ -108,7 +108,13 @@ static DEFINE_IDA(hwmon_ida); | |||
108 | 108 | ||
109 | /* Thermal zone handling */ | 109 | /* Thermal zone handling */ |
110 | 110 | ||
111 | #if IS_REACHABLE(CONFIG_THERMAL) && defined(CONFIG_THERMAL_OF) | 111 | /* |
112 | * The complex conditional is necessary to avoid a cyclic dependency | ||
113 | * between hwmon and thermal_sys modules. | ||
114 | */ | ||
115 | #if IS_REACHABLE(CONFIG_THERMAL) && defined(CONFIG_THERMAL_OF) && \ | ||
116 | (!defined(CONFIG_THERMAL_HWMON) || \ | ||
117 | !(defined(MODULE) && IS_MODULE(CONFIG_THERMAL))) | ||
112 | static int hwmon_thermal_get_temp(void *data, int *temp) | 118 | static int hwmon_thermal_get_temp(void *data, int *temp) |
113 | { | 119 | { |
114 | struct hwmon_thermal_data *tdata = data; | 120 | struct hwmon_thermal_data *tdata = data; |
@@ -153,7 +159,7 @@ static int hwmon_thermal_add_sensor(struct device *dev, | |||
153 | { | 159 | { |
154 | return 0; | 160 | return 0; |
155 | } | 161 | } |
156 | #endif /* IS_REACHABLE(CONFIG_THERMAL) && defined(CONFIG_THERMAL_OF) */ | 162 | #endif /* IS_REACHABLE(CONFIG_THERMAL) && ... */ |
157 | 163 | ||
158 | /* sysfs attribute management */ | 164 | /* sysfs attribute management */ |
159 | 165 | ||