[LTP] [PATCH] device-drivers/acpi/ltp_acpi_cmds: Fix build errors
Andrea Cervesato
andrea.cervesato@suse.com
Tue Jul 15 11:24:39 CEST 2025
Hi!
On 7/11/25 10:01 AM, Tiezhu Yang wrote:
> There exist the following errors when building LTP:
>
> ltp_acpi_cmds.c:39:10: fatal error: linux/genhd.h: No such file or directory
> ltp_acpi_cmds.c:131:18: error: implicit declaration of function 'acpi_bus_get_device'
> ltp_acpi_cmds.c:400:18: error: implicit declaration of function 'acpi_bus_get_device'
>
> For the first error:
>
> This is because genhd.h has been removed in the Linux kernel, the contents
> of genhd.h was folded into blkdev.h [1]. Since blkdev.h has been included
> in the C file, just remove unused include genhd.h to fix the build error.
>
> For the second and third errors:
>
> This is because acpi_bus_get_device() has been droped in the Linux kernel,
> in order to fix the build errors, just replace acpi_bus_get_device() with
> acpi_fetch_acpi_dev() like the kernel commit [2].
>
> [1] https://git.kernel.org/torvalds/c/322cbb50de71
> [2] https://git.kernel.org/torvalds/c/ac2a3feefad5
These patches have been introduced in v5.18, but we support kernel until
v4.4. If we really want to keep this code, we need to use autoconf in
order to recognize acpi functions and to create a fallback file in
lapi/genhd.h like we usually do for the older API.
https://github.com/linux-test-project/ltp/blob/master/configure.ac
https://github.com/linux-test-project/ltp/tree/master/include/lapi
- Andrea
More information about the ltp
mailing list