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 compile issues with Linux 6.3 #368

Merged
merged 9 commits into from
Jun 13, 2023
Merged

Conversation

jigpu
Copy link
Member

@jigpu jigpu commented Jun 8, 2023

This set of commits address the problems with building input-wacom on the Linux 6.3 kernel. In addition, it updates the Github actions to add version 6.3 to the test matrix. Some background work is required for each of these tasks, e.g. adding new checks to configure.ac, having wacom_i2c.c use our config.h header, and modifying the cflags / makeflags used in the Github build. This is why the list of commits is more than just a quick two or three changes.

jigpu added 7 commits June 7, 2023 21:29
Attempts to build test code seem to all fail because MODULE_LICENSE
isn't defined. This can cause the build process to behave incorrectly
since it may wrongly believe a feature is not available when it really
is.

Adding MODULE_LICENSE("GPL") to the body of the test code causes the
configure-time checks to start working properly again. We can use the
"GPL" identifier here since our code is, indeed, GPL.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
The WACOM_DEVM_OR_RESET macro was introduced in a previous commit to fix
compilation of the 3.17 sources on RHEL 7.9. We might as well use this
macro in the 4.5 sources as well to make the two codebases more similar.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
…e time

Linux 4.14 introduced the hid_is_using_ll_driver function which allows
drivers to check which bus type a device is using. Later on, hid_is_usb
was introduced in Linux 5.15. Finally, in Linux 6.3, hid_is_using_ll_driver
was removed. This removal breaks our 4.5 codebase, however, since its
ifdef was never updated to use the new function.

This commit adds configure-time checks for hid_is_using_ll_driver and
hid_is_usb. Depending on the outcome of those checks, we use either the
best function or our own internal definition for pre-4.14 compatibility.

Fixes: linuxwacom#367
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Allow the I2C driver to get conditional compile macros that were defined
at configure time.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Commit 0a3098db138c ("Input: wacom_i2c - Convert to i2c's .probe_new()")
upstream updated the driver to make use of a modernized API that was
introduced in Linux 4.10. The "probe_new" function that was introduced
to make the API migration easier was eventually renamed to just "probe"
in Linux 6.3 -- breaking out-of-tree drivers that had not yet updated.

This commit checks to see if the modern version of the API is required
or not. If it is, we modify the function signature to allow it to work
properly.

Fixes: linuxwacom#367
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
The Linux kernel has had a somewhat-flexible dependency on headers
provided by the libelf-dev package for a while. As long as we compiled
with the options `-fno-pie -no-pie`, however, the build would succeed.
Unfortunately, newer kernels don't like it when we manually specify
those options. They now complain that some parts of the code *must*
be compiled with PIE... Before we're able to add these newer kernels
to the test matrix, we must get ourselves out of this jam...

The solution that this commit implements is to only set those options
on the older kernels that actually require it. Around the time of Linux
4.9, the kernel updated its own makefile to add these options when
required. Only setting these flags when required prevents the problems
from cropping up.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Ensure that the driver still compiles properly after the breaking changes
introduced in Linux 6.3.

Fixes: linuxwacom#367
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
jigpu added 2 commits June 8, 2023 10:59
It can be useful to pass additional flags to sub-make run in the kernel's
source tree. For example, you might want to adjust the warning levels or
modify some behavior of the kernel's Makefiles. To enable this ability,
when input-wacom is built with an EXTRA_MAKEFLAGS variable set, its
contents will be passed to the sub-make.

For example, to enable additional kernel warnings, you can now call the
input-wacom make as follows: `$ make W=123`

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
When running the main Github action with more recent kernels, the build
fails with a series of errors similar to the following:

~~~
WARNING: Module.symvers is missing.
         Modules may not have dependencies or modversions.
         You may get many unresolved symbol errors.
         You can set KBUILD_MODPOST_WARN=1 to turn errors into warning
         if you want to proceed at your own risk.
ERROR: modpost: "sprintf" [/home/runner/work/input-wacom/input-wacom/4.5/wacom.ko] undefined!
ERROR: modpost: "strscpy" [/home/runner/work/input-wacom/input-wacom/4.5/wacom.ko] undefined!
ERROR: modpost: "devm_led_trigger_register" [/home/runner/work/input-wacom/input-wacom/4.5/wacom.ko] undefined!
[...]
~~~

These errors seem to be a result of us building against a source tree
that was never itself built. Symbols like 'sprintf' which the kernel
binary would provide are not available, causing these messages. This
commit takes the advice given in the message, using a makefile flag to
transform these into non-fatal warnings.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
@Pinglinux
Copy link
Member

The patchset LGTM. Thank you @jigpu for your effort!

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.

None yet

2 participants