Skip to content

Commit 01f259f

Browse files
arndbandy-shev
authored andcommitted
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: aae43c2 ("platform/x86: intel_pmc_core: Relocate pmc_core_*_display() to outside of CONFIG_DEBUG_FS") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent 3bd12da commit 01f259f

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

drivers/platform/x86/intel_pmc_core.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,6 @@ static void pmc_core_lpm_display(struct pmc_dev *pmcdev, struct device *dev,
692692
kfree(lpm_regs);
693693
}
694694

695-
#if IS_ENABLED(CONFIG_DEBUG_FS)
696695
static bool slps0_dbg_latch;
697696

698697
static inline u8 pmc_core_reg_read_byte(struct pmc_dev *pmcdev, int offset)
@@ -1133,15 +1132,6 @@ static void pmc_core_dbgfs_register(struct pmc_dev *pmcdev)
11331132
&pmc_core_substate_l_sts_regs_fops);
11341133
}
11351134
}
1136-
#else
1137-
static inline void pmc_core_dbgfs_register(struct pmc_dev *pmcdev)
1138-
{
1139-
}
1140-
1141-
static inline void pmc_core_dbgfs_unregister(struct pmc_dev *pmcdev)
1142-
{
1143-
}
1144-
#endif /* CONFIG_DEBUG_FS */
11451135

11461136
static const struct x86_cpu_id intel_pmc_core_ids[] = {
11471137
X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_L, &spt_reg_map),
@@ -1260,13 +1250,11 @@ static int pmc_core_remove(struct platform_device *pdev)
12601250
return 0;
12611251
}
12621252

1263-
#ifdef CONFIG_PM_SLEEP
1264-
12651253
static bool warn_on_s0ix_failures;
12661254
module_param(warn_on_s0ix_failures, bool, 0644);
12671255
MODULE_PARM_DESC(warn_on_s0ix_failures, "Check and warn for S0ix failures");
12681256

1269-
static int pmc_core_suspend(struct device *dev)
1257+
static __maybe_unused int pmc_core_suspend(struct device *dev)
12701258
{
12711259
struct pmc_dev *pmcdev = dev_get_drvdata(dev);
12721260

@@ -1318,7 +1306,7 @@ static inline bool pmc_core_is_s0ix_failed(struct pmc_dev *pmcdev)
13181306
return false;
13191307
}
13201308

1321-
static int pmc_core_resume(struct device *dev)
1309+
static __maybe_unused int pmc_core_resume(struct device *dev)
13221310
{
13231311
struct pmc_dev *pmcdev = dev_get_drvdata(dev);
13241312
const struct pmc_bit_map **maps = pmcdev->map->lpm_sts;
@@ -1348,8 +1336,6 @@ static int pmc_core_resume(struct device *dev)
13481336
return 0;
13491337
}
13501338

1351-
#endif
1352-
13531339
static const struct dev_pm_ops pmc_core_pm_ops = {
13541340
SET_LATE_SYSTEM_SLEEP_PM_OPS(pmc_core_suspend, pmc_core_resume)
13551341
};

drivers/platform/x86/intel_pmc_core.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,7 @@ struct pmc_dev {
282282
u32 base_addr;
283283
void __iomem *regbase;
284284
const struct pmc_reg_map *map;
285-
#if IS_ENABLED(CONFIG_DEBUG_FS)
286285
struct dentry *dbgfs_dir;
287-
#endif /* CONFIG_DEBUG_FS */
288286
int pmc_xram_read_bit;
289287
struct mutex lock; /* generic mutex lock for PMC Core */
290288

0 commit comments

Comments
 (0)