linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath10k: fix build error when hwmon is off
@ 2014-12-24 11:24 Rajkumar Manoharan
  2015-01-07 14:33 ` Kalle Valo
  0 siblings, 1 reply; 3+ messages in thread
From: Rajkumar Manoharan @ 2014-12-24 11:24 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Rajkumar Manoharan

Place hwmon APIs inside CONFIG_HWMON switch to fix undefined
errors when hwmon is not enabled.

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

Reported-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/thermal.c | 8 ++++++++
 drivers/net/wireless/ath/ath10k/thermal.h | 7 +++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/thermal.c b/drivers/net/wireless/ath/ath10k/thermal.c
index d939135..7e982e4 100644
--- a/drivers/net/wireless/ath/ath10k/thermal.c
+++ b/drivers/net/wireless/ath/ath10k/thermal.c
@@ -121,6 +121,7 @@ static struct thermal_cooling_device_ops ath10k_thermal_ops = {
 	.set_cur_state = ath10k_thermal_set_cur_dutycycle,
 };
 
+#ifdef CONFIG_HWMON
 static ssize_t ath10k_thermal_show_temp(struct device *dev,
 					struct device_attribute *attr,
 					char *buf)
@@ -182,11 +183,14 @@ static struct attribute *ath10k_hwmon_attrs[] = {
 	NULL,
 };
 ATTRIBUTE_GROUPS(ath10k_hwmon);
+#endif
 
 int ath10k_thermal_register(struct ath10k *ar)
 {
 	struct thermal_cooling_device *cdev;
+#ifdef CONFIG_HWMON
 	struct device *hwmon_dev;
+#endif
 	int ret;
 
 	cdev = thermal_cooling_device_register("ath10k_thermal", ar,
@@ -207,6 +211,7 @@ int ath10k_thermal_register(struct ath10k *ar)
 
 	ar->thermal.cdev = cdev;
 
+#ifdef CONFIG_HWMON
 	/* Do not register hwmon device when temperature reading is not
 	 * supported by firmware
 	 */
@@ -222,10 +227,13 @@ int ath10k_thermal_register(struct ath10k *ar)
 		ret = -EINVAL;
 		goto err_remove_link;
 	}
+#endif
 	return 0;
 
+#ifdef CONFIG_HWMON
 err_remove_link:
 	sysfs_remove_link(&ar->dev->kobj, "thermal_sensor");
+#endif
 err_cooling_destroy:
 	thermal_cooling_device_unregister(cdev);
 	return ret;
diff --git a/drivers/net/wireless/ath/ath10k/thermal.h b/drivers/net/wireless/ath/ath10k/thermal.h
index bccc17a..9607e1a 100644
--- a/drivers/net/wireless/ath/ath10k/thermal.h
+++ b/drivers/net/wireless/ath/ath10k/thermal.h
@@ -38,7 +38,6 @@ struct ath10k_thermal {
 #ifdef CONFIG_THERMAL
 int ath10k_thermal_register(struct ath10k *ar);
 void ath10k_thermal_unregister(struct ath10k *ar);
-void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature);
 #else
 static inline int ath10k_thermal_register(struct ath10k *ar)
 {
@@ -49,10 +48,14 @@ static inline void ath10k_thermal_unregister(struct ath10k *ar)
 {
 }
 
+#endif /* CONFIG_THERMAL */
+#ifdef CONFIG_HWMON
+void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature);
+#else
 static inline void ath10k_thermal_event_temperature(struct ath10k *ar,
 						    int temperature)
 {
 }
 
-#endif
+#endif /* CONFIG_HWMON */
 #endif /* _THERMAL_ */
-- 
2.2.1


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

* Re: [PATCH] ath10k: fix build error when hwmon is off
  2014-12-24 11:24 [PATCH] ath10k: fix build error when hwmon is off Rajkumar Manoharan
@ 2015-01-07 14:33 ` Kalle Valo
  2015-01-07 15:04   ` Rajkumar
  0 siblings, 1 reply; 3+ messages in thread
From: Kalle Valo @ 2015-01-07 14:33 UTC (permalink / raw)
  To: Rajkumar Manoharan; +Cc: ath10k, linux-wireless

Rajkumar Manoharan <rmanohar@qti.qualcomm.com> writes:

> Place hwmon APIs inside CONFIG_HWMON switch to fix undefined
> errors when hwmon is not enabled.
>
> ERROR: "devm_hwmon_device_register_with_groups"
> [drivers/net/wireless/ath/ath10k/ath10k_core.ko] undefined!
>
> Reported-by: Kalle Valo <kvalo@qca.qualcomm.com>
> Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>

Thanks, but this has too many ifdefs for my taste. I have another idea,
let me send v2 shortly.

-- 
Kalle Valo

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

* Re: [PATCH] ath10k: fix build error when hwmon is off
  2015-01-07 14:33 ` Kalle Valo
@ 2015-01-07 15:04   ` Rajkumar
  0 siblings, 0 replies; 3+ messages in thread
From: Rajkumar @ 2015-01-07 15:04 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath10k, linux-wireless

On Wed, Jan 07, 2015 at 04:33:46PM +0200, Kalle Valo wrote:
> Rajkumar Manoharan <rmanohar@qti.qualcomm.com> writes:
> 
> > Place hwmon APIs inside CONFIG_HWMON switch to fix undefined
> > errors when hwmon is not enabled.
> >
> > ERROR: "devm_hwmon_device_register_with_groups"
> > [drivers/net/wireless/ath/ath10k/ath10k_core.ko] undefined!
> >
> > Reported-by: Kalle Valo <kvalo@qca.qualcomm.com>
> > Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
> 
> Thanks, but this has too many ifdefs for my taste. I have another idea,
> let me send v2 shortly.
>
Got you ;)
Having seperate register/unregister APIs for hwmon ops reduce switches.

-Rajkumar

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

end of thread, other threads:[~2015-01-07 15:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-24 11:24 [PATCH] ath10k: fix build error when hwmon is off Rajkumar Manoharan
2015-01-07 14:33 ` Kalle Valo
2015-01-07 15:04   ` Rajkumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).