From d7524cd10f5fb3ff26e662a4ae4d52a9de285666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Frohm=C3=BCller?= Date: Sat, 20 Aug 2022 20:23:34 +0200 Subject: [PATCH] Fixes driver compilation in kernel version 5.15 and higher (thanks, piernov). --- src/driver/hddsuperclone_driver.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/driver/hddsuperclone_driver.c b/src/driver/hddsuperclone_driver.c index 939f18c..c68a47e 100644 --- a/src/driver/hddsuperclone_driver.c +++ b/src/driver/hddsuperclone_driver.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -22,6 +21,7 @@ #include #include #include +#include #include //This defines are available in blkdev.h from kernel 4.17 (vanilla). @@ -179,6 +179,7 @@ static int sg_version_num = 40000; static unsigned int working_queue = 0; static unsigned int request_queue = 0; static int queue_count = 0; +static struct lock_class_key hddsc_bio_compl_lkclass; @@ -1600,18 +1601,18 @@ static long process_ioctl(struct file *f, const unsigned cmd, const unsigned lon goto out; } - data_device.gd = alloc_disk(16); + data_device.gd = __alloc_disk_node(data_queue, NUMA_NO_NODE, &hddsc_bio_compl_lkclass); if (!data_device.gd) { goto out_unregister; } data_device.gd->major = data_major_num; + data_device.gd->minors = 16; data_device.gd->first_minor = 0; data_device.gd->fops = &data_operations; data_device.gd->private_data = &data_device; strcpy(data_device.gd->disk_name, data_device.device_name); set_capacity(data_device.gd, (data_device.size / KERNEL_SECTOR_SIZE)); - data_device.gd->queue = data_queue; add_disk(data_device.gd); data_drive_active = 0;