Skip to content

Commit 90bb27e

Browse files
committed
bbapi: make it compatible for Linux >= v6.4
Since v6.4 the signature of class_create() changed and the classname parameter was dropped. Signed-off-by: Patrick Bruenn <[email protected]>
1 parent b2c3813 commit 90bb27e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

simple_cdev.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <linux/fs.h>
99
#include <linux/module.h>
10+
#include <linux/version.h>
1011
#include "simple_cdev.h"
1112

1213
int simple_cdev_init(struct simple_cdev *dev, const char *classname,
@@ -25,7 +26,12 @@ int simple_cdev_init(struct simple_cdev *dev, const char *classname,
2526
goto rollback_region;
2627
}
2728

29+
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6,4,0))
2830
if ((dev->class = class_create(THIS_MODULE, classname)) == NULL) {
31+
#else
32+
(void)classname;
33+
if ((dev->class = class_create(devicename)) == NULL) {
34+
#endif
2935
pr_warn("class_create() failed!\n");
3036
goto rollback_cdev;
3137
}

0 commit comments

Comments
 (0)