Skip to contentSkip to conversation

cxgb4: fix thermal configuration dependencies

PATCH Applied Arnd Bergmann 2 participants 2 messages Oct 11, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxgb4: fix thermal configuration dependencies

With CONFIG_THERMAL=m, we get a build error:

drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c: In function 'cxgb4_thermal_get_trip_type':
drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c:48:11: error: 'struct adapter' has no member named 'ch_thermal'

Once that is fixed by using IS_ENABLED() checks, we get a link error against the thermal subsystem when cxgb4 is built-in:

drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.o: In function `cxgb4_thermal_init':
cxgb4_thermal.c:(.text+0x180): undefined reference to thermal_zone_device_register' drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.o: In function cxgb4_thermal_remove':
cxgb4_thermal.c:(.text+0x1e0): undefined reference to `thermal_zone_device_unregister'

Finally, since CONFIG_THERMAL can be =m, the Makefile fails to pick up the extra file into built-in.a, and we get another link failure against the cxgb4_thermal_init/cxgb4_thermal_remove files, so the Makefile has to be adapted as well to work for both CONFIG_THERMAL=y and =m.

Fixes b18719157762 ("cxgb4: Add thermal zone support")
---
 drivers/net/ethernet/chelsio/Kconfig            |  1 +
 drivers/net/ethernet/chelsio/cxgb4/Makefile     |  4 +++-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h      |  6 ++----
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 10 ++++------
 4 files changed, 10 insertions(+), 11 deletions(-)
drivers/net/ethernet/chelsio/Kconfig +1 -0
index e2cdfa75673f..75c1c5ed2387 100644
@@ -67,6 +67,7 @@ config CHELSIO_T3
 config CHELSIO_T4
 	tristate "Chelsio Communications T4/T5/T6 Ethernet support"
 	depends on PCI && (IPV6 || IPV6=n)
+	depends on THERMAL || !THERMAL
 	select FW_LOADER
 	select MDIO
 	select ZLIB_DEFLATE
drivers/net/ethernet/chelsio/cxgb4/Makefile +3 -1
index 91d8a885deba..78e5d17a1d5f 100644
@@ -12,4 +12,6 @@ cxgb4-objs := cxgb4_main.o l2t.o smt.o t4_hw.o sge.o clip_tbl.o cxgb4_ethtool.o
 cxgb4-$(CONFIG_CHELSIO_T4_DCB) +=  cxgb4_dcb.o
 cxgb4-$(CONFIG_CHELSIO_T4_FCOE) +=  cxgb4_fcoe.o
 cxgb4-$(CONFIG_DEBUG_FS) += cxgb4_debugfs.o
-cxgb4-$(CONFIG_THERMAL) += cxgb4_thermal.o
+ifdef CONFIG_THERMAL
+cxgb4-objs += cxgb4_thermal.o
+endif
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +2 -4
index 95909f0686b1..b16f4b3ef4c5 100644
@@ -891,7 +891,7 @@ struct mps_encap_entry {
 	atomic_t refcnt;
 };
 
-#ifdef CONFIG_THERMAL
+#if IS_ENABLED(CONFIG_THERMAL)
 struct ch_thermal {
 	struct thermal_zone_device *tzdev;
 	int trip_temp;
@@ -1017,7 +1017,7 @@ struct adapter {
 
 	/* Dump buffer for collecting logs in kdump kernel */
 	struct vmcoredd_data vmcoredd;
-#ifdef CONFIG_THERMAL
+#if IS_ENABLED(CONFIG_THERMAL)
 	struct ch_thermal ch_thermal;
 #endif
 };
@@ -1875,9 +1875,7 @@ int t4_set_vlan_acl(struct adapter *adap, unsigned int mbox, unsigned int vf,
 		    u16 vlan);
 int cxgb4_dcb_enabled(const struct net_device *dev);
 
-#ifdef CONFIG_THERMAL
 int cxgb4_thermal_init(struct adapter *adap);
 int cxgb4_thermal_remove(struct adapter *adap);
-#endif /* CONFIG_THERMAL */
 
 #endif /* __CXGB4_H__ */
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +4 -6
index 309f8c2226a5..05a46926016a 100644
@@ -5863,10 +5863,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (!is_t4(adapter->params.chip))
 		cxgb4_ptp_init(adapter);
 
-#ifdef CONFIG_THERMAL
-	if (!is_t4(adapter->params.chip) && (adapter->flags & FW_OK))
+	if (IS_ENABLED(CONFIG_THERMAL) &&
+	    !is_t4(adapter->params.chip) && (adapter->flags & FW_OK))
 		cxgb4_thermal_init(adapter);
-#endif /* CONFIG_THERMAL */
 
 	print_adapter_info(adapter);
 	return 0;
@@ -5933,9 +5932,8 @@ static void remove_one(struct pci_dev *pdev)
 
 		if (!is_t4(adapter->params.chip))
 			cxgb4_ptp_stop(adapter);
-#ifdef CONFIG_THERMAL
-		cxgb4_thermal_remove(adapter);
-#endif
+		if (IS_ENABLED(CONFIG_THERMAL))
+			cxgb4_thermal_remove(adapter);
 
 		/* If we allocated filters, free up state associated with any
 		 * valid filters ...
Signature · 1 line
2.18.0
maintainer Applied
#1 lore raw

From: Arnd Bergmann <[email protected]>
Date: Thu, 11 Oct 2018 10:57:57 +0200

Quoted 13 lines

With CONFIG_THERMAL=m, we get a build error:

drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c: In function 'cxgb4_thermal_get_trip_type':
drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c:48:11: error: 'struct adapter' has no member named 'ch_thermal'

Once that is fixed by using IS_ENABLED() checks, we get a link error against the thermal subsystem when cxgb4 is built-in:

drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.o: In function `cxgb4_thermal_init':
cxgb4_thermal.c:(.text+0x180): undefined reference to thermal_zone_device_register' drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.o: In function cxgb4_thermal_remove':
cxgb4_thermal.c:(.text+0x1e0): undefined reference to `thermal_zone_device_unregister'

Quoted 7 lines

Finally, since CONFIG_THERMAL can be =m, the Makefile fails to pick up the extra file into built-in.a, and we get another link failure against the cxgb4_thermal_init/cxgb4_thermal_remove files, so the Makefile has to be adapted as well to work for both CONFIG_THERMAL=y and =m.

Fixes b18719157762 ("cxgb4: Add thermal zone support")

Applied, thanks Arnd.