drivers/platform/x86/intel/pmc/core.c:1501:17: error: implicit declaration of function 'acpi_pmtmr_register_suspend_resume_callback'
Subsystems (3)
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 9aaeb87ce1e966169a57f53a02ba05b30880ffb8 commit: e774696b1f95cc758fa7fdf2b700733cfc7b6fb9 [7987/10296] platform/x86:intel/pmc: Enable the ACPI PM Timer to be turned off when suspended config: x86_64-buildonly-randconfig-002-20240514 (https://download.01.org/0day-ci/archive/20240909/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240909/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/platform/x86/intel/pmc/core.c: In function 'pmc_core_probe':
>> drivers/platform/x86/intel/pmc/core.c:1501:17: error: implicit declaration of function 'acpi_pmtmr_register_suspend_resume_callback' [-Werror=implicit-function-declaration]
1501 | acpi_pmtmr_register_suspend_resume_callback(pmc_core_acpi_pm_timer_suspend_resume,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/x86/intel/pmc/core.c: In function 'pmc_core_remove':
>> drivers/platform/x86/intel/pmc/core.c:1517:17: error: implicit declaration of function 'acpi_pmtmr_unregister_suspend_resume_callback' [-Werror=implicit-function-declaration]
1517 | acpi_pmtmr_unregister_suspend_resume_callback();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cc1: some warnings being treated as errors
vim +/acpi_pmtmr_register_suspend_resume_callback +1501 drivers/platform/x86/intel/pmc/core.c
1433
1434 static int pmc_core_probe(struct platform_device *pdev)
1435 {
1436 static bool device_initialized;
1437 struct pmc_dev *pmcdev;
1438 const struct x86_cpu_id *cpu_id;
1439 int (*core_init)(struct pmc_dev *pmcdev);
1440 const struct pmc_reg_map *map;
1441 struct pmc *primary_pmc;
1442 int ret;
1443
1444 if (device_initialized)
1445 return -ENODEV;
1446
1447 pmcdev = devm_kzalloc(&pdev->dev, sizeof(*pmcdev), GFP_KERNEL);
1448 if (!pmcdev)
1449 return -ENOMEM;
1450
1451 pmcdev->crystal_freq = pmc_core_get_crystal_freq();
1452
1453 platform_set_drvdata(pdev, pmcdev);
1454 pmcdev->pdev = pdev;
1455
1456 cpu_id = x86_match_cpu(intel_pmc_core_ids);
1457 if (!cpu_id)
1458 return -ENODEV;
1459
1460 core_init = (int (*)(struct pmc_dev *))cpu_id->driver_data;
1461
1462 /* Primary PMC */
1463 primary_pmc = devm_kzalloc(&pdev->dev, sizeof(*primary_pmc), GFP_KERNEL);
1464 if (!primary_pmc)
1465 return -ENOMEM;
1466 pmcdev->pmcs[PMC_IDX_MAIN] = primary_pmc;
1467
1468 /* The last element in msr_map is empty */
1469 pmcdev->num_of_pkgc = ARRAY_SIZE(msr_map) - 1;
1470 pmcdev->pkgc_res_cnt = devm_kcalloc(&pdev->dev,
1471 pmcdev->num_of_pkgc,
1472 sizeof(*pmcdev->pkgc_res_cnt),
1473 GFP_KERNEL);
1474 if (!pmcdev->pkgc_res_cnt)
1475 return -ENOMEM;
1476
1477 /*
1478 * Coffee Lake has CPU ID of Kaby Lake and Cannon Lake PCH. So here
1479 * Sunrisepoint PCH regmap can't be used. Use Cannon Lake PCH regmap
1480 * in this case.
1481 */
1482 if (core_init == spt_core_init && !pci_dev_present(pmc_pci_ids))
1483 core_init = cnp_core_init;
1484
1485 mutex_init(&pmcdev->lock);
1486 ret = core_init(pmcdev);
1487 if (ret) {
1488 pmc_core_clean_structure(pdev);
1489 return ret;
1490 }
1491
1492 pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(primary_pmc);
1493 pmc_core_do_dmi_quirks(primary_pmc);
1494
1495 pmc_core_dbgfs_register(pmcdev);
1496 pm_report_max_hw_sleep(FIELD_MAX(SLP_S0_RES_COUNTER_MASK) *
1497 pmc_core_adjust_slp_s0_step(primary_pmc, 1));
1498
1499 map = primary_pmc->map;
1500 if (map->acpi_pm_tmr_ctl_offset)
> 1501 acpi_pmtmr_register_suspend_resume_callback(pmc_core_acpi_pm_timer_suspend_resume,
1502 pmcdev);
1503
1504 device_initialized = true;
1505 dev_info(&pdev->dev, " initialized\n");
1506
1507 return 0;
1508 }
1509
1510 static void pmc_core_remove(struct platform_device *pdev)
1511 {
1512 struct pmc_dev *pmcdev = platform_get_drvdata(pdev);
1513 const struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN];
1514 const struct pmc_reg_map *map = pmc->map;
1515
1516 if (map->acpi_pm_tmr_ctl_offset)
> 1517 acpi_pmtmr_unregister_suspend_resume_callback(); 1518
1519 pmc_core_dbgfs_unregister(pmcdev);
1520 pmc_core_clean_structure(pdev);
1521 }
1522
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH 1/1 platform/x86:intel/pmc: Encapsulate callbacks registration in CONFIG_X86_PM_TIMER check
Encapsulate the code that registers and unregisters the ACPI PM Timer suspend/resume callback to checks that CONFIG_X86_PM_TIMER is enabled.
--- drivers/platform/x86/intel/pmc/core.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/platform/x86/intel/pmc/core.c +10 -2
@@ -1215,6 +1215,7 @@ static bool pmc_core_is_pson_residency_enabled(struct pmc_dev *pmcdev)return val ==1 ; } +#ifdef CONFIG_X86_PM_TIMER /* * Enable or disable ACPI PM Timer *
@@ -1247,6 +1248,7 @@ static void pmc_core_acpi_pm_timer_suspend_resume(void *data, bool suspend) pmcdev->enable_acpi_pm_timer_on_resume = suspend && enabled; } +#endif static void pmc_core_dbgfs_unregister (struct pmc_dev *pmcdev) {
@@ -1443,9 +1445,11 @@ static int pmc_core_probe(struct platform_device *pdev)struct pmc_dev *pmcdev;const struct x86_cpu_id *cpu_id;int (*core_init)(struct pmc_dev *pmcdev); -const struct pmc_reg_map *map;struct pmc *primary_pmc;int ret; +#ifdef CONFIG_X86_PM_TIMER +const struct pmc_reg_map *map; +#endif if (device_initialized)return -ENODEV ;
@@ -1502,10 +1506,12 @@ static int pmc_core_probe(struct platform_device *pdev)pm_report_max_hw_sleep (FIELD_MAX (SLP_S0_RES_COUNTER_MASK ) *pmc_core_adjust_slp_s0_step (primary_pmc,1 )); +#ifdef CONFIG_X86_PM_TIMER map = primary_pmc->map;if (map->acpi_pm_tmr_ctl_offset)acpi_pmtmr_register_suspend_resume_callback (pmc_core_acpi_pm_timer_suspend_resume, - pmcdev); + pmcdev); +#endif device_initialized = true;dev_info (&pdev->dev," initialized\n" );
@@ -1516,11 +1522,13 @@ static int pmc_core_probe(struct platform_device *pdev)static void pmc_core_remove (struct platform_device *pdev) {struct pmc_dev *pmcdev =platform_get_drvdata (pdev); +#ifdef CONFIG_X86_PM_TIMER const struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN ];const struct pmc_reg_map *map = pmc->map;if (map->acpi_pm_tmr_ctl_offset)acpi_pmtmr_unregister_suspend_resume_callback (); +#endif pmc_core_dbgfs_unregister (pmcdev);pmc_core_clean_structure (pdev);
Signature · 1 line
2.46.0.469.g59c65b2a67-goog
Re: [PATCH] platform/x86:intel/pmc: Encapsulate callbacks registration in CONFIG_X86_PM_TIMER check
Hi Marek,
Quoted 6 lines · Marek Maslanka
Encapsulate the code that registers and unregisters the ACPI PM Timer suspend/resume callback to checks that
CONFIG_X86_PM_TIMERis enabled.Reported-by kernel test robot <[email protected]>Signed-off-by Marek Maslanka <[email protected]>
Thank you for the quick fix.
Arnd has submitted a cleaner fix for this, which looks better so I think we should go with Arnd's fix:
https://lore.kernel.org/platform-driver-x86/[email protected]/
Regards,
Hans
Quoted 65 lines
--- drivers/platform/x86/intel/pmc/core.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)drivers/platform/x86/intel/pmc/core.c +10
-2@@ -1215,6 +1215,7 @@ static bool pmc_core_is_pson_residency_enabled(struct pmc_dev *pmcdev)return val ==1 ; } +#ifdef CONFIG_X86_PM_TIMER /* * Enable or disable ACPI PM Timer * @@ -1247,6 +1248,7 @@ static void pmc_core_acpi_pm_timer_suspend_resume(void *data, bool suspend) pmcdev->enable_acpi_pm_timer_on_resume = suspend && enabled; } +#endif static void pmc_core_dbgfs_unregister (struct pmc_dev *pmcdev) {@@ -1443,9 +1445,11 @@ static int pmc_core_probe(struct platform_device *pdev)struct pmc_dev *pmcdev;const struct x86_cpu_id *cpu_id;int (*core_init)(struct pmc_dev *pmcdev); -const struct pmc_reg_map *map;struct pmc *primary_pmc;int ret; +#ifdef CONFIG_X86_PM_TIMER +const struct pmc_reg_map *map; +#endif if (device_initialized)return -ENODEV ;@@ -1502,10 +1506,12 @@ static int pmc_core_probe(struct platform_device *pdev)pm_report_max_hw_sleep (FIELD_MAX (SLP_S0_RES_COUNTER_MASK ) *pmc_core_adjust_slp_s0_step (primary_pmc,1 )); +#ifdef CONFIG_X86_PM_TIMER map = primary_pmc->map;if (map->acpi_pm_tmr_ctl_offset)acpi_pmtmr_register_suspend_resume_callback (pmc_core_acpi_pm_timer_suspend_resume, - pmcdev); + pmcdev); +#endif device_initialized = true;dev_info (&pdev->dev," initialized\n" );@@ -1516,11 +1522,13 @@ static int pmc_core_probe(struct platform_device *pdev)static void pmc_core_remove (struct platform_device *pdev) {struct pmc_dev *pmcdev =platform_get_drvdata (pdev); +#ifdef CONFIG_X86_PM_TIMER const struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN ];const struct pmc_reg_map *map = pmc->map;if (map->acpi_pm_tmr_ctl_offset)acpi_pmtmr_unregister_suspend_resume_callback (); +#endif pmc_core_dbgfs_unregister (pmcdev);pmc_core_clean_structure (pdev);