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
 
 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
 
        atomic_t refcnt;
 };
 
-#ifdef CONFIG_THERMAL
+#if IS_ENABLED(CONFIG_THERMAL)
 struct ch_thermal {
        struct thermal_zone_device *tzdev;
        int trip_temp;
 
        /* 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
 };
                    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__ */
 
        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;
 
                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 ...