From 2961f562bb7b8b3cbaeaf5d9f0ea0fa8e72cc066 Mon Sep 17 00:00:00 2001 From: Dongliang Mu Date: Sat, 23 Jan 2021 13:11:02 +0800 Subject: usbnet: fix the indentation of one code snippet Every line of code should start with tab (8 characters) Signed-off-by: Dongliang Mu Link: https://lore.kernel.org/r/20210123051102.1091541-1-mudongliangabcd@gmail.com Signed-off-by: Jakub Kicinski --- drivers/net/usb/usbnet.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/net/usb/usbnet.c') diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 1447da1d5729..305c5f7b9a9b 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1964,12 +1964,12 @@ static int __usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype, cmd, reqtype, value, index, buf, size, USB_CTRL_GET_TIMEOUT); if (err > 0 && err <= size) { - if (data) - memcpy(data, buf, err); - else - netdev_dbg(dev->net, - "Huh? Data requested but thrown away.\n"); - } + if (data) + memcpy(data, buf, err); + else + netdev_dbg(dev->net, + "Huh? Data requested but thrown away.\n"); + } kfree(buf); out: return err; -- cgit v1.2.3 From 90a586b8d741b4b8a1368f6a2ccf858e1a0fe23c Mon Sep 17 00:00:00 2001 From: Emil Renner Berthing Date: Sat, 23 Jan 2021 18:32:20 +0100 Subject: net: usbnet: initialize tasklet using tasklet_init Initialize tasklet using tasklet_init() rather than open-coding it. Signed-off-by: Emil Renner Berthing Signed-off-by: Jakub Kicinski --- drivers/net/usb/usbnet.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/net/usb/usbnet.c') diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 305c5f7b9a9b..0fa31f1e9f7e 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1673,8 +1673,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) skb_queue_head_init (&dev->txq); skb_queue_head_init (&dev->done); skb_queue_head_init(&dev->rxq_pause); - dev->bh.func = usbnet_bh_tasklet; - dev->bh.data = (unsigned long)&dev->delay; + tasklet_init(&dev->bh, usbnet_bh_tasklet, (unsigned long)&dev->delay); INIT_WORK (&dev->kevent, usbnet_deferred_kevent); init_usb_anchor(&dev->deferred); timer_setup(&dev->delay, usbnet_bh, 0); -- cgit v1.2.3 From c955e329bb9d44fab75cf2116542fcc0de0473c5 Mon Sep 17 00:00:00 2001 From: Emil Renner Berthing Date: Sat, 23 Jan 2021 18:32:21 +0100 Subject: net: usbnet: use new tasklet API This converts the driver to use the new tasklet API introduced in commit 12cc923f1ccc ("tasklet: Introduce new initialization API") Signed-off-by: Emil Renner Berthing Signed-off-by: Jakub Kicinski --- drivers/net/usb/usbnet.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/net/usb/usbnet.c') diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 0fa31f1e9f7e..b4c8080e6f87 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1539,11 +1539,11 @@ static void usbnet_bh (struct timer_list *t) } } -static void usbnet_bh_tasklet(unsigned long data) +static void usbnet_bh_tasklet(struct tasklet_struct *t) { - struct timer_list *t = (struct timer_list *)data; + struct usbnet *dev = from_tasklet(dev, t, bh); - usbnet_bh(t); + usbnet_bh(&dev->delay); } @@ -1673,7 +1673,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) skb_queue_head_init (&dev->txq); skb_queue_head_init (&dev->done); skb_queue_head_init(&dev->rxq_pause); - tasklet_init(&dev->bh, usbnet_bh_tasklet, (unsigned long)&dev->delay); + tasklet_setup(&dev->bh, usbnet_bh_tasklet); INIT_WORK (&dev->kevent, usbnet_deferred_kevent); init_usb_anchor(&dev->deferred); timer_setup(&dev->delay, usbnet_bh, 0); -- cgit v1.2.3