Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Explicitly handle breaking changes in RHEL 9.4 backports
  • Loading branch information
cyqsimon committed Jun 20, 2024
1 parent 5815ee3 commit 4ef520b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/gasket_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1840,12 +1840,14 @@ int gasket_register_device(const struct gasket_driver_desc *driver_desc)
memset(internal->devs, 0, sizeof(struct gasket_dev *) * GASKET_DEV_MAX);

/* Function signature for `class_create()` is changed in kernel >= 6.4.x
* to only accept a single argument.
* to only accept a single argument. This change was also backported to
* RHEL 9.4, whose kernel is nominally versioned 5.14.0.
* */
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
internal->class = class_create(driver_desc->module, driver_desc->name);
#else
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0) || \
(defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 4))
internal->class = class_create(driver_desc->name);
#else
internal->class = class_create(driver_desc->module, driver_desc->name);
#endif

if (IS_ERR(internal->class)) {
Expand Down

0 comments on commit 4ef520b

Please sign in to comment.