Staging: otus: fix style issues in zdusb.c
This is a patch to zdusb.c that fixes whitespace, C99 comment, and other style issues found by the checkpatch.pl tool Signed-off-by: Scott Kidder <scott.kidder11@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
594578979d
commit
b55515cf72
|
@ -48,7 +48,7 @@ static const char driver_name[] = "Otus";
|
||||||
/* table of devices that work with this driver */
|
/* table of devices that work with this driver */
|
||||||
static const struct usb_device_id zd1221_ids[] = {
|
static const struct usb_device_id zd1221_ids[] = {
|
||||||
{ USB_DEVICE(VENDOR_ATHR, PRODUCT_AR9170) },
|
{ USB_DEVICE(VENDOR_ATHR, PRODUCT_AR9170) },
|
||||||
{ USB_DEVICE(VENDOR_DLINK, PRODUCT_DWA160A) },
|
{ USB_DEVICE(VENDOR_DLINK, PRODUCT_DWA160A) },
|
||||||
{ USB_DEVICE(VENDOR_NETGEAR, PRODUCT_WNDA3100) },
|
{ USB_DEVICE(VENDOR_NETGEAR, PRODUCT_WNDA3100) },
|
||||||
{ USB_DEVICE(VENDOR_NETGEAR, PRODUCT_WN111v2) },
|
{ USB_DEVICE(VENDOR_NETGEAR, PRODUCT_WN111v2) },
|
||||||
{ } /* Terminating entry */
|
{ } /* Terminating entry */
|
||||||
|
@ -60,9 +60,9 @@ extern u8_t zfLnxInitSetup(struct net_device *dev, struct usbdrv_private *macp);
|
||||||
extern int usbdrv_close(struct net_device *dev);
|
extern int usbdrv_close(struct net_device *dev);
|
||||||
extern u8_t zfLnxClearStructs(struct net_device *dev);
|
extern u8_t zfLnxClearStructs(struct net_device *dev);
|
||||||
extern int zfWdsClose(struct net_device *dev);
|
extern int zfWdsClose(struct net_device *dev);
|
||||||
extern int zfUnregisterWdsDev(struct net_device* parentDev, u16_t wdsId);
|
extern int zfUnregisterWdsDev(struct net_device *parentDev, u16_t wdsId);
|
||||||
extern int zfLnxVapClose(struct net_device *dev);
|
extern int zfLnxVapClose(struct net_device *dev);
|
||||||
extern int zfLnxUnregisterVapDev(struct net_device* parentDev, u16_t vapId);
|
extern int zfLnxUnregisterVapDev(struct net_device *parentDev, u16_t vapId);
|
||||||
|
|
||||||
/* WDS */
|
/* WDS */
|
||||||
extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER];
|
extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER];
|
||||||
|
@ -73,148 +73,135 @@ extern struct zsVapStruct vap[ZM_VAP_PORT_NUMBER];
|
||||||
static int zfLnxProbe(struct usb_interface *interface,
|
static int zfLnxProbe(struct usb_interface *interface,
|
||||||
const struct usb_device_id *id)
|
const struct usb_device_id *id)
|
||||||
{
|
{
|
||||||
struct usb_device *dev = interface_to_usbdev(interface);
|
struct usb_device *dev = interface_to_usbdev(interface);
|
||||||
|
|
||||||
struct net_device *net = NULL;
|
struct net_device *net = NULL;
|
||||||
struct usbdrv_private *macp = NULL;
|
struct usbdrv_private *macp = NULL;
|
||||||
int vendor_id, product_id;
|
int vendor_id, product_id;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
usb_get_dev(dev);
|
usb_get_dev(dev);
|
||||||
|
|
||||||
vendor_id = dev->descriptor.idVendor;
|
vendor_id = dev->descriptor.idVendor;
|
||||||
product_id = dev->descriptor.idProduct;
|
product_id = dev->descriptor.idProduct;
|
||||||
|
|
||||||
#ifdef HMAC_DEBUG
|
#ifdef HMAC_DEBUG
|
||||||
printk(KERN_NOTICE "vendor_id = %04x\n", vendor_id);
|
printk(KERN_NOTICE "vendor_id = %04x\n", vendor_id);
|
||||||
printk(KERN_NOTICE "product_id = %04x\n", product_id);
|
printk(KERN_NOTICE "product_id = %04x\n", product_id);
|
||||||
|
|
||||||
if (dev->speed == USB_SPEED_HIGH)
|
if (dev->speed == USB_SPEED_HIGH)
|
||||||
printk(KERN_NOTICE "USB 2.0 Host\n");
|
printk(KERN_NOTICE "USB 2.0 Host\n");
|
||||||
else
|
else
|
||||||
printk(KERN_NOTICE "USB 1.1 Host\n");
|
printk(KERN_NOTICE "USB 1.1 Host\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
macp = kzalloc(sizeof(struct usbdrv_private), GFP_KERNEL);
|
macp = kzalloc(sizeof(struct usbdrv_private), GFP_KERNEL);
|
||||||
if (!macp)
|
if (!macp) {
|
||||||
{
|
printk(KERN_ERR "out of memory allocating device structure\n");
|
||||||
printk(KERN_ERR "out of memory allocating device structure\n");
|
result = -ENOMEM;
|
||||||
result = -ENOMEM;
|
goto fail;
|
||||||
goto fail;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
net = alloc_etherdev(0);
|
net = alloc_etherdev(0);
|
||||||
|
|
||||||
if (net == NULL)
|
if (net == NULL) {
|
||||||
{
|
printk(KERN_ERR "zfLnxProbe: Not able to alloc etherdev struct\n");
|
||||||
printk(KERN_ERR "zfLnxProbe: Not able to alloc etherdev struct\n");
|
result = -ENOMEM;
|
||||||
result = -ENOMEM;
|
goto fail1;
|
||||||
goto fail1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
strcpy(net->name, "ath%d");
|
strcpy(net->name, "ath%d");
|
||||||
|
|
||||||
net->ml_priv = macp; //kernel 2.6
|
net->ml_priv = macp; /* kernel 2.6 */
|
||||||
macp->udev = dev;
|
macp->udev = dev;
|
||||||
macp->device = net;
|
macp->device = net;
|
||||||
|
|
||||||
/* set up the endpoint information */
|
/* set up the endpoint information */
|
||||||
/* check out the endpoints */
|
/* check out the endpoints */
|
||||||
macp->interface = interface;
|
macp->interface = interface;
|
||||||
|
|
||||||
//init_waitqueue_head(&macp->regSet_wait);
|
/* init_waitqueue_head(&macp->regSet_wait); */
|
||||||
//init_waitqueue_head(&macp->iorwRsp_wait);
|
/* init_waitqueue_head(&macp->iorwRsp_wait); */
|
||||||
//init_waitqueue_head(&macp->term_wait);
|
/* init_waitqueue_head(&macp->term_wait); */
|
||||||
|
|
||||||
if (!zfLnxAllocAllUrbs(macp))
|
if (!zfLnxAllocAllUrbs(macp)) {
|
||||||
{
|
result = -ENOMEM;
|
||||||
result = -ENOMEM;
|
goto fail2;
|
||||||
goto fail2;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!zfLnxInitSetup(net, macp))
|
if (!zfLnxInitSetup(net, macp)) {
|
||||||
{
|
result = -EIO;
|
||||||
result = -EIO;
|
goto fail3;
|
||||||
goto fail3;
|
} else {
|
||||||
}
|
usb_set_intfdata(interface, macp);
|
||||||
else
|
SET_NETDEV_DEV(net, &interface->dev);
|
||||||
{
|
|
||||||
usb_set_intfdata(interface, macp);
|
|
||||||
SET_NETDEV_DEV(net, &interface->dev);
|
|
||||||
|
|
||||||
if (register_netdev(net) != 0)
|
if (register_netdev(net) != 0) {
|
||||||
{
|
usb_set_intfdata(interface, NULL);
|
||||||
usb_set_intfdata(interface, NULL);
|
goto fail3;
|
||||||
goto fail3;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
netif_carrier_off(net);
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
|
netif_carrier_off(net);
|
||||||
|
goto done;
|
||||||
fail3:
|
fail3:
|
||||||
zfLnxFreeAllUrbs(macp);
|
zfLnxFreeAllUrbs(macp);
|
||||||
fail2:
|
fail2:
|
||||||
free_netdev(net); //kernel 2.6
|
free_netdev(net); /* kernel 2.6 */
|
||||||
fail1:
|
fail1:
|
||||||
kfree(macp);
|
kfree(macp);
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
usb_put_dev(dev);
|
usb_put_dev(dev);
|
||||||
macp = NULL;
|
macp = NULL;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void zfLnxDisconnect(struct usb_interface *interface)
|
static void zfLnxDisconnect(struct usb_interface *interface)
|
||||||
{
|
{
|
||||||
struct usbdrv_private *macp = (struct usbdrv_private *) usb_get_intfdata(interface);
|
struct usbdrv_private *macp = (struct usbdrv_private *) usb_get_intfdata(interface);
|
||||||
|
|
||||||
printk(KERN_DEBUG "zfLnxDisconnect\n");
|
printk(KERN_DEBUG "zfLnxDisconnect\n");
|
||||||
|
|
||||||
if (!macp)
|
if (!macp) {
|
||||||
{
|
printk(KERN_ERR "unregistering non-existant device\n");
|
||||||
printk(KERN_ERR "unregistering non-existant device\n");
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (macp->driver_isolated)
|
if (macp->driver_isolated)
|
||||||
{
|
if (macp->device->flags & IFF_UP)
|
||||||
if (macp->device->flags & IFF_UP)
|
usbdrv_close(macp->device);
|
||||||
usbdrv_close(macp->device);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Close WDS */
|
/* Close WDS */
|
||||||
//zfWdsClose(wds[0].dev);
|
/* zfWdsClose(wds[0].dev); */
|
||||||
/* Unregister WDS */
|
/* Unregister WDS */
|
||||||
//zfUnregisterWdsDev(macp->device, 0);
|
/* zfUnregisterWdsDev(macp->device, 0); */
|
||||||
|
|
||||||
/* Close VAP */
|
/* Close VAP */
|
||||||
zfLnxVapClose(vap[0].dev);
|
zfLnxVapClose(vap[0].dev);
|
||||||
/* Unregister VAP */
|
/* Unregister VAP */
|
||||||
zfLnxUnregisterVapDev(macp->device, 0);
|
zfLnxUnregisterVapDev(macp->device, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
zfLnxClearStructs(macp->device);
|
zfLnxClearStructs(macp->device);
|
||||||
|
|
||||||
unregister_netdev(macp->device);
|
unregister_netdev(macp->device);
|
||||||
|
|
||||||
usb_put_dev(interface_to_usbdev(interface));
|
usb_put_dev(interface_to_usbdev(interface));
|
||||||
|
|
||||||
//printk(KERN_ERR "3. zfLnxUnlinkAllUrbs\n");
|
/* printk(KERN_ERR "3. zfLnxUnlinkAllUrbs\n"); */
|
||||||
//zfLnxUnlinkAllUrbs(macp);
|
/* zfLnxUnlinkAllUrbs(macp); */
|
||||||
|
|
||||||
/* Free network interface */
|
/* Free network interface */
|
||||||
free_netdev(macp->device);
|
free_netdev(macp->device);
|
||||||
|
|
||||||
zfLnxFreeAllUrbs(macp);
|
zfLnxFreeAllUrbs(macp);
|
||||||
//zfLnxClearStructs(macp->device);
|
/* zfLnxClearStructs(macp->device); */
|
||||||
kfree(macp);
|
kfree(macp);
|
||||||
macp = NULL;
|
macp = NULL;
|
||||||
|
|
||||||
usb_set_intfdata(interface, NULL);
|
usb_set_intfdata(interface, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct usb_driver zd1221_driver = {
|
static struct usb_driver zd1221_driver = {
|
||||||
|
@ -226,13 +213,13 @@ static struct usb_driver zd1221_driver = {
|
||||||
|
|
||||||
int __init zfLnxIinit(void)
|
int __init zfLnxIinit(void)
|
||||||
{
|
{
|
||||||
printk(KERN_NOTICE "%s - version %s\n", DRIVER_NAME, VERSIONID);
|
printk(KERN_NOTICE "%s - version %s\n", DRIVER_NAME, VERSIONID);
|
||||||
return usb_register(&zd1221_driver);
|
return usb_register(&zd1221_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __exit zfLnxExit(void)
|
void __exit zfLnxExit(void)
|
||||||
{
|
{
|
||||||
usb_deregister(&zd1221_driver);
|
usb_deregister(&zd1221_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(zfLnxIinit);
|
module_init(zfLnxIinit);
|
||||||
|
|
Loading…
Reference in New Issue