]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
Merge tag 'v2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / drivers / staging / ft1000 / ft1000-usb / ft1000_usb.c
index 28f55b2030e951f773c5a54a8ce9d7cd1aa2eb36..79482ac1c489814b1eacd29b57bfa6c56c3952f5 100644 (file)
@@ -36,7 +36,7 @@ static struct usb_device_id id_table[] = {
 
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static BOOLEAN gPollingfailed = FALSE;
+static bool gPollingfailed = FALSE;
 int ft1000_poll_thread(void *arg)
 {
        int ret = STATUS_SUCCESS;
@@ -64,7 +64,7 @@ static int ft1000_probe(struct usb_interface *interface,
        int i, ret = 0, size;
 
        struct ft1000_device *ft1000dev;
-       struct ft1000_info *pft1000info;
+       struct ft1000_info *pft1000info = NULL;
        const struct firmware *dsp_fw;
 
        ft1000dev = kmalloc(sizeof(struct ft1000_device), GFP_KERNEL);
@@ -84,7 +84,6 @@ static int ft1000_probe(struct usb_interface *interface,
        ft1000dev->dev = dev;
        ft1000dev->status = 0;
        ft1000dev->net = NULL;
-       spin_lock_init(&ft1000dev->device_lock);
        ft1000dev->tx_urb = usb_alloc_urb(0, GFP_ATOMIC);
        ft1000dev->rx_urb = usb_alloc_urb(0, GFP_ATOMIC);
 
@@ -164,7 +163,7 @@ static int ft1000_probe(struct usb_interface *interface,
        if (ret)
                goto err_load;
 
-       pft1000info = (struct ft1000_info *) netdev_priv(ft1000dev->net);
+       pft1000info = netdev_priv(ft1000dev->net);
 
        DEBUG("In probe: pft1000info=%p\n", pft1000info);
        ret = dsp_reload(ft1000dev);
@@ -176,14 +175,18 @@ static int ft1000_probe(struct usb_interface *interface,
        gPollingfailed = FALSE;
        pft1000info->pPollThread =
            kthread_run(ft1000_poll_thread, ft1000dev, "ft1000_poll");
+
+       if (IS_ERR(pft1000info->pPollThread)) {
+               ret = PTR_ERR(pft1000info->pPollThread);
+               goto err_load;
+       }
+
        msleep(500);
 
        while (!pft1000info->CardReady) {
                if (gPollingfailed) {
-                       if (pft1000info->pPollThread)
-                               kthread_stop(pft1000info->pPollThread);
                        ret = -EIO;
-                       goto err_load;
+                       goto err_thread;
                }
                msleep(100);
                DEBUG("ft1000_probe::Waiting for Card Ready\n");
@@ -193,14 +196,21 @@ static int ft1000_probe(struct usb_interface *interface,
 
        ret = reg_ft1000_netdev(ft1000dev, interface);
        if (ret)
-               goto err_load;
+               goto err_thread;
 
-       pft1000info->NetDevRegDone = 1;
+       ret = ft1000_init_proc(ft1000dev->net);
+       if (ret)
+               goto err_proc;
 
-       ft1000InitProc(ft1000dev->net);
+       pft1000info->NetDevRegDone = 1;
 
        return 0;
 
+err_proc:
+       unregister_netdev(ft1000dev->net);
+       free_netdev(ft1000dev->net);
+err_thread:
+       kthread_stop(pft1000info->pPollThread);
 err_load:
        kfree(pFileStart);
 err_fw:
@@ -218,7 +228,7 @@ static void ft1000_disconnect(struct usb_interface *interface)
        DEBUG("In disconnect pft1000info=%p\n", pft1000info);
 
        if (pft1000info) {
-               ft1000CleanupProc(pft1000info);
+               ft1000_cleanup_proc(pft1000info);
                if (pft1000info->pPollThread)
                        kthread_stop(pft1000info->pPollThread);
 
@@ -226,7 +236,7 @@ static void ft1000_disconnect(struct usb_interface *interface)
 
                if (pft1000info->pFt1000Dev->net) {
                        DEBUG("ft1000_disconnect: destroy char driver\n");
-                       ft1000_DestroyDevice(pft1000info->pFt1000Dev->net);
+                       ft1000_destroy_dev(pft1000info->pFt1000Dev->net);
                        unregister_netdev(pft1000info->pFt1000Dev->net);
                        DEBUG
                            ("ft1000_disconnect: network device unregisterd\n");