[PATCH v2] platform/x86: intel_pmc_ipc: add option to build without ACPI

From: Choong Yong Liang
Date: Thu Mar 13 2025 - 04:56:12 EST


From: David E. Box <david.e.box@xxxxxxxxxxxxxxx>

Introduce a configuration option that allows users to build the
intel_pmc_ipc driver without ACPI support. This is useful for
systems where ACPI is not available or desired.

Based on the discussion from the patch [1], it was necessary to
provide this option to accommodate specific use cases.

Link: https://patchwork.kernel.org/project/netdevbpf/patch/20250227121522.1802832-6-yong.liang.choong@xxxxxxxxxxxxxxx/#26280764 [1]

Signed-off-by: David E. Box <david.e.box@xxxxxxxxxxxxxxx>
Co-developed-by: Choong Yong Liang <yong.liang.choong@xxxxxxxxxxxxxxx>
Signed-off-by: Choong Yong Liang <yong.liang.choong@xxxxxxxxxxxxxxx>

---
v2 Changes:
- Updated the patch description based on the comment
- Update the author correctly
- Used "#ifdef" instead of "#if" for CONFIG_ACPI
- Placed "#ifdef" inside the function

v1: https://patchwork.kernel.org/project/platform-driver-x86/patch/20250312022955.1418234-1-yong.liang.choong@xxxxxxxxxxxxxxx/
---
---
include/linux/platform_data/x86/intel_pmc_ipc.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/include/linux/platform_data/x86/intel_pmc_ipc.h b/include/linux/platform_data/x86/intel_pmc_ipc.h
index 6e603a8c075f..1d34435b7001 100644
--- a/include/linux/platform_data/x86/intel_pmc_ipc.h
+++ b/include/linux/platform_data/x86/intel_pmc_ipc.h
@@ -36,6 +36,7 @@ struct pmc_ipc_rbuf {
*/
static inline int intel_pmc_ipc(struct pmc_ipc_cmd *ipc_cmd, struct pmc_ipc_rbuf *rbuf)
{
+#ifdef CONFIG_ACPI
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object params[PMC_IPCS_PARAM_COUNT] = {
{.type = ACPI_TYPE_INTEGER,},
@@ -89,6 +90,9 @@ static inline int intel_pmc_ipc(struct pmc_ipc_cmd *ipc_cmd, struct pmc_ipc_rbuf
}

return 0;
+#else
+ return -ENODEV;
+#endif /* CONFIG_ACPI */
}

#endif /* INTEL_PMC_IPC_H */
--
2.34.1