Merge pull request #304 from EricccTaiwan/master

Drop .owner for kernel >= 6.4
This commit is contained in:
Jim Huang 2025-04-18 13:53:12 +08:00 committed by GitHub
commit 7f4bca9ad5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -81,7 +81,9 @@ static ssize_t device_write(struct file *file, const char __user *buffer,
}
static struct file_operations fops = {
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
.owner = THIS_MODULE,
#endif
.write = device_write,
.open = device_open,
.release = device_release,
@ -112,7 +114,9 @@ static int __init led_init(void)
MINOR(led_device.dev_num));
/* Prevents module unloading while operations are in use */
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
led_device.cdev.owner = THIS_MODULE;
#endif
cdev_init(&led_device.cdev, &fops);
ret = cdev_add(&led_device.cdev, led_device.dev_num, 1);