# Problems compiling Linux QMI drivers on new kernels

**URL:** <https://forum.sierrawireless.com/t/problems-compiling-linux-qmi-drivers-on-new-kernels/8893>\
**Category:** Open AT\
**Created:** [November 3, 2016, 9:18pm UTC](https://forum.sierrawireless.com/t/problems-compiling-linux-qmi-drivers-on-new-kernels/8893 "2016-11-03T21:18:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mleinart](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@mleinart](https://forum.sierrawireless.com/u/mleinart)\
**Post date:** [November 3, 2016, 9:18pm UTC](https://forum.sierrawireless.com/t/problems-compiling-linux-qmi-drivers-on-new-kernels/8893/1 "2016-11-03T21:18:07Z")

</div>

Hello, just thought I’d share that I ran into some errors compiling the linux QMI kernel modules (version S2.25N2.38 found at [source.sierrawireless.com/resour … n2,-d-,38/](http://source.sierrawireless.com/resources/airprime/software/usb-drivers-linux-qmi-software-s2,-d-,25n2,-d-,38/)) on Linux kernel 4.8.6 with gcc 6.2.1.

Here are the errors I get:  
With GobiSerial

```auto
/usr/src/S2.26N2.38/GobiSerial/GobiSerial.c:325:14: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
        .resume = usb_serial_generic_resume,
                  ^ ~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/src/S2.26N2.38/GobiSerial/GobiSerial.c:325:14: note: (near initialization for ‘GobiDriver.resume’)
    /usr/src/S2.26N2.38/GobiSerial/GobiSerial.c:326:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
        .reset_resume = usb_serial_generic_resume,
                         ^ ~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/src/S2.26N2.38/GobiSerial/GobiSerial.c:326:20: note: (near initialization for ‘GobiDriver.reset_resume’)
    cc1: some warnings being treated as errors
    make[2]: *** [scripts/Makefile.build:296: /usr/src/S2.26N2.38/GobiSerial/GobiSerial.o] Error 1
    make[1]: *** [Makefile:1471: _module_/usr/src/S2.26N2.38/GobiSerial] Error 2
    make[1]: Leaving directory '/usr/lib/modules/4.8.6-1-ARCH/build'
    make: *** [Makefile:16: all] Error 2
```

With GobiNet:

```auto
/usr/src/S2.26N2.38/GobiNet/GobiUSBNet.c: In function ‘GobiUSBNetStartXmit’:
    /usr/src/S2.26N2.38/GobiNet/GobiUSBNet.c:1329:8: error: ‘struct net_device’ has no member named ‘trans_start’; did you mean mem_start’?
        pNet->trans_start = jiffies;
            ^~
    make[2]: *** [scripts/Makefile.build:290: /usr/src/S2.26N2.38/GobiNet/GobiUSBNet.o] Error 1
    make[1]: *** [Makefile:1471: _module_/usr/src/S2.26N2.38/GobiNet] Error 2
    make[1]: Leaving directory '/usr/lib/modules/4.8.6-1-ARCH/build'
    make: *** [Makefile:37: all] Error 2
```

The following patch fixes these issues:

```auto
--- GobiSerial/GobiSerial.c.orig 2016-09-28 09:42:27.000000000 +0000
+++ GobiSerial/GobiSerial.c 2016-11-03 21:00:47.760637058 +0000
@@ -322,8 +322,7 @@
    .id_table = GobiVIDPIDTable,
 #ifdef CONFIG_PM
    .suspend = usb_serial_suspend,
- .resume = usb_serial_generic_resume,
- .reset_resume = usb_serial_generic_resume,
+ .resume = usb_serial_resume,
    .supports_autosuspend = true,
 #else
    .suspend = NULL,
--- GobiNet/GobiUSBNet.c.orig 2016-09-28 09:42:27.000000000 +0000
+++ GobiNet/GobiUSBNet.c 2016-11-03 21:05:12.407319285 +0000
@@ -1326,7 +1326,11 @@
    complete( &pAutoPM->mThreadDoWork );

    // Start transfer timer
+#if LINUX_VERSION_CODE >= KERNEL_VERSION( 4,7,0)
+ netif_trans_update(pNet);
+#else
    pNet->trans_start = jiffies;
+#endif
    // Free SKB
    if (pSKB)
       dev_kfree_skb_any ( pSKB );
```

In GobiSerial.c, this drivers incorrectly assign usb\_serial\_generic\_resume to a struct usb\_driver.resume when it can only be assigned to a struct usb\_serial\_driver (and this drive provides one for that, see GobiUSBSerialResume()). Instead, the struct usb\_driver.resume should get usb\_serial\_resume from the generic usb-serial driver which does the delegation to the function passed into the struct usb\_serial\_driver.resume [1]. The struct usb\_driver.reset\_resume is removed as that’s added automatically by the kernel’s USB init code [2].

The problem with GobiUSBNet.c is due to an api change that went live in 4.7.0, documented here: [https://groups.google.com/forum/#!topic/linux.kernel/xmWuS0ALBtM](https://groups.google.com/forum/#!topic/linux.kernel/xmWuS0ALBtM)

1: [https://github.com/torvalds/linux/blob/master/drivers/usb/serial/usb-serial.c#L1164-L1179](https://github.com/torvalds/linux/blob/master/drivers/usb/serial/usb-serial.c#L1164-L1179)  
2: [https://github.com/torvalds/linux/blob/master/drivers/usb/serial/usb-serial.c#L1427-L1433](https://github.com/torvalds/linux/blob/master/drivers/usb/serial/usb-serial.c#L1427-L1433)

---

<div class="post-metadata">

**Author:** ![mleinart](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@mleinart](https://forum.sierrawireless.com/u/mleinart)\
**Post date:** [November 3, 2016, 9:23pm UTC](https://forum.sierrawireless.com/t/problems-compiling-linux-qmi-drivers-on-new-kernels/8893/2 "2016-11-03T21:23:34Z")

</div>

Also note: the “Latest Version” of these drivers ([source.sierrawireless.com/resour … n2,-d-,36/](http://source.sierrawireless.com/resources/airprime/software/usb-drivers-linux-qmi-software-s2,-d-,25n2,-d-,36/)) is the previous version. The Latest version links need to be updated to S2.25N2.38
