Skip to content

Commit 500589d

Browse files
arndbgregkh
authored andcommitted
coresight: etm4x: Fix unused function warning
Some of the newly added code in the etm4x driver is inside of an #ifdef, and some other code is outside of it, leading to a harmless warning when CONFIG_CPU_PM is disabled: drivers/hwtracing/coresight/coresight-etm4x.c:68:13: error: 'etm4_os_lock' defined but not used [-Werror=unused-function] static void etm4_os_lock(struct etmv4_drvdata *drvdata) ^~~~~~~~~~~~ To avoid the warning and simplify the the #ifdef checks, use IS_ENABLED() instead, so the compiler can drop the unused functions without complaining. Fixes: f188b5e ("coresight: etm4x: Save/restore state across CPU low power states") Signed-off-by: Arnd Bergmann <arnd@arndb.de> [Fixed capital 'f' in title] Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Link: https://lore.kernel.org/r/20191213223107.1484-2-mathieu.poirier@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b3a987b commit 500589d

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

‎drivers/hwtracing/coresight/coresight-etm4x.c‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,6 @@ static void etm4_init_trace_id(struct etmv4_drvdata *drvdata)
11321132
drvdata->trcid = coresight_get_trace_id(drvdata->cpu);
11331133
}
11341134

1135-
#ifdef CONFIG_CPU_PM
11361135
static int etm4_cpu_save(struct etmv4_drvdata *drvdata)
11371136
{
11381137
int i, ret = 0;
@@ -1402,17 +1401,17 @@ static struct notifier_block etm4_cpu_pm_nb = {
14021401

14031402
static int etm4_cpu_pm_register(void)
14041403
{
1405-
return cpu_pm_register_notifier(&etm4_cpu_pm_nb);
1404+
if (IS_ENABLED(CONFIG_CPU_PM))
1405+
return cpu_pm_register_notifier(&etm4_cpu_pm_nb);
1406+
1407+
return 0;
14061408
}
14071409

14081410
static void etm4_cpu_pm_unregister(void)
14091411
{
1410-
cpu_pm_unregister_notifier(&etm4_cpu_pm_nb);
1412+
if (IS_ENABLED(CONFIG_CPU_PM))
1413+
cpu_pm_unregister_notifier(&etm4_cpu_pm_nb);
14111414
}
1412-
#else
1413-
static int etm4_cpu_pm_register(void) { return 0; }
1414-
static void etm4_cpu_pm_unregister(void) { }
1415-
#endif
14161415

14171416
static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
14181417
{

0 commit comments

Comments
 (0)