Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 205897
b: refs/heads/master
c: 7a8b005
h: refs/heads/master
i:
  205895: 743cb20
v: v3
  • Loading branch information
Andres More authored and Greg Kroah-Hartman committed Jul 22, 2010
1 parent 26fc5ca commit 29f669b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 51 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 89b28e5db83dc748f37fb7442cc880da49c348ce
refs/heads/master: 7a8b0055267930bddd7d11e69875576c71dec343
94 changes: 44 additions & 50 deletions trunk/drivers/staging/vt6656/main_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,81 +757,75 @@ static const struct net_device_ops device_netdev_ops = {
.ndo_set_multicast_list = device_set_multi,
};


static int __devinit
vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
{
u8 fake_mac[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
struct usb_device *udev = interface_to_usbdev(intf);
int rc = 0;
struct net_device *netdev = NULL;
PSDevice pDevice = NULL;


printk(KERN_NOTICE "%s Ver. %s\n",DEVICE_FULL_DRV_NAM, DEVICE_VERSION);
printk(KERN_NOTICE "Copyright (c) 2004 VIA Networking Technologies, Inc.\n");
int rc = 0;
struct net_device *netdev = NULL;
PSDevice pDevice = NULL;

udev = usb_get_dev(udev);
printk(KERN_NOTICE "%s Ver. %s\n", DEVICE_FULL_DRV_NAM, DEVICE_VERSION);
printk(KERN_NOTICE "Copyright (c) 2004 VIA Networking Technologies, Inc.\n");

netdev = alloc_etherdev(sizeof(DEVICE_INFO));

if (netdev == NULL) {
printk(KERN_ERR DEVICE_NAME ": allocate net device failed \n");
kfree(pDevice);
goto err_nomem;
}
udev = usb_get_dev(udev);
netdev = alloc_etherdev(sizeof(DEVICE_INFO));

pDevice = netdev_priv(netdev);
memset(pDevice, 0, sizeof(DEVICE_INFO));
if (!netdev) {
printk(KERN_ERR DEVICE_NAME ": allocate net device failed\n");
kfree(pDevice);
goto err_nomem;
}

pDevice->dev = netdev;
pDevice->usb = udev;
pDevice = netdev_priv(netdev);
memset(pDevice, 0, sizeof(DEVICE_INFO));

// Set initial settings
device_set_options(pDevice);
spin_lock_init(&pDevice->lock);
pDevice->dev = netdev;
pDevice->usb = udev;

pDevice->tx_80211 = device_dma0_tx_80211;
pDevice->sMgmtObj.pAdapter = (void *)pDevice;
device_set_options(pDevice);
spin_lock_init(&pDevice->lock);

netdev->netdev_ops = &device_netdev_ops;
pDevice->tx_80211 = device_dma0_tx_80211;
pDevice->sMgmtObj.pAdapter = (void *) pDevice;

netdev->wireless_handlers = (struct iw_handler_def *)&iwctl_handler_def;
netdev->netdev_ops = &device_netdev_ops;
netdev->wireless_handlers =
(struct iw_handler_def *) &iwctl_handler_def;

//2008-0623-01<Remark>by MikeLiu
//2007-0821-01<Add>by MikeLiu
usb_set_intfdata(intf, pDevice);
usb_set_intfdata(intf, pDevice);
SET_NETDEV_DEV(netdev, &intf->dev);
memcpy(pDevice->dev->dev_addr, fake_mac, ETH_ALEN);
rc = register_netdev(netdev);
if (rc != 0) {
printk(KERN_ERR DEVICE_NAME " Failed to register netdev\n");
memcpy(pDevice->dev->dev_addr, fake_mac, ETH_ALEN);
rc = register_netdev(netdev);
if (rc) {
printk(KERN_ERR DEVICE_NAME " Failed to register netdev\n");
free_netdev(netdev);
kfree(pDevice);
return -ENODEV;
}
kfree(pDevice);
return -ENODEV;
}

usb_device_reset(pDevice);
usb_device_reset(pDevice);

{
union iwreq_data wrqu;
memset(&wrqu, 0, sizeof(wrqu));
wrqu.data.flags = RT_INSMOD_EVENT_FLAG;
wrqu.data.length =IFNAMSIZ;
wireless_send_event(pDevice->dev, IWEVCUSTOM, &wrqu, pDevice->dev->name);
}
{
union iwreq_data wrqu;
memset(&wrqu, 0, sizeof(wrqu));
wrqu.data.flags = RT_INSMOD_EVENT_FLAG;
wrqu.data.length = IFNAMSIZ;
wireless_send_event(pDevice->dev,
IWEVCUSTOM,
&wrqu,
pDevice->dev->name);
}

return 0;


err_nomem:
//2008-0922-01<Add>by MikeLiu, decrease usb counter.
usb_put_dev(udev);
usb_put_dev(udev);

return -ENOMEM;
return -ENOMEM;
}


static void device_free_tx_bufs(PSDevice pDevice)
{
PUSB_SEND_CONTEXT pTxContext;
Expand Down

0 comments on commit 29f669b

Please sign in to comment.