Build errors for SierraLinuxQMIdrivers on Ubuntu-20.04 (focal)

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 #ifdefs :woman_facepalming: :man_facepalming:

Regards,
Samveen

Is there any traction on this? I would love to get the 4G connection on my laptop working against the latest Ubuntu release kernels, instead of rebooting back to an older kernel when requiring 4G connectivity.

In hindsight, the title should have been Build Errors for SierraLinuxQMIDrivers against Kernel 5.4.0 and later, as this is not just an Ubuntu specific issue, but an issue caused by a kernel interface change.

Hi @samveen

The same issue with Linux QMI Driver S2.42N2.62 on Linux kernel 5.4.0-42 at my side. It is known issue. This issue will be resolved in a future release of the Linux QMI Driver.

Please help to tick “Solution” if your question is answered.

@Donald

The release notes say that the driver is updated to work all the way up to Kernel 5.6, which is why I was disappointed to find the issue. I tried to see if I could fix it with some trivial code, but the change is such that a trivial fix from someone not familiar with the inner workings of the device will definitely work.

Hi @samveen

It is a regression issue. This issue has been reported to the development team before. It will be resolved in a future release of the Linux QMI Driver.

According to Linux QMI Drivers - Customer Release Notes 1.44.pdf
https://source.sierrawireless.com/resources/airprime/software/release_notes/usb-drivers-linux-qmi-release-note-1,-d-,44/#sthash.M2W4aDB5.dpbs
2.2. SierraLinuxQMIdriversS2.42N2.62
2.2.1. Network Driver Changes
Compilation error on kernel v5.6

Please help to tick “Solution” if your question is answered.

1 Like