Skip to content

Commit

Permalink
Amend use of class_create() for kernels >= 6.4
Browse files Browse the repository at this point in the history
The function signature for `class_create()` was changed in kernels >= 6.4.x to only accept a single argument (see kernel commit #dcfbb67).

This change will conditionally modify how `class_create()` is called depending on the kernel version.
  • Loading branch information
chrBrd authored and mbrooksx committed Aug 15, 2023
1 parent 97aeba5 commit 8aca235
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/gasket_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/platform_device.h>
#include <linux/printk.h>
#include <linux/sched.h>
#include <linux/version.h>

#ifdef GASKET_KERNEL_TRACE_SUPPORT
#define CREATE_TRACE_POINTS
Expand Down Expand Up @@ -1837,8 +1838,15 @@ int gasket_register_device(const struct gasket_driver_desc *driver_desc)
internal = &g_descs[desc_idx];
mutex_init(&internal->mutex);
memset(internal->devs, 0, sizeof(struct gasket_dev *) * GASKET_DEV_MAX);
internal->class =
class_create(driver_desc->module, driver_desc->name);

/* Function signature for `class_create()` is changed in kernel >= 6.4.x
* to only accept a single argument.
* */
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
internal->class = class_create(driver_desc->module, driver_desc->name);
#else
internal->class = class_create(driver_desc->name);
#endif

if (IS_ERR(internal->class)) {
pr_err("Cannot register %s class [ret=%ld]\n",
Expand Down

3 comments on commit 8aca235

@Dvalin21
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an expected time for this change to be pushed to https://packages.cloud.google.com/apt? Thanks

@robertzaage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dvalin21 I think the whole project is a bit abandoned. Maybe the Googlers who build these packages are more focused on pushing development of their cloud TPUs further or whatever. As everything here is OSS, I package and publish gasket myself for Fedora (https://copr.fedorainfracloud.org/coprs/robertzaage/gasket-dkms/) Maybe there is an equivalent build service for Debian-based distributions too?

@Dvalin21
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dvalin21 I think the whole project is a bit abandoned. Maybe the Googlers who build these packages are more focused on pushing development of their cloud TPUs further or whatever. As everything here is OSS, I package and publish gasket myself for Fedora (https://copr.fedorainfracloud.org/coprs/robertzaage/gasket-dkms/) Maybe there is an equivalent build service for Debian-based distributions too?

Thanks. I really hate to see it completely abandon like this.

Please sign in to comment.