Skip to content

Commit 4ad0fdb

Browse files
Malcolm Priestleygregkh
Malcolm Priestley
authored andcommitted
staging: vt6656: make pControlURB available life time of driver.
There is no need remove and add the control urb in device open/close. Move to the probe and disconnect. This make the USB control in/out functions always available to driver. Signed-off-by: Malcolm Priestley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4a54b61 commit 4ad0fdb

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

drivers/staging/vt6656/main_usb.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,12 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
707707
INIT_WORK(&pDevice->read_work_item, RXvWorkItem);
708708
INIT_WORK(&pDevice->rx_mng_work_item, RXvMngWorkItem);
709709

710+
pDevice->pControlURB = usb_alloc_urb(0, GFP_ATOMIC);
711+
if (!pDevice->pControlURB) {
712+
DBG_PRT(MSG_LEVEL_ERR, KERN_ERR"Failed to alloc control urb\n");
713+
goto err_nomem;
714+
}
715+
710716
pDevice->tx_80211 = device_dma0_tx_80211;
711717
pDevice->vnt_mgmt.pAdapter = (void *) pDevice;
712718

@@ -853,23 +859,15 @@ static bool device_alloc_bufs(struct vnt_private *pDevice)
853859
pRCB++;
854860
}
855861

856-
pDevice->pControlURB = usb_alloc_urb(0, GFP_ATOMIC);
857-
if (pDevice->pControlURB == NULL) {
858-
DBG_PRT(MSG_LEVEL_ERR,KERN_ERR"Failed to alloc control urb\n");
859-
goto free_rx_tx;
860-
}
861-
862862
pDevice->pInterruptURB = usb_alloc_urb(0, GFP_ATOMIC);
863863
if (pDevice->pInterruptURB == NULL) {
864864
DBG_PRT(MSG_LEVEL_ERR,KERN_ERR"Failed to alloc int urb\n");
865-
usb_free_urb(pDevice->pControlURB);
866865
goto free_rx_tx;
867866
}
868867

869868
pDevice->intBuf.pDataBuf = kmalloc(MAX_INTERRUPT_SIZE, GFP_KERNEL);
870869
if (pDevice->intBuf.pDataBuf == NULL) {
871870
DBG_PRT(MSG_LEVEL_ERR,KERN_ERR"Failed to alloc int buf\n");
872-
usb_free_urb(pDevice->pControlURB);
873871
usb_free_urb(pDevice->pInterruptURB);
874872
goto free_rx_tx;
875873
}
@@ -1040,9 +1038,7 @@ static int device_open(struct net_device *dev)
10401038
device_free_rx_bufs(pDevice);
10411039
device_free_tx_bufs(pDevice);
10421040
device_free_int_bufs(pDevice);
1043-
usb_kill_urb(pDevice->pControlURB);
10441041
usb_kill_urb(pDevice->pInterruptURB);
1045-
usb_free_urb(pDevice->pControlURB);
10461042
usb_free_urb(pDevice->pInterruptURB);
10471043

10481044
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open fail.. \n");
@@ -1113,9 +1109,7 @@ static int device_close(struct net_device *dev)
11131109
device_free_int_bufs(pDevice);
11141110
device_free_frag_bufs(pDevice);
11151111

1116-
usb_kill_urb(pDevice->pControlURB);
11171112
usb_kill_urb(pDevice->pInterruptURB);
1118-
usb_free_urb(pDevice->pControlURB);
11191113
usb_free_urb(pDevice->pInterruptURB);
11201114

11211115
BSSvClearNodeDBTable(pDevice, 0);
@@ -1139,9 +1133,12 @@ static void vt6656_disconnect(struct usb_interface *intf)
11391133

11401134
if (device->dev) {
11411135
unregister_netdev(device->dev);
1136+
1137+
usb_kill_urb(device->pControlURB);
1138+
usb_free_urb(device->pControlURB);
1139+
11421140
free_netdev(device->dev);
11431141
}
1144-
11451142
}
11461143

11471144
static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev)

0 commit comments

Comments
 (0)