Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ecf0ed9

Browse files
authored
Merge pull request #349 from visitorckw/fix-owner-setting
Fix incorrect conditional usage of .owner
2 parents 5aabe58 + f798488 commit ecf0ed9

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

‎examples/dht11.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,10 @@ static ssize_t device_read(struct file *filp, char __user *buffer,
148148
}
149149

150150
static struct file_operations fops = {
151-
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
152151
.owner = THIS_MODULE,
153-
#endif
154152
.open = device_open,
155153
.release = device_release,
156-
.read = device_read
154+
.read = device_read,
157155
};
158156

159157
/* Initialize the module - Register the character device */
@@ -182,9 +180,7 @@ static int __init dht11_init(void)
182180
MINOR(dht11_device.dev_num));
183181

184182
/* Prevents module unloading while operations are in use */
185-
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
186183
dht11_device.cdev.owner = THIS_MODULE;
187-
#endif
188184

189185
cdev_init(&dht11_device.cdev, &fops);
190186
ret = cdev_add(&dht11_device.cdev, dht11_device.dev_num, 1);

‎examples/ioctl.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,7 @@ static int test_ioctl_open(struct inode *inode, struct file *filp)
140140
}
141141

142142
static struct file_operations fops = {
143-
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
144143
.owner = THIS_MODULE,
145-
#endif
146144
.open = test_ioctl_open,
147145
.release = test_ioctl_close,
148146
.read = test_ioctl_read,

‎examples/static_key.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ static struct class *cls;
4141
static DEFINE_STATIC_KEY_FALSE(fkey);
4242

4343
static struct file_operations chardev_fops = {
44-
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
4544
.owner = THIS_MODULE,
46-
#endif
4745
.open = device_open,
4846
.release = device_release,
4947
.read = device_read,

‎examples/vinput.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ static ssize_t vinput_write(struct file *file, const char __user *buffer,
133133
}
134134

135135
static const struct file_operations vinput_fops = {
136-
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
137136
.owner = THIS_MODULE,
138-
#endif
139137
.open = vinput_open,
140138
.release = vinput_release,
141139
.read = vinput_read,
@@ -337,6 +335,9 @@ ATTRIBUTE_GROUPS(vinput_class);
337335

338336
static struct class vinput_class = {
339337
.name = "vinput",
338+
/* .owner was removed in Linux v6.4 via upstream commit 6e30a66433af ("driver core: class: remove
339+
* struct module owner out of struct class")
340+
*/
340341
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
341342
.owner = THIS_MODULE,
342343
#endif

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /