Skip to content

Commit 1488ac9

Browse files
zhang-ruirafaeljw
authored andcommitted
powercap: intel_rapl: Allow probing without CPUID match
Currently, CPU model checks is used to 1. get proper rapl_defaults callbacks for RAPL MSR/MMIO Interface. 2. create a platform device node for the intel_rapl_msr driver to probe. Both of these are only mandatory for the RAPL MSR/MMIO Interface. Make the CPUID match optional. Signed-off-by: Zhang Rui <[email protected]> Tested-by: Wang Wendy <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 31cb130 commit 1488ac9

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

drivers/powercap/intel_rapl_common.c

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,32 +1528,25 @@ static int __init rapl_init(void)
15281528
int ret;
15291529

15301530
id = x86_match_cpu(rapl_ids);
1531-
if (!id) {
1532-
pr_err("driver does not support CPU family %d model %d\n",
1533-
boot_cpu_data.x86, boot_cpu_data.x86_model);
1531+
if (id) {
1532+
rapl_defaults = (struct rapl_defaults *)id->driver_data;
15341533

1535-
return -ENODEV;
1536-
}
1537-
1538-
rapl_defaults = (struct rapl_defaults *)id->driver_data;
1539-
1540-
ret = register_pm_notifier(&rapl_pm_notifier);
1541-
if (ret)
1542-
return ret;
1534+
rapl_msr_platdev = platform_device_alloc("intel_rapl_msr", 0);
1535+
if (!rapl_msr_platdev)
1536+
return -ENOMEM;
15431537

1544-
rapl_msr_platdev = platform_device_alloc("intel_rapl_msr", 0);
1545-
if (!rapl_msr_platdev) {
1546-
ret = -ENOMEM;
1547-
goto end;
1538+
ret = platform_device_add(rapl_msr_platdev);
1539+
if (ret) {
1540+
platform_device_put(rapl_msr_platdev);
1541+
return ret;
1542+
}
15481543
}
15491544

1550-
ret = platform_device_add(rapl_msr_platdev);
1551-
if (ret)
1545+
ret = register_pm_notifier(&rapl_pm_notifier);
1546+
if (ret && rapl_msr_platdev) {
1547+
platform_device_del(rapl_msr_platdev);
15521548
platform_device_put(rapl_msr_platdev);
1553-
1554-
end:
1555-
if (ret)
1556-
unregister_pm_notifier(&rapl_pm_notifier);
1549+
}
15571550

15581551
return ret;
15591552
}

0 commit comments

Comments
 (0)