[LTP] [PATCH v2] ltp_block_dev: Check HAVE_LINUX_GENHD_H to include genhd.h
Tiezhu Yang
yangtiezhu@loongson.cn
Wed Jul 23 02:51:16 CEST 2025
After the LTP commit d4dd360b05f8 ("device-drivers/acpi/ltp_acpi_cmds:
Fix build errors"), HAVE_LINUX_GENHD_H is defined to 1 if you have the
<linux/genhd.h> header file.
The macro definition DISK_NAME_LEN may be completely removed, so it is
better to use #ifdef HAVE_LINUX_GENHD_H to include genhd.h.
Suggested-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
v2: Add Suggested-by tag
.../device-drivers/block/block_dev_kernel/ltp_block_dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/kernel/device-drivers/block/block_dev_kernel/ltp_block_dev.c b/testcases/kernel/device-drivers/block/block_dev_kernel/ltp_block_dev.c
index 0fd278981..f50530f23 100644
--- a/testcases/kernel/device-drivers/block/block_dev_kernel/ltp_block_dev.c
+++ b/testcases/kernel/device-drivers/block/block_dev_kernel/ltp_block_dev.c
@@ -13,7 +13,7 @@
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/blkdev.h>
-#ifndef DISK_NAME_LEN
+#ifdef HAVE_LINUX_GENHD_H
# include <linux/genhd.h>
#endif
--
2.42.0
More information about the ltp
mailing list