Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usbnet: int51x1: apply introduced usb command APIs

Acked-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ming Lei and committed by
David S. Miller
3898cdf9 24b1042c

+3 -49
+3 -49
drivers/net/usb/int51x1.c
··· 116 116 return skb; 117 117 } 118 118 119 - static void int51x1_async_cmd_callback(struct urb *urb) 120 - { 121 - struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; 122 - int status = urb->status; 123 - 124 - if (status < 0) 125 - dev_warn(&urb->dev->dev, "async callback failed with %d\n", status); 126 - 127 - kfree(req); 128 - usb_free_urb(urb); 129 - } 130 - 131 119 static void int51x1_set_multicast(struct net_device *netdev) 132 120 { 133 - struct usb_ctrlrequest *req; 134 - int status; 135 - struct urb *urb; 136 121 struct usbnet *dev = netdev_priv(netdev); 137 122 u16 filter = PACKET_TYPE_DIRECTED | PACKET_TYPE_BROADCAST; 138 123 ··· 134 149 netdev_dbg(dev->net, "receive own packets only\n"); 135 150 } 136 151 137 - urb = usb_alloc_urb(0, GFP_ATOMIC); 138 - if (!urb) { 139 - netdev_warn(dev->net, "Error allocating URB\n"); 140 - return; 141 - } 142 - 143 - req = kmalloc(sizeof(*req), GFP_ATOMIC); 144 - if (!req) { 145 - netdev_warn(dev->net, "Error allocating control msg\n"); 146 - goto out; 147 - } 148 - 149 - req->bRequestType = USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE; 150 - req->bRequest = SET_ETHERNET_PACKET_FILTER; 151 - req->wValue = cpu_to_le16(filter); 152 - req->wIndex = 0; 153 - req->wLength = 0; 154 - 155 - usb_fill_control_urb(urb, dev->udev, usb_sndctrlpipe(dev->udev, 0), 156 - (void *)req, NULL, 0, 157 - int51x1_async_cmd_callback, 158 - (void *)req); 159 - 160 - status = usb_submit_urb(urb, GFP_ATOMIC); 161 - if (status < 0) { 162 - netdev_warn(dev->net, "Error submitting control msg, sts=%d\n", 163 - status); 164 - goto out1; 165 - } 166 - return; 167 - out1: 168 - kfree(req); 169 - out: 170 - usb_free_urb(urb); 152 + usbnet_write_cmd_async(dev, SET_ETHERNET_PACKET_FILTER, 153 + USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 154 + filter, 0, NULL, 0); 171 155 } 172 156 173 157 static const struct net_device_ops int51x1_netdev_ops = {