Skip to content

Compiler error on Ubuntu 23, also added the solution #11

@kurdibogdan

Description

@kurdibogdan

When I try to run make command, I get an error:

... virtual_touchscreen/virtual_touchscreen.c: In function ‘virt_ts_init’:
./include/linux/init.h:184:22: error: passing argument 1 of ‘class_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
184 | #define THIS_MODULE (&__this_module)
| ~^~~~~~~~~~~~~~~
| |
| struct module *
... virtual_touchscreen.c:77:23: note: in expansion of macro ‘THIS_MODULE’
77 | cl = class_create(THIS_MODULE, DEVICE_NAME);
./include/linux/device/class.h:228:54: note: expected ‘const char *’ but argument is of type ‘struct module *’

I could solve this issue by removing the first argument of the class_create function so:
77 | cl = class_create(DEVICE_NAME);

And the make runs perfectly, creates the .ko file that I needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions