lwfinger / rtl8723bu

Driver for RTL8723BU
283 stars 143 forks source link

ERROR: "__divdi3" [drivers/staging/rtl8723bu/8723bu.ko] undefined! #119

Closed maurossi closed 5 years ago

maurossi commented 5 years ago

With kernel 4.20 the 32 bit builds show the error.

Here is one possible way to solve it, which has been tested for 32 bit building, please also check LINUX_VERSION_CODE version in kernel 4.20 related commit, all checks should be against KERNEL_VERSION(4, 20, 0) and not KERNEL_VERSION(4, 19, 0)

Mauro

diff --git a/drivers/staging/rtl8723bu/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bu/os_dep/ioctl_cfg80211.c
index 79962398b01e..50f8f3c1d3fc 100644
--- a/drivers/staging/rtl8723bu/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bu/os_dep/ioctl_cfg80211.c
@@ -356,7 +356,7 @@ static u64 rtw_get_systime_us(void)
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0))
    ktime_t ts;
    ts = ktime_get_boottime();
-   return ts / 1000;
+   return do_div(ts, 1000);
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
    struct timespec ts;
    get_monotonic_boottime(&ts);
lwfinger commented 5 years ago

Thanks for the update. I just push the "do_div" fix.

I'm a little confused about the kernel 4,19 comment. As far as I know, all the references are already correct.

maurossi commented 5 years ago

The comment is related to check if KERNEL_VERSION(4, 19, 0) was really necessary to fix build errors, or for functional needs, and was not used during the merge window of 4.20, but just a check as I don't know the details. In my building tests on 4.20rc1 using always KERNEL_VERSION(4, 20, 0), instead of a mix of 4.19 and 4.20, was ok.

lwfinger commented 5 years ago

The two instances where the test is for 4.19 are required. The driver would build on 4.20 with either 4.19 or 4.20, but using 4.20 would break a 4.19 build.

maurossi commented 5 years ago

Il giorno mar 6 nov 2018, 15:26 lwfinger notifications@github.com ha scritto:

The two instances where the test is for 4.19 are required. The driver would build on 4.20 with either 4.19 or 4.20, but using 4.20 would break a 4.19 build.

I was mentioning this because I did not see any build breaks in kernel 4.18 and 4.19 and 8723.ko module was always built, so are you referring to some functional issue that required to set 4.19 version conditionals?

You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lwfinger/rtl8723bu/issues/119#issuecomment-436270339, or mute the thread https://github.com/notifications/unsubscribe-auth/AH9VlOUffafVvi7p-9aCPW7OBBNAkEKfks5usZwIgaJpZM4YPhY6 .

lwfinger commented 5 years ago

Yes, those conditionals indicate the point at which some kernel API changed. With such changes, the author is required to fix all the in-kernel drivers, but out-of-kernel versions must be fixed by the external maintainer. To keep compatibility between current and older kernels, those macros that test the version must be used.

maurossi commented 5 years ago

Hi, it is clear, but you still did not answered to the question.

Please let me rephrase it, because maybe not being native language I was not clear

I built the rtl8723bu as per your repo with in the whole cycle of kernel 4.19 without any build error, whithout any the patch for new kernel. (this info was missing)

The in the patch for new kernel you used < 4.19 (strictly <) for the AS-IS code pre-4.19 kernel code, meaning applicable to 4.18, but since I saw no build error w/o your patch and you mentioned "necessary to solve build errors" (which I did not see in any of 4.19rc and 4.19 final kernel)

why did you use < 4.19 conditional if there was no building error with 4.19 (and so using < 4.20 instead of < 4.19 was ok)? Mauro

On Wed, Nov 7, 2018 at 2:45 AM lwfinger notifications@github.com wrote:

Yes, those conditionals indicate the point at which some kernel API changed. With such changes, the author is required to fix all the in-kernel drivers, but out-of-kernel versions must be fixed by the external maintainer. To keep compatibility between current and older kernels, those macros that test the version must be used.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lwfinger/rtl8723bu/issues/119#issuecomment-436473860, or mute the thread https://github.com/notifications/unsubscribe-auth/AH9VlAJIjva0m3U0i-j8d53yidBI1USbks5usjtJgaJpZM4YPhY6 .

lwfinger commented 5 years ago

Did you use my repo? If so, the API changes for 4.19 were added when 4.19 was in the -rc stage. I try to keep my GitHub driver ready for early adopters of new kernels.