Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error: passing argument 1 of class_create #29

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

chanharabomber
Copy link

@chanharabomber chanharabomber commented Jul 30, 2024

Fix the following error caused by the diff of kernel version.

make[1]: ディレクトリ '/usr/src/linux-headers-6.5.0-44-generic' に入ります
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
  You are using:           gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
  CC [M]  PX4_driver/px4_drv/driver/ptx_chrdev.o
In file included from ./include/linux/linkage.h:7,
                 from ./include/linux/preempt.h:10,
                 from ./include/linux/spinlock.h:56,
                 from ./include/linux/kref.h:16,
                 from PX4_driver/px4_drv/driver/ptx_chrdev.h:13,
                 from PX4_driver/px4_drv/driver/ptx_chrdev.c:9:
px4_drv/driver/ptx_chrdev.c: In function ‘ptx_chrdev_context_create’:
./include/linux/export.h:29:22: error: passing argument 1 of ‘class_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   29 | #define THIS_MODULE (&__this_module)
      |                     ~^~~~~~~~~~~~~~~
      |                      |
      |                      struct module *
px4_drv/driver/ptx_chrdev.c:573:35: note: in expansion of macro ‘THIS_MODULE’
  573 |         ctx->class = class_create(THIS_MODULE, name);
      |                                   ^~~~~~~~~~~
In file included from ./include/linux/device.h:31,
                 from ./include/linux/cdev.h:8,
                 from DTV_folder/PX4_driver/px4_drv/driver/ptx_chrdev.h:16:
./include/linux/device/class.h:230:54: note: expected ‘const char *’ but argument is of type ‘struct module *’
  230 | struct class * __must_check class_create(const char *name);
      |                                          ~~~~~~~~~~~~^~~~
PX4_driver/px4_drv/driver/ptx_chrdev.c:573:22: error: too many arguments to function ‘class_create’
  573 |         ctx->class = class_create(THIS_MODULE, name);
      |                      ^~~~~~~~~~~~
./include/linux/device/class.h:230:29: note: declared here
  230 | struct class * __must_check class_create(const char *name);
      |                             ^~~~~~~~~~~~
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:251: PX4_driver/px4_drv/driver/ptx_chrdev.o] エラー 1
make[2]: *** [/usr/src/linux-headers-6.5.0-44-generic/Makefile:2039: DTV_folder/PX4_driver/px4_drv/driver] エラー 2
make[1]: *** [Makefile:234: __sub-make] エラー 2
make[1]: ディレクトリ '/usr/src/linux-headers-6.5.0-44-generic' から出ます
make: *** [Makefile:19: px4_drv.ko] エラー 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant