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 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2252054
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
yanyh2 2022-04-25 15:28:28 +08:00 committed by Yonghua Yan
parent d9e047e52b
commit 909333e371

View file

@ -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 = {