Skip to content

Commit b61aac4

Browse files
committed
Align version check with chardev.c
The patch reverses the order of the version check for class_create().Using the condition ">=" aligns the logic with the definition in chardev.c, improving code consistency and readability.
1 parent 9ca7790 commit b61aac4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/static_key.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ static int __init chardev_init(void)
6060

6161
pr_info("I was assigned major number %d\n", major);
6262

63-
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
64-
cls = class_create(THIS_MODULE, DEVICE_NAME);
65-
#else
63+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
6664
cls = class_create(DEVICE_NAME);
65+
#else
66+
cls = class_create(THIS_MODULE, DEVICE_NAME);
6767
#endif
6868

6969
device_create(cls, NULL, MKDEV(major, 0), NULL, DEVICE_NAME);

0 commit comments

Comments
 (0)