From 6cdc32108e2ab89e5de3ca487f1e6dc05f9f5b60 Mon Sep 17 00:00:00 2001 From: yanyh2 Date: Mon, 25 Apr 2022 15:28:28 +0800 Subject: [PATCH] usbnet: fix build error in new Kernel version Build moto_f_usbnet.ko error: f_usbnet.c:453:13: error: implicit declaration of function 'get_fs' [-Werror,-Wimplicit-function-declaration] f_usbnet.c:454:2: error: implicit declaration of function 'set_fs' [-Werror,-Wimplicit-function-declaration] Change-Id: I300f961b7398d22936428caa387cf653aff5b777 Signed-off-by: yanyh2 Reviewed-on: https://gerrit.mot.com/2252054 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jianqi Yang Submit-Approved: Jira Key --- drivers/moto_f_usbnet/f_usbnet.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/moto_f_usbnet/f_usbnet.c b/drivers/moto_f_usbnet/f_usbnet.c index 24ab51549b6b..72769b651022 100644 --- a/drivers/moto_f_usbnet/f_usbnet.c +++ b/drivers/moto_f_usbnet/f_usbnet.c @@ -426,7 +426,9 @@ static struct net_device_stats *usb_ether_get_stats(struct net_device *dev) static void usbnet_if_config(struct work_struct *work) { struct ifreq ifr; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) mm_segment_t saved_fs; +#endif unsigned err; struct sockaddr_in *sin; struct usbnet_context *context = container_of(work, @@ -450,8 +452,10 @@ static void usbnet_if_config(struct work_struct *work) sin->sin_family = AF_INET; sin->sin_addr.s_addr = context->ip_addr; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) saved_fs = get_fs(); set_fs(KERNEL_DS); +#endif err = sock->ops->ioctl(sock, SIOCSIFADDR, (unsigned long)&ifr); if (err) USBNETDBG(context, "%s: Error in SIOCSIFADDR\n", __func__); @@ -474,7 +478,9 @@ static void usbnet_if_config(struct work_struct *work) err = sock->ops->ioctl(sock, SIOCSIFFLAGS, (unsigned long)&ifr); if (err) USBNETDBG(context, "%s: Error in SIOCSIFFLAGS\n", __func__); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) set_fs(saved_fs); +#endif } static const struct net_device_ops usbnet_eth_netdev_ops = {