From 988f0bfc38c096d594fb66925f387fa92032b6a2 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <anbe@debian.org>
Date: Wed, 14 Aug 2024 09:55:35 +0200
Subject: [PATCH] add support for Linux 6.9

adjust for Linux v6.9-rc1 commit
"block: pass a queue_limits argument to blk_alloc_disk"
(74fa8f9c553f7b5ccab7d103acae63cc2e080465)

Fixes: #185
---
 module/rapiddisk.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/module/rapiddisk.c b/module/rapiddisk.c
index 6560aeb..1a0479f 100644
--- a/module/rapiddisk.c
+++ b/module/rapiddisk.c
@@ -807,12 +807,18 @@ static int attach_device(unsigned long num, unsigned long long size)
 	blk_queue_make_request(rdsk->rdsk_queue, rdsk_make_request);
 #endif
 #endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+	disk = rdsk->rdsk_disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
 	disk = rdsk->rdsk_disk = blk_alloc_disk(NUMA_NO_NODE);
 #else
 	disk = rdsk->rdsk_disk = alloc_disk(1);
 #endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+	if (IS_ERR(disk))
+#else
 	if (!disk)
+#endif
 		goto out_free_queue;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
 	blk_queue_logical_block_size(disk->queue, BYTES_PER_SECTOR);
-- 
2.39.5

