While trying to build the SierraLinuxQMIdrivers version S2.42N2.62
against the linux kernel 5.4.0-39 from Ubuntu 20.04 Focal Fossa, I came across the following error in the build:
/MC7710/GobiNet/GobiUSBNet.c: In function ‘GobiUSBNetProbe’:
/MC7710/GobiNet/GobiUSBNet.c:3263:35: error: passing argument 1 of ‘wakeup_source_register’ from incompatible pointer type [-Werror=incompatible-pointer-types]
3263 | ws = wakeup_source_register(szWakeSourceName);
| ^~~~~~~~~~~~~~~~
| |
| char *
In file included from ./include/linux/device.h:1337,
from ./include/linux/dma-mapping.h:7,
from ./include/linux/skbuff.h:31,
from ./include/linux/if_ether.h:19,
from ./include/linux/etherdevice.h:20,
from /MC7710/GobiNet/Structs.h:75,
from /MC7710/GobiNet/GobiUSBNet.c:86:
./include/linux/pm_wakeup.h:92:30: note: expected ‘struct device *’ but argument is of type ‘char *’
92 | extern struct wakeup_source *wakeup_source_register(struct device *dev,
| ^~~~~~~~~~~~~~~~~~~~~~
/MC7710/GobiNet/GobiUSBNet.c:3263:12: error: too few arguments to function ‘wakeup_source_register’
3263 | ws = wakeup_source_register(szWakeSourceName);
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/device.h:1337,
from ./include/linux/dma-mapping.h:7,
from ./include/linux/skbuff.h:31,
from ./include/linux/if_ether.h:19,
from ./include/linux/etherdevice.h:20,
from /MC7710/GobiNet/Structs.h:75,
from /MC7710/GobiNet/GobiUSBNet.c:86:
./include/linux/pm_wakeup.h:92:30: note: declared here
92 | extern struct wakeup_source *wakeup_source_register(struct device *dev,
| ^~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:275: /MC7710/GobiNet/GobiUSBNet.o] Error 1
make[1]: *** [Makefile:1719: /MC7710/GobiNet] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-39-generic'
make: *** [Makefile:50: all] Error 2
The reason for the error seems pretty cut and dry (interface change in the Linux kernel) , but I have been known to make many many mistakes. The offending commit that introduced this change is
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/linux/pm_wakeup.h?h=v5.4&id=c8377adfa78103be5380200eb9dab764d7ca890e
EDIT 1
The error comes from a line that is inside an #ifdef CONFIG_ANDROID
. So I added the following at the beginning of the source file:
#ifdef CONFIG_ANDROID
#warning CONFIG_ANDROID is defined! This may not be android
#endif
The warning triggered on compile, despite this not being an Android build. However digging deeper into the kernel config for the ubuntu kernels, I found that this is always set to yes: CONFIG_ANDROID=y
.
The code will definitely need another set of #ifdef
s
Regards,
Samveen