diff -Nru rtl8821ce-5.5.2.1/debian/changelog rtl8821ce-5.5.2.1/debian/changelog --- rtl8821ce-5.5.2.1/debian/changelog 2020-07-24 05:46:53.000000000 +0000 +++ rtl8821ce-5.5.2.1/debian/changelog 2021-01-22 10:00:33.000000000 +0000 @@ -1,3 +1,12 @@ +rtl8821ce (5.5.2.1-0ubuntu4~20.04.3) focal; urgency=medium + + * FTBFS with Linux 5.10 (LP: #1911605) + - Blacklist built-in rtw88_8821ce + - Convert readFile()/writeFile() to use kernel_read()/write_file() and fix + FTBFS with Linux 5.10 + + -- You-Sheng Yang Fri, 22 Jan 2021 18:00:33 +0800 + rtl8821ce (5.5.2.1-0ubuntu4~20.04.2) focal; urgency=medium * Fix build against v5.8 kernel (LP: #1884648) diff -Nru rtl8821ce-5.5.2.1/debian/patches/0001-kernel_read-has-been-around-since-2.6.x-and-it-takes.patch rtl8821ce-5.5.2.1/debian/patches/0001-kernel_read-has-been-around-since-2.6.x-and-it-takes.patch --- rtl8821ce-5.5.2.1/debian/patches/0001-kernel_read-has-been-around-since-2.6.x-and-it-takes.patch 1970-01-01 00:00:00.000000000 +0000 +++ rtl8821ce-5.5.2.1/debian/patches/0001-kernel_read-has-been-around-since-2.6.x-and-it-takes.patch 2021-01-22 10:00:33.000000000 +0000 @@ -0,0 +1,84 @@ +From 0dbcd1e72ddbfc72ca01c867c214fbcb026591fa Mon Sep 17 00:00:00 2001 +From: Paolo Pisati +Date: Fri, 4 Dec 2020 12:07:37 +0000 +Subject: [PATCH 1/2] kernel_read() has been around since 2.6.x, and it takes + care of the get_fs()/set_fs() switch for kernels that need it (Linux < 5.10) + +Signed-off-by: Paolo Pisati +--- + os_dep/osdep_service.c | 23 ----------------------- + 1 file changed, 23 deletions(-) + +diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c +index 35013ed..0bb985d 100644 +--- a/os_dep/osdep_service.c ++++ b/os_dep/osdep_service.c +@@ -2143,13 +2143,7 @@ static int readFile(struct file *fp, char *buf, int len) + return -EPERM; + + while (sum < len) { +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) + rlen = kernel_read(fp, buf + sum, len - sum, &fp->f_pos); +-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) +- rlen = __vfs_read(fp, buf + sum, len - sum, &fp->f_pos); +-#else +- rlen = fp->f_op->read(fp, buf + sum, len - sum, &fp->f_pos); +-#endif + if (rlen > 0) + sum += rlen; + else if (0 != rlen) +@@ -2193,20 +2187,12 @@ static int isFileReadable(const char *path, u32 *sz) + { + struct file *fp; + int ret = 0; +- mm_segment_t oldfs; + char buf; + + fp = filp_open(path, O_RDONLY, 0); + if (IS_ERR(fp)) + ret = PTR_ERR(fp); + else { +- oldfs = get_fs(); +- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)) +- set_fs(KERNEL_DS); +- #else +- set_fs(get_ds()); +- #endif +- + if (1 != readFile(fp, &buf, 1)) + ret = PTR_ERR(fp); + +@@ -2218,7 +2204,6 @@ static int isFileReadable(const char *path, u32 *sz) + #endif + } + +- set_fs(oldfs); + filp_close(fp, NULL); + } + return ret; +@@ -2234,7 +2219,6 @@ static int isFileReadable(const char *path, u32 *sz) + static int retriveFromFile(const char *path, u8 *buf, u32 sz) + { + int ret = -1; +- mm_segment_t oldfs; + struct file *fp; + + if (path && buf) { +@@ -2242,14 +2226,7 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz) + if (0 == ret) { + RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp); + +- oldfs = get_fs(); +- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)) +- set_fs(KERNEL_DS); +- #else +- set_fs(get_ds()); +- #endif + ret = readFile(fp, buf, sz); +- set_fs(oldfs); + closeFile(fp); + + RTW_INFO("%s readFile, ret:%d\n", __FUNCTION__, ret); +-- +2.29.2 + diff -Nru rtl8821ce-5.5.2.1/debian/patches/0002-kernel_write-has-been-around-since-v4.0-and-it-takes.patch rtl8821ce-5.5.2.1/debian/patches/0002-kernel_write-has-been-around-since-v4.0-and-it-takes.patch --- rtl8821ce-5.5.2.1/debian/patches/0002-kernel_write-has-been-around-since-v4.0-and-it-takes.patch 1970-01-01 00:00:00.000000000 +0000 +++ rtl8821ce-5.5.2.1/debian/patches/0002-kernel_write-has-been-around-since-v4.0-and-it-takes.patch 2021-01-22 10:00:33.000000000 +0000 @@ -0,0 +1,50 @@ +From b30990ee9c3a0e2fd29d068bb77bfbd8baed33a6 Mon Sep 17 00:00:00 2001 +From: Paolo Pisati +Date: Fri, 4 Dec 2020 12:17:24 +0000 +Subject: [PATCH 2/2] kernel_write() has been around since v4.0 and it takes + care of the get_fs()/set_fs() switch for kernels that need it (Linux < 5.10) + +Signed-off-by: Paolo Pisati +--- + os_dep/osdep_service.c | 10 +--------- + 1 file changed, 1 insertion(+), 9 deletions(-) + +diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c +index 0bb985d..0c1a7a4 100644 +--- a/os_dep/osdep_service.c ++++ b/os_dep/osdep_service.c +@@ -2164,7 +2164,7 @@ static int writeFile(struct file *fp, char *buf, int len) + return -EPERM; + + while (sum < len) { +- wlen = fp->f_op->write(fp, buf + sum, len - sum, &fp->f_pos); ++ wlen = kernel_write(fp, buf + sum, len - sum, &fp->f_pos); + if (wlen > 0) + sum += wlen; + else if (0 != wlen) +@@ -2250,7 +2250,6 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz) + static int storeToFile(const char *path, u8 *buf, u32 sz) + { + int ret = 0; +- mm_segment_t oldfs; + struct file *fp; + + if (path && buf) { +@@ -2258,14 +2257,7 @@ static int storeToFile(const char *path, u8 *buf, u32 sz) + if (0 == ret) { + RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp); + +- oldfs = get_fs(); +- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)) +- set_fs(KERNEL_DS); +- #else +- set_fs(get_ds()); +- #endif + ret = writeFile(fp, buf, sz); +- set_fs(oldfs); + closeFile(fp); + + RTW_INFO("%s writeFile, ret:%d\n", __FUNCTION__, ret); +-- +2.29.2 + diff -Nru rtl8821ce-5.5.2.1/debian/patches/series rtl8821ce-5.5.2.1/debian/patches/series --- rtl8821ce-5.5.2.1/debian/patches/series 2020-07-24 05:46:53.000000000 +0000 +++ rtl8821ce-5.5.2.1/debian/patches/series 2021-01-22 10:00:33.000000000 +0000 @@ -6,3 +6,5 @@ 0006-rtl8821ce-move-struct-sha256_state-definition-into-r.patch 0007-.mgmt_frame_register-.update_mgmt_frame_registration.patch 0008-Add-constants-to-allow-22MB-and-33MB-data-rate.patch +0001-kernel_read-has-been-around-since-2.6.x-and-it-takes.patch +0002-kernel_write-has-been-around-since-v4.0-and-it-takes.patch diff -Nru rtl8821ce-5.5.2.1/debian/rtl8821ce-dkms.dkms rtl8821ce-5.5.2.1/debian/rtl8821ce-dkms.dkms --- rtl8821ce-5.5.2.1/debian/rtl8821ce-dkms.dkms 2020-02-19 08:18:36.000000000 +0000 +++ rtl8821ce-5.5.2.1/debian/rtl8821ce-dkms.dkms 2021-01-22 10:00:33.000000000 +0000 @@ -2,6 +2,7 @@ PACKAGE_VERSION="#MODULE_VERSION#" BUILT_MODULE_NAME[0]="$PACKAGE_NAME" DEST_MODULE_LOCATION[0]="/updates" +MODULES_CONF[0]="blacklist rtw88_8821ce" AUTOINSTALL="YES" # Find out how many CPU cores can be use if we pass appropriate -j option to make.