lwfinger / rtl8723bu

Driver for RTL8723BU
283 stars 143 forks source link

Warning: comparison of distinct pointer types lacks a cast #187

Closed simgar closed 2 years ago

simgar commented 2 years ago

Saw an error when putting your driver on my Raspberry Pi. I'm a total newbie when it comes to Linux kernel driver installations so please forgive any nonsense from me.

I'm running this on a basic installation with no GUI. When I saw the error I wasn't sure how to capture it. I wasn't sure if it was logged anywhere, so I took a photo of it. The text below is from OCR, tidied up by me. I think it's correct.

In file included from ./arch/arm/include/asm/div64.h:127,
                 from ./include/linux/kernel.h:19,
                 from ./include/linux/list.h:9,
                 from ./include/linux/rculist.h:10,
                 from ./include/linux/sched/signal.h:5,
                 from /home/pi/drivers/rtl8723bu_wifi/rtl8723bu/include/osdep_service.h:38,
                 from /home/pi/drivers/rtl8723bu_wifi/rtl8723bu/include/drv_types.h:32.
                 from /home/pi/drivers/rtl8723bu_wifi/rtl8723bu/os_dep/ioctl_cfg80211.c:22:
/home/pi/drivers/rtl8723bu_wifi/rtl8723bu/os_dep/ioctl_cfg80211.c: In function ■rtw_get_systime_us■:
./include/asm-generic/div64.h:226:28: warning: comparison of distinct pointer types lacks a cast
  226 |  (void)(((typeof((n)) *)0) == ((uint64_t *)0)): \
      |                             ^~
/home/pi/drivers/rtl8723bu_wifi/rtl8723bu/os_dep/ioctl_cfg80211.c:359:9: note: in expansion of macro ■do _div■
  359 |  return do_div(ts, 1000);
      |         ^~~~~~

The driver did install and appears to be working but the Pi's not been doing anything testing so far.

I was following the instructions from here but I used a deeper folder structure: https://raspmer.blogspot.com/2018/07/mantistek-wa150-wifibluetooth-rtl8723bu.html

$ sudo apt-get install raspberrypi-kernel-headers git build-essential

Create directory for build source and download source code

$ mkdir drivers
$ cd drivers
$ mkdir rtl8723bu_wifi
$ cd rtl8723bu_wifi

Install RTL8723BU WIFI Driver

$ git clone https://github.com/lwfinger/rtl8723bu.git
$ cd rtl8723bu

Disable Concurrent Mode $ sed -i "s/^EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE/#EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE/g" Makefile

Build and Install

$ make
$ sudo make install

Disable power save $ echo "options 8723bu rtw_power_mgnt=0 rtw_enusbss=0" | sudo tee /etc/modprobe.d/8723bu.conf

Version: Raspbian GNU/Linux 11 (bullseye)

lwfinger commented 2 years ago

Warnings are very distinct from errors. In general, the code will work correctly with most warnings.

The warning appears because do_div() returns a 32-bit quantity, but the routine in question is u64. The compiler will do the sign extension with no problems. When I get time I will fix and test the change, but I do not have time now.