FomalhautWeisszwerg / rtl8822bu

RTL8822BU Wireless Driver for Linux >= 4.12
GNU General Public License v2.0
34 stars 12 forks source link

Building fails with "ioctl_cfg80211.c:6165:25: error: initialization from incompatible pointer type" #5

Closed FomalhautWeisszwerg closed 6 years ago

FomalhautWeisszwerg commented 6 years ago

Found at [b2d79d1610f5a19c8c7ca873e4d04f7e7bec2fed]

OS

$ uname -a
Linux debian-server 4.13.0-1-amd64 #1 SMP Debian 4.13.10-1 (2017-10-30) x86_64 GNU/Linux

Compiler

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 7.2.0-12' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.2.1 20171025 (Debian 7.2.0-12)

Log

$ git show
commit b2d79d1610f5a19c8c7ca873e4d04f7e7bec2fed (HEAD -> chase_to_linux-4.12, origin/chase_to_linux-4.12)
Author: Fomalhaut Weisszwerg <weisszwerg@gmail.com>
Date:   Sun Nov 5 05:44:38 2017 +0900

    Adapt `rtw_cfg80211_preinit_wiphy()` to Linux kernel [ca986ad9bcd3893c8b0b4cc2cafcc8cf1554409c].

diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c
index e2a4032..d867801 100644
--- a/os_dep/linux/ioctl_cfg80211.c
+++ b/os_dep/linux/ioctl_cfg80211.c
@@ -6120,7 +6120,10 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) {
        /* wiphy->flags |= WIPHY_FLAG_OFFCHAN_TX | WIPHY_FLAG_HAVE_AP_SME; */
 #endif

-#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
+#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0))
+       /* Later kernel 4.12, concurrently multiple scheduled scan is default.
+        * See https://github.com/torvalds/linux/commit/ca986ad9bcd3893c8b0b4cc2cafcc8cf1554409c
+        */
        wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
 #ifdef CONFIG_PNO_SUPPORT
        wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT;
$ make
make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/4.13.0-1-amd64/build M=/home/working/rtl8822bu modules
make[1]: Entering directory '/usr/src/linux-headers-4.13.0-1-amd64'
  CC [M]  /home/working/rtl8822bu/core/rtw_cmd.o
  CC [M]  /home/working/rtl8822bu/core/rtw_security.o
  CC [M]  /home/working/rtl8822bu/core/rtw_debug.o
  CC [M]  /home/working/rtl8822bu/core/rtw_io.o
  CC [M]  /home/working/rtl8822bu/core/rtw_ioctl_query.o
  CC [M]  /home/working/rtl8822bu/core/rtw_ioctl_set.o
  CC [M]  /home/working/rtl8822bu/core/rtw_ieee80211.o
  CC [M]  /home/working/rtl8822bu/core/rtw_mlme.o
  CC [M]  /home/working/rtl8822bu/core/rtw_mlme_ext.o
  CC [M]  /home/working/rtl8822bu/core/rtw_mi.o
  CC [M]  /home/working/rtl8822bu/core/rtw_wlan_util.o
  CC [M]  /home/working/rtl8822bu/core/rtw_vht.o
  CC [M]  /home/working/rtl8822bu/core/rtw_pwrctrl.o
  CC [M]  /home/working/rtl8822bu/core/rtw_rf.o
  CC [M]  /home/working/rtl8822bu/core/rtw_recv.o
  CC [M]  /home/working/rtl8822bu/core/rtw_sta_mgt.o
  CC [M]  /home/working/rtl8822bu/core/rtw_ap.o
  CC [M]  /home/working/rtl8822bu/core/rtw_xmit.o
  CC [M]  /home/working/rtl8822bu/core/rtw_p2p.o
  CC [M]  /home/working/rtl8822bu/core/rtw_tdls.o
  CC [M]  /home/working/rtl8822bu/core/rtw_br_ext.o
  CC [M]  /home/working/rtl8822bu/core/rtw_iol.o
  CC [M]  /home/working/rtl8822bu/core/rtw_sreset.o
  CC [M]  /home/working/rtl8822bu/core/rtw_btcoex.o
  CC [M]  /home/working/rtl8822bu/core/rtw_beamforming.o
  CC [M]  /home/working/rtl8822bu/core/rtw_odm.o
  CC [M]  /home/working/rtl8822bu/core/efuse/rtw_efuse.o
  CC [M]  /home/working/rtl8822bu/os_dep/osdep_service.o
  CC [M]  /home/working/rtl8822bu/os_dep/linux/os_intfs.o
  CC [M]  /home/working/rtl8822bu/os_dep/linux/usb_intf.o
  CC [M]  /home/working/rtl8822bu/os_dep/linux/usb_ops_linux.o
  CC [M]  /home/working/rtl8822bu/os_dep/linux/ioctl_linux.o
  CC [M]  /home/working/rtl8822bu/os_dep/linux/xmit_linux.o
  CC [M]  /home/working/rtl8822bu/os_dep/linux/mlme_linux.o
  CC [M]  /home/working/rtl8822bu/os_dep/linux/recv_linux.o
  CC [M]  /home/working/rtl8822bu/os_dep/linux/ioctl_cfg80211.o
/home/working/rtl8822bu/os_dep/linux/ioctl_cfg80211.c: In function ‘rtw_cfg80211_indicate_connect’:
/home/working/rtl8822bu/os_dep/linux/ioctl_cfg80211.c:755:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   struct cfg80211_roam_info roam_info;
   ^~~~~~
/home/working/rtl8822bu/os_dep/linux/ioctl_cfg80211.c: At top level:
/home/working/rtl8822bu/os_dep/linux/ioctl_cfg80211.c:6165:25: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
  .change_virtual_intf = cfg80211_rtw_change_iface,
                         ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/working/rtl8822bu/os_dep/linux/ioctl_cfg80211.c:6165:25: note: (near initialization for ‘rtw_cfg80211_ops.change_virtual_intf’)
/home/working/rtl8822bu/os_dep/linux/ioctl_cfg80211.c:6188:22: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
  .add_virtual_intf = cfg80211_rtw_add_virtual_intf,
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/working/rtl8822bu/os_dep/linux/ioctl_cfg80211.c:6188:22: note: (near initialization for ‘rtw_cfg80211_ops.add_virtual_intf’)
cc1: some warnings being treated as errors
/usr/src/linux-headers-4.13.0-1-common/scripts/Makefile.build:307: recipe for target '/home/working/rtl8822bu/os_dep/linux/ioctl_cfg80211.o' failed
make[4]: *** [/home/working/rtl8822bu/os_dep/linux/ioctl_cfg80211.o] Error 1
/usr/src/linux-headers-4.13.0-1-common/Makefile:1529: recipe for target '_module_/home/working/rtl8822bu' failed
make[3]: *** [_module_/home/working/rtl8822bu] Error 2
Makefile:145: recipe for target 'sub-make' failed
make[2]: *** [sub-make] Error 2
Makefile:8: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.13.0-1-amd64'
Makefile:1318: recipe for target 'modules' failed
make: *** [modules] Error 2
FomalhautWeisszwerg commented 6 years ago

The signature of change_virtual_intf() was changed at Linux kernel 4.13. u32 flags not exist. https://www.kernel.org/doc/html/v4.13/driver-api/80211/cfg80211.html#c.cfg80211_ops

FomalhautWeisszwerg commented 6 years ago

Linux kernel commit [818a986e4ebacea2020622e48c8bc04b7f500d89]. https://github.com/torvalds/linux/commit/818a986e4ebacea2020622e48c8bc04b7f500d89

u32 *flags has been removed.

FomalhautWeisszwerg commented 6 years ago

commit 53fe19cee2f4cf183092e2afacb82776734bae16

Fixed.