Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform/x86: intel_pmc_core: avoid unused-function warnings

When both CONFIG_DEBUG_FS and CONFIG_PM_SLEEP are disabled, the
functions that got moved out of the #ifdef section now cause
a warning:

drivers/platform/x86/intel_pmc_core.c:654:13: error: 'pmc_core_lpm_display' defined but not used [-Werror=unused-function]
654 | static void pmc_core_lpm_display(struct pmc_dev *pmcdev, struct device *dev,
| ^~~~~~~~~~~~~~~~~~~~
drivers/platform/x86/intel_pmc_core.c:617:13: error: 'pmc_core_slps0_display' defined but not used [-Werror=unused-function]
617 | static void pmc_core_slps0_display(struct pmc_dev *pmcdev, struct device *dev,
| ^~~~~~~~~~~~~~~~~~~~~~

Rather than add even more #ifdefs here, remove them entirely and
let the compiler work it out, it can actually get rid of all the
debugfs calls without problems as long as the struct member is
there.

The two PM functions just need a __maybe_unused annotations to avoid
another warning instead of the #ifdef.

Fixes: aae43c2bcdc1 ("platform/x86: intel_pmc_core: Relocate pmc_core_*_display() to outside of CONFIG_DEBUG_FS")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

authored by

Arnd Bergmann and committed by
Andy Shevchenko
3ce2db60 b4603cb4

+2 -18
+2 -16
drivers/platform/x86/intel_pmc_core.c
··· 692 692 kfree(lpm_regs); 693 693 } 694 694 695 - #if IS_ENABLED(CONFIG_DEBUG_FS) 696 695 static bool slps0_dbg_latch; 697 696 698 697 static inline u8 pmc_core_reg_read_byte(struct pmc_dev *pmcdev, int offset) ··· 1132 1133 &pmc_core_substate_l_sts_regs_fops); 1133 1134 } 1134 1135 } 1135 - #else 1136 - static inline void pmc_core_dbgfs_register(struct pmc_dev *pmcdev) 1137 - { 1138 - } 1139 - 1140 - static inline void pmc_core_dbgfs_unregister(struct pmc_dev *pmcdev) 1141 - { 1142 - } 1143 - #endif /* CONFIG_DEBUG_FS */ 1144 1136 1145 1137 static const struct x86_cpu_id intel_pmc_core_ids[] = { 1146 1138 X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_L, &spt_reg_map), ··· 1250 1260 return 0; 1251 1261 } 1252 1262 1253 - #ifdef CONFIG_PM_SLEEP 1254 - 1255 1263 static bool warn_on_s0ix_failures; 1256 1264 module_param(warn_on_s0ix_failures, bool, 0644); 1257 1265 MODULE_PARM_DESC(warn_on_s0ix_failures, "Check and warn for S0ix failures"); 1258 1266 1259 - static int pmc_core_suspend(struct device *dev) 1267 + static __maybe_unused int pmc_core_suspend(struct device *dev) 1260 1268 { 1261 1269 struct pmc_dev *pmcdev = dev_get_drvdata(dev); 1262 1270 ··· 1306 1318 return false; 1307 1319 } 1308 1320 1309 - static int pmc_core_resume(struct device *dev) 1321 + static __maybe_unused int pmc_core_resume(struct device *dev) 1310 1322 { 1311 1323 struct pmc_dev *pmcdev = dev_get_drvdata(dev); 1312 1324 const struct pmc_bit_map **maps = pmcdev->map->lpm_sts; ··· 1335 1347 1336 1348 return 0; 1337 1349 } 1338 - 1339 - #endif 1340 1350 1341 1351 static const struct dev_pm_ops pmc_core_pm_ops = { 1342 1352 SET_LATE_SYSTEM_SLEEP_PM_OPS(pmc_core_suspend, pmc_core_resume)
-2
drivers/platform/x86/intel_pmc_core.h
··· 282 282 u32 base_addr; 283 283 void __iomem *regbase; 284 284 const struct pmc_reg_map *map; 285 - #if IS_ENABLED(CONFIG_DEBUG_FS) 286 285 struct dentry *dbgfs_dir; 287 - #endif /* CONFIG_DEBUG_FS */ 288 286 int pmc_xram_read_bit; 289 287 struct mutex lock; /* generic mutex lock for PMC Core */ 290 288