From faac0a19647a89be23a7ce9a4c03318bd1588802 Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Fri, 28 Apr 2023 13:46:48 +0300 Subject: [PATCH] scst: Port to Linux kernel v6.4 Support for the following driver core changes in the Linux kernel v6.4: - 1aaba11da9aa ("driver core: class: remove module * from class_create()") - 2243acd50ac4 ("driver core: class: remove struct class_interface * from callbacks") --- iscsi-scst/kernel/isert-scst/isert_login.c | 4 ++++ scst/src/dev_handlers/scst_user.c | 5 ++++- scst/src/scst_event.c | 4 ++++ scst/src/scst_main.c | 8 ++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/iscsi-scst/kernel/isert-scst/isert_login.c b/iscsi-scst/kernel/isert-scst/isert_login.c index 43abc5ad8..cd6d2380b 100644 --- a/iscsi-scst/kernel/isert-scst/isert_login.c +++ b/iscsi-scst/kernel/isert-scst/isert_login.c @@ -1000,7 +1000,11 @@ int __init isert_init_login_devs(unsigned int ndevs) goto fail; /* Make this more graceful */ } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0) isert_class = class_create(THIS_MODULE, "isert_scst"); +#else + isert_class = class_create("isert_scst"); +#endif isert_setup_listener_cdev(&isert_listen_dev); diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index 0ceb8d275..b995f85a0 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -4154,8 +4154,11 @@ static int __init init_scst_user(void) if (res < 0) goto out_cache; - +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0) dev_user_sysfs_class = class_create(THIS_MODULE, DEV_USER_NAME); +#else + dev_user_sysfs_class = class_create(DEV_USER_NAME); +#endif if (IS_ERR(dev_user_sysfs_class)) { PRINT_ERROR("%s", "Unable create sysfs class for SCST user " "space handler"); diff --git a/scst/src/scst_event.c b/scst/src/scst_event.c index 0194a57be..593548ec1 100644 --- a/scst/src/scst_event.c +++ b/scst/src/scst_event.c @@ -1118,7 +1118,11 @@ int scst_event_init(void) goto out; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0) scst_event_sysfs_class = class_create(THIS_MODULE, SCST_EVENT_NAME); +#else + scst_event_sysfs_class = class_create(SCST_EVENT_NAME); +#endif if (IS_ERR(scst_event_sysfs_class)) { PRINT_ERROR("Unable create sysfs class for SCST event"); res = PTR_ERR(scst_event_sysfs_class); diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 2fdb9d8bd..564488d74 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -2139,7 +2139,11 @@ unsigned int scst_get_setup_id(void) } EXPORT_SYMBOL_GPL(scst_get_setup_id); +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0) static int scst_add(struct device *cdev, struct class_interface *intf) +#else +static int scst_add(struct device *cdev) +#endif { struct scsi_device *scsidp; int res = 0; @@ -2156,7 +2160,11 @@ static int scst_add(struct device *cdev, struct class_interface *intf) return res; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0) static void scst_remove(struct device *cdev, struct class_interface *intf) +#else +static void scst_remove(struct device *cdev) +#endif { struct scsi_device *scsidp;