All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5]staging:ft1000:various code cleanup.
@ 2010-10-14  9:40 Marek Belisko
  2010-10-14  9:40 ` [PATCH 1/5] staging:ft1000: various checkpatch.pl fixes Marek Belisko
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Marek Belisko @ 2010-10-14  9:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Marek Belisko, Arnd Bergmann, devel, linux-kernel


Following series of patches try to fix code according kernel CodinStyle.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/5] staging:ft1000: various checkpatch.pl fixes.
  2010-10-14  9:40 [PATCH 0/5]staging:ft1000:various code cleanup Marek Belisko
@ 2010-10-14  9:40 ` Marek Belisko
  2010-10-14  9:40 ` [PATCH 2/5] staging:ft1000: lines over 80 characters corrected Marek Belisko
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Marek Belisko @ 2010-10-14  9:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Marek Belisko, Arnd Bergmann, devel, linux-kernel
  Cc: Marek Belisko

Signed-off-by: Marek Belisko <marek.belisko@gmail.com>
---
 drivers/staging/ft1000/ft1000-usb/ft1000_usb.c |   71 ++++++++++--------------
 1 files changed, 29 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
index 1a05148..7c002ab 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
@@ -30,25 +30,22 @@ size_t FileLength;
 
 /* table of devices that work with this driver */
 static struct usb_device_id id_table[] = {
-    {USB_DEVICE(VENDOR_ID, PRODUCT_ID) },
+    {USB_DEVICE(VENDOR_ID, PRODUCT_ID)},
     { },
 };
 
-MODULE_DEVICE_TABLE (usb, id_table);
+MODULE_DEVICE_TABLE(usb, id_table);
 
 static BOOLEAN gPollingfailed = FALSE;
 int ft1000_poll_thread(void *arg)
 {
     int ret = STATUS_SUCCESS;
 
-    while(!kthread_should_stop() )
-    {
+    while (!kthread_should_stop()) {
         msleep(10);
-        if ( ! gPollingfailed )
-        {
+        if (!gPollingfailed) {
             ret = ft1000_poll(arg);
-            if ( ret != STATUS_SUCCESS )
-            {
+            if (ret != STATUS_SUCCESS) {
                 DEBUG("ft1000_poll_thread: polling failed\n");
                 gPollingfailed = TRUE;
             }
@@ -84,11 +81,12 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device
 	const struct firmware *dsp_fw;
 
 
-    if(!(ft1000dev = kmalloc(sizeof(struct ft1000_device), GFP_KERNEL)))
-    {
-        printk("out of memory allocating device structure\n");
-	return 0;
-    }
+	ft1000dev = kmalloc(sizeof(struct ft1000_device), GFP_KERNEL);
+
+	if (!ft1000dev) {
+		printk(KERN_ERR "out of memory allocating device structure\n");
+		return 0;
+	}
 
     memset(ft1000dev, 0, sizeof(*ft1000dev));
 
@@ -106,7 +104,7 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device
 
     DEBUG("ft1000_probe is called\n");
     numaltsetting = interface->num_altsetting;
-    DEBUG("ft1000_probe: number of alt settings is :%d\n",numaltsetting);
+    DEBUG("ft1000_probe: number of alt settings is :%d\n", numaltsetting);
     iface_desc = interface->cur_altsetting;
     DEBUG("ft1000_probe: number of endpoints is %d\n", iface_desc->desc.bNumEndpoints);
     DEBUG("ft1000_probe: descriptor type is %d\n", iface_desc->desc.bDescriptorType);
@@ -118,19 +116,16 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device
     DEBUG("ft1000_probe: descriptor1 type -- %d\n", iface_desc->endpoint[1].desc.bmAttributes);
     DEBUG("ft1000_probe: descriptor2 type -- %d\n", iface_desc->endpoint[2].desc.bmAttributes);
 
-    for (i=0; i< iface_desc->desc.bNumEndpoints;i++ )
-    {
+    for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
 		endpoint = (struct usb_endpoint_descriptor *)&iface_desc->endpoint[i].desc;
                 DEBUG("endpoint %d\n", i);
                 DEBUG("bEndpointAddress=%x, bmAttributes=%x\n", endpoint->bEndpointAddress, endpoint->bmAttributes);
-		if ( (endpoint->bEndpointAddress & USB_DIR_IN) && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK))
-		{
+		if ((endpoint->bEndpointAddress & USB_DIR_IN) && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK)) {
 			ft1000dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
 			DEBUG("ft1000_probe: in: %d\n", endpoint->bEndpointAddress);
 		}
 
-		if (!(endpoint->bEndpointAddress & USB_DIR_IN) && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK))
-		{
+		if (!(endpoint->bEndpointAddress & USB_DIR_IN) && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK)) {
 			ft1000dev->bulk_out_endpointAddr = endpoint->bEndpointAddress;
 			DEBUG("ft1000_probe: out: %d\n", endpoint->bEndpointAddress);
 		}
@@ -159,7 +154,7 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device
 
     DEBUG("ft1000_probe: start downloading dsp image...\n");
     init_ft1000_netdev(ft1000dev);
-    pft1000info = (FT1000_INFO *) netdev_priv (ft1000dev->net);
+    pft1000info = (FT1000_INFO *) netdev_priv(ft1000dev->net);
 
 	DEBUG("In probe: pft1000info=%p\n", pft1000info);
 	ret = dsp_reload(ft1000dev);
@@ -172,20 +167,16 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device
     pft1000info->pPollThread = kthread_run(ft1000_poll_thread, ft1000dev, "ft1000_poll");
 	msleep(500);
 
-    while (!pft1000info->CardReady)
-    {
-        if ( gPollingfailed )
-        {
-            if ( pft1000info->pPollThread )
-            {
-                kthread_stop(pft1000info->pPollThread );
-            }
-		ret = -EIO;
-		goto err_load;
-        }
-        msleep(100);
-        DEBUG("ft1000_probe::Waiting for Card Ready\n");
-    }
+	while (!pft1000info->CardReady) {
+		if (gPollingfailed) {
+			if (pft1000info->pPollThread)
+				kthread_stop(pft1000info->pPollThread);
+			ret = -EIO;
+			goto err_load;
+		}
+		msleep(100);
+		DEBUG("ft1000_probe::Waiting for Card Ready\n");
+	}
 
 
     DEBUG("ft1000_probe::Card Ready!!!! Registering network device\n");
@@ -228,18 +219,14 @@ static void ft1000_disconnect(struct usb_interface *interface)
 
 
 
-    if (pft1000info)
-    {
+    if (pft1000info) {
 		ft1000CleanupProc(pft1000info);
-        if ( pft1000info->pPollThread )
-        {
+        if (pft1000info->pPollThread)
             kthread_stop(pft1000info->pPollThread );
-        }
 
         DEBUG("ft1000_disconnect: threads are terminated\n");
 
-        if (pft1000info->pFt1000Dev->net)
-        {
+        if (pft1000info->pFt1000Dev->net) {
             DEBUG("ft1000_disconnect: destroy char driver\n");
             ft1000_DestroyDevice(pft1000info->pFt1000Dev->net);
             unregister_netdev(pft1000info->pFt1000Dev->net);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] staging:ft1000: lines over 80 characters corrected.
  2010-10-14  9:40 [PATCH 0/5]staging:ft1000:various code cleanup Marek Belisko
  2010-10-14  9:40 ` [PATCH 1/5] staging:ft1000: various checkpatch.pl fixes Marek Belisko
@ 2010-10-14  9:40 ` Marek Belisko
  2010-10-14  9:40 ` [PATCH 3/5] staging:ft1000: replace and remove c99 comments Marek Belisko
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Marek Belisko @ 2010-10-14  9:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Marek Belisko, Arnd Bergmann, devel, linux-kernel
  Cc: Marek Belisko

Signed-off-by: Marek Belisko <marek.belisko@gmail.com>
---
 drivers/staging/ft1000/ft1000-usb/ft1000_usb.c |   63 ++++++++++++++++--------
 1 files changed, 43 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
index 7c002ab..fc817cb 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
@@ -68,7 +68,8 @@ int ft1000_poll_thread(void *arg)
 // Notes:
 //
 //---------------------------------------------------------------------------
-static int ft1000_probe(struct usb_interface *interface, const struct usb_device_id *id)
+static int ft1000_probe(struct usb_interface *interface,
+			const struct usb_device_id *id)
 {
     struct usb_host_interface *iface_desc;
     struct usb_endpoint_descriptor *endpoint;
@@ -92,7 +93,8 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device
 
     dev = interface_to_usbdev(interface);
     DEBUG("ft1000_probe: usb device descriptor info:\n");
-    DEBUG("ft1000_probe: number of configuration is %d\n", dev->descriptor.bNumConfigurations);
+	DEBUG("ft1000_probe: number of configuration is %d\n",
+	      dev->descriptor.bNumConfigurations);
 
 	ft1000dev->dev = dev;
 	ft1000dev->status = 0;
@@ -106,32 +108,52 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device
     numaltsetting = interface->num_altsetting;
     DEBUG("ft1000_probe: number of alt settings is :%d\n", numaltsetting);
     iface_desc = interface->cur_altsetting;
-    DEBUG("ft1000_probe: number of endpoints is %d\n", iface_desc->desc.bNumEndpoints);
-    DEBUG("ft1000_probe: descriptor type is %d\n", iface_desc->desc.bDescriptorType);
-    DEBUG("ft1000_probe: interface number is %d\n", iface_desc->desc.bInterfaceNumber);
-    DEBUG("ft1000_probe: alternatesetting is %d\n", iface_desc->desc.bAlternateSetting);
-    DEBUG("ft1000_probe: interface class is %d\n", iface_desc->desc.bInterfaceClass);
+	DEBUG("ft1000_probe: number of endpoints is %d\n",
+	      iface_desc->desc.bNumEndpoints);
+	DEBUG("ft1000_probe: descriptor type is %d\n",
+	      iface_desc->desc.bDescriptorType);
+	DEBUG("ft1000_probe: interface number is %d\n",
+	      iface_desc->desc.bInterfaceNumber);
+	DEBUG("ft1000_probe: alternatesetting is %d\n",
+	      iface_desc->desc.bAlternateSetting);
+	DEBUG("ft1000_probe: interface class is %d\n",
+	      iface_desc->desc.bInterfaceClass);
     DEBUG("ft1000_probe: control endpoint info:\n");
-    DEBUG("ft1000_probe: descriptor0 type -- %d\n", iface_desc->endpoint[0].desc.bmAttributes);
-    DEBUG("ft1000_probe: descriptor1 type -- %d\n", iface_desc->endpoint[1].desc.bmAttributes);
-    DEBUG("ft1000_probe: descriptor2 type -- %d\n", iface_desc->endpoint[2].desc.bmAttributes);
+	DEBUG("ft1000_probe: descriptor0 type -- %d\n",
+	      iface_desc->endpoint[0].desc.bmAttributes);
+	DEBUG("ft1000_probe: descriptor1 type -- %d\n",
+	      iface_desc->endpoint[1].desc.bmAttributes);
+	DEBUG("ft1000_probe: descriptor2 type -- %d\n",
+	      iface_desc->endpoint[2].desc.bmAttributes);
 
     for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
-		endpoint = (struct usb_endpoint_descriptor *)&iface_desc->endpoint[i].desc;
+		endpoint =
+		    (struct usb_endpoint_descriptor *)&iface_desc->endpoint[i].
+		    desc;
                 DEBUG("endpoint %d\n", i);
-                DEBUG("bEndpointAddress=%x, bmAttributes=%x\n", endpoint->bEndpointAddress, endpoint->bmAttributes);
-		if ((endpoint->bEndpointAddress & USB_DIR_IN) && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK)) {
-			ft1000dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
-			DEBUG("ft1000_probe: in: %d\n", endpoint->bEndpointAddress);
+		DEBUG("bEndpointAddress=%x, bmAttributes=%x\n",
+		      endpoint->bEndpointAddress, endpoint->bmAttributes);
+		if ((endpoint->bEndpointAddress & USB_DIR_IN)
+		    && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+			USB_ENDPOINT_XFER_BULK)) {
+			ft1000dev->bulk_in_endpointAddr =
+				endpoint->bEndpointAddress;
+			DEBUG("ft1000_probe: in: %d\n",
+			      endpoint->bEndpointAddress);
 		}
 
-		if (!(endpoint->bEndpointAddress & USB_DIR_IN) && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK)) {
-			ft1000dev->bulk_out_endpointAddr = endpoint->bEndpointAddress;
-			DEBUG("ft1000_probe: out: %d\n", endpoint->bEndpointAddress);
+		if (!(endpoint->bEndpointAddress & USB_DIR_IN)
+		    && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+			USB_ENDPOINT_XFER_BULK)) {
+			ft1000dev->bulk_out_endpointAddr =
+				endpoint->bEndpointAddress;
+			DEBUG("ft1000_probe: out: %d\n",
+			      endpoint->bEndpointAddress);
 		}
     }
 
-    DEBUG("bulk_in=%d, bulk_out=%d\n", ft1000dev->bulk_in_endpointAddr, ft1000dev->bulk_out_endpointAddr);
+	DEBUG("bulk_in=%d, bulk_out=%d\n", ft1000dev->bulk_in_endpointAddr,
+	      ft1000dev->bulk_out_endpointAddr);
 
 	ret = request_firmware(&dsp_fw, "ft3000.img", &dev->dev);
 	if (ret < 0) {
@@ -164,7 +186,8 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device
 	}
 
 	gPollingfailed = FALSE;
-    pft1000info->pPollThread = kthread_run(ft1000_poll_thread, ft1000dev, "ft1000_poll");
+	pft1000info->pPollThread =
+	    kthread_run(ft1000_poll_thread, ft1000dev, "ft1000_poll");
 	msleep(500);
 
 	while (!pft1000info->CardReady) {
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] staging:ft1000: replace and remove c99 comments.
  2010-10-14  9:40 [PATCH 0/5]staging:ft1000:various code cleanup Marek Belisko
  2010-10-14  9:40 ` [PATCH 1/5] staging:ft1000: various checkpatch.pl fixes Marek Belisko
  2010-10-14  9:40 ` [PATCH 2/5] staging:ft1000: lines over 80 characters corrected Marek Belisko
@ 2010-10-14  9:40 ` Marek Belisko
  2010-10-14  9:40 ` [PATCH 4/5] staging:ft1000: correct indentations for ft1000_usb.c file Marek Belisko
  2010-10-14  9:41 ` [PATCH 5/5] staging:ft1000: remove dead code Marek Belisko
  4 siblings, 0 replies; 6+ messages in thread
From: Marek Belisko @ 2010-10-14  9:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Marek Belisko, Arnd Bergmann, devel, linux-kernel
  Cc: Marek Belisko

Comments for probe, disconnect, init and exit functions
removed completely (functions names are self explaining).

Signed-off-by: Marek Belisko <marek.belisko@gmail.com>
---
 drivers/staging/ft1000/ft1000-usb/ft1000_usb.c |   67 +++--------------------
 1 files changed, 9 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
index fc817cb..c6aec27 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
@@ -1,11 +1,12 @@
-//=====================================================
-// CopyRight (C) 2007 Qualcomm Inc. All Rights Reserved.
-//
-//
-// This file is part of Express Card USB Driver
-//
-// $Id:
-//====================================================
+/*=====================================================
+ * CopyRight (C) 2007 Qualcomm Inc. All Rights Reserved.
+ *
+ *
+ * This file is part of Express Card USB Driver
+ *
+ * $Id:
+ *====================================================
+ */
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -54,20 +55,6 @@ int ft1000_poll_thread(void *arg)
 	return STATUS_SUCCESS;
 }
 
-
-
-//---------------------------------------------------------------------------
-// Function:    ft1000_probe
-//
-// Parameters:  struct usb_interface *interface  - passed by USB core
-//              struct usb_device_id *id         - passed by USB core
-// Returns:     0 - success
-//
-// Description: This function is invoked when the express card is plugged in
-//
-// Notes:
-//
-//---------------------------------------------------------------------------
 static int ft1000_probe(struct usb_interface *interface,
 			const struct usb_device_id *id)
 {
@@ -219,18 +206,6 @@ err_fw:
 	return ret;
 }
 
-//---------------------------------------------------------------------------
-// Function:    ft1000_disconnect
-//
-// Parameters:  struct usb_interface *interface  - passed by USB core
-//
-// Returns:     0 - success
-//
-// Description: This function is invoked when the express card is plugged out
-//
-// Notes:
-//
-//---------------------------------------------------------------------------
 static void ft1000_disconnect(struct usb_interface *interface)
 {
     FT1000_INFO *pft1000info;
@@ -277,18 +252,6 @@ static struct usb_driver ft1000_usb_driver = {
     .id_table = id_table,
 };
 
-//---------------------------------------------------------------------------
-// Function:    usb_ft1000_init
-//
-// Parameters:  none
-//
-// Returns:     0 - success
-//
-// Description: The entry point of the module, register the usb driver
-//
-// Notes:
-//
-//---------------------------------------------------------------------------
 static int __init usb_ft1000_init(void)
 {
     int ret = 0;
@@ -302,18 +265,6 @@ static int __init usb_ft1000_init(void)
     return ret;
 }
 
-//---------------------------------------------------------------------------
-// Function:    usb_ft1000_exit
-//
-// Parameters:
-//
-// Returns:
-//
-// Description: Moudle unload function, deregister usb driver
-//
-// Notes:
-//
-//---------------------------------------------------------------------------
 static void __exit usb_ft1000_exit(void)
 {
     DEBUG("Deregister the driver\n");
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] staging:ft1000: correct indentations for ft1000_usb.c file.
  2010-10-14  9:40 [PATCH 0/5]staging:ft1000:various code cleanup Marek Belisko
                   ` (2 preceding siblings ...)
  2010-10-14  9:40 ` [PATCH 3/5] staging:ft1000: replace and remove c99 comments Marek Belisko
@ 2010-10-14  9:40 ` Marek Belisko
  2010-10-14  9:41 ` [PATCH 5/5] staging:ft1000: remove dead code Marek Belisko
  4 siblings, 0 replies; 6+ messages in thread
From: Marek Belisko @ 2010-10-14  9:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Marek Belisko, Arnd Bergmann, devel, linux-kernel
  Cc: Marek Belisko

Signed-off-by: Marek Belisko <marek.belisko@gmail.com>
---
 drivers/staging/ft1000/ft1000-usb/ft1000_usb.c |  165 +++++++++++------------
 1 files changed, 79 insertions(+), 86 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
index c6aec27..44c475b 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
@@ -22,17 +22,16 @@ MODULE_DESCRIPTION("FT1000 EXPRESS CARD DRIVER");
 MODULE_LICENSE("Dual MPL/GPL");
 MODULE_SUPPORTED_DEVICE("QFT FT1000 Express Cards");
 
-
 void *pFileStart;
 size_t FileLength;
 
-#define VENDOR_ID 0x1291   /* Qualcomm vendor id */
-#define PRODUCT_ID 0x11    /* fake product id */
+#define VENDOR_ID 0x1291	/* Qualcomm vendor id */
+#define PRODUCT_ID 0x11		/* fake product id */
 
 /* table of devices that work with this driver */
 static struct usb_device_id id_table[] = {
-    {USB_DEVICE(VENDOR_ID, PRODUCT_ID)},
-    { },
+	{USB_DEVICE(VENDOR_ID, PRODUCT_ID)},
+	{},
 };
 
 MODULE_DEVICE_TABLE(usb, id_table);
@@ -40,35 +39,34 @@ MODULE_DEVICE_TABLE(usb, id_table);
 static BOOLEAN gPollingfailed = FALSE;
 int ft1000_poll_thread(void *arg)
 {
-    int ret = STATUS_SUCCESS;
-
-    while (!kthread_should_stop()) {
-        msleep(10);
-        if (!gPollingfailed) {
-            ret = ft1000_poll(arg);
-            if (ret != STATUS_SUCCESS) {
-                DEBUG("ft1000_poll_thread: polling failed\n");
-                gPollingfailed = TRUE;
-            }
-        }
-    }
+	int ret = STATUS_SUCCESS;
+
+	while (!kthread_should_stop()) {
+		msleep(10);
+		if (!gPollingfailed) {
+			ret = ft1000_poll(arg);
+			if (ret != STATUS_SUCCESS) {
+				DEBUG("ft1000_poll_thread: polling failed\n");
+				gPollingfailed = TRUE;
+			}
+		}
+	}
 	return STATUS_SUCCESS;
 }
 
 static int ft1000_probe(struct usb_interface *interface,
 			const struct usb_device_id *id)
 {
-    struct usb_host_interface *iface_desc;
-    struct usb_endpoint_descriptor *endpoint;
-    struct usb_device *dev;
-    unsigned numaltsetting;
+	struct usb_host_interface *iface_desc;
+	struct usb_endpoint_descriptor *endpoint;
+	struct usb_device *dev;
+	unsigned numaltsetting;
 	int i, ret = 0, size;
 
-    struct ft1000_device *ft1000dev;
-    FT1000_INFO *pft1000info;
+	struct ft1000_device *ft1000dev;
+	FT1000_INFO *pft1000info;
 	const struct firmware *dsp_fw;
 
-
 	ft1000dev = kmalloc(sizeof(struct ft1000_device), GFP_KERNEL);
 
 	if (!ft1000dev) {
@@ -76,10 +74,10 @@ static int ft1000_probe(struct usb_interface *interface,
 		return 0;
 	}
 
-    memset(ft1000dev, 0, sizeof(*ft1000dev));
+	memset(ft1000dev, 0, sizeof(*ft1000dev));
 
-    dev = interface_to_usbdev(interface);
-    DEBUG("ft1000_probe: usb device descriptor info:\n");
+	dev = interface_to_usbdev(interface);
+	DEBUG("ft1000_probe: usb device descriptor info:\n");
 	DEBUG("ft1000_probe: number of configuration is %d\n",
 	      dev->descriptor.bNumConfigurations);
 
@@ -90,11 +88,10 @@ static int ft1000_probe(struct usb_interface *interface,
 	ft1000dev->tx_urb = usb_alloc_urb(0, GFP_ATOMIC);
 	ft1000dev->rx_urb = usb_alloc_urb(0, GFP_ATOMIC);
 
-
-    DEBUG("ft1000_probe is called\n");
-    numaltsetting = interface->num_altsetting;
-    DEBUG("ft1000_probe: number of alt settings is :%d\n", numaltsetting);
-    iface_desc = interface->cur_altsetting;
+	DEBUG("ft1000_probe is called\n");
+	numaltsetting = interface->num_altsetting;
+	DEBUG("ft1000_probe: number of alt settings is :%d\n", numaltsetting);
+	iface_desc = interface->cur_altsetting;
 	DEBUG("ft1000_probe: number of endpoints is %d\n",
 	      iface_desc->desc.bNumEndpoints);
 	DEBUG("ft1000_probe: descriptor type is %d\n",
@@ -105,7 +102,7 @@ static int ft1000_probe(struct usb_interface *interface,
 	      iface_desc->desc.bAlternateSetting);
 	DEBUG("ft1000_probe: interface class is %d\n",
 	      iface_desc->desc.bInterfaceClass);
-    DEBUG("ft1000_probe: control endpoint info:\n");
+	DEBUG("ft1000_probe: control endpoint info:\n");
 	DEBUG("ft1000_probe: descriptor0 type -- %d\n",
 	      iface_desc->endpoint[0].desc.bmAttributes);
 	DEBUG("ft1000_probe: descriptor1 type -- %d\n",
@@ -113,18 +110,18 @@ static int ft1000_probe(struct usb_interface *interface,
 	DEBUG("ft1000_probe: descriptor2 type -- %d\n",
 	      iface_desc->endpoint[2].desc.bmAttributes);
 
-    for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
+	for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
 		endpoint =
-		    (struct usb_endpoint_descriptor *)&iface_desc->endpoint[i].
-		    desc;
-                DEBUG("endpoint %d\n", i);
+		    (struct usb_endpoint_descriptor *)&iface_desc->
+		    endpoint[i].desc;
+		DEBUG("endpoint %d\n", i);
 		DEBUG("bEndpointAddress=%x, bmAttributes=%x\n",
 		      endpoint->bEndpointAddress, endpoint->bmAttributes);
 		if ((endpoint->bEndpointAddress & USB_DIR_IN)
 		    && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
 			USB_ENDPOINT_XFER_BULK)) {
 			ft1000dev->bulk_in_endpointAddr =
-				endpoint->bEndpointAddress;
+			    endpoint->bEndpointAddress;
 			DEBUG("ft1000_probe: in: %d\n",
 			      endpoint->bEndpointAddress);
 		}
@@ -133,11 +130,11 @@ static int ft1000_probe(struct usb_interface *interface,
 		    && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
 			USB_ENDPOINT_XFER_BULK)) {
 			ft1000dev->bulk_out_endpointAddr =
-				endpoint->bEndpointAddress;
+			    endpoint->bEndpointAddress;
 			DEBUG("ft1000_probe: out: %d\n",
 			      endpoint->bEndpointAddress);
 		}
-    }
+	}
 
 	DEBUG("bulk_in=%d, bulk_out=%d\n", ft1000dev->bulk_in_endpointAddr,
 	      ft1000dev->bulk_out_endpointAddr);
@@ -161,9 +158,9 @@ static int ft1000_probe(struct usb_interface *interface,
 	FileLength = dsp_fw->size;
 	release_firmware(dsp_fw);
 
-    DEBUG("ft1000_probe: start downloading dsp image...\n");
-    init_ft1000_netdev(ft1000dev);
-    pft1000info = (FT1000_INFO *) netdev_priv(ft1000dev->net);
+	DEBUG("ft1000_probe: start downloading dsp image...\n");
+	init_ft1000_netdev(ft1000dev);
+	pft1000info = (FT1000_INFO *) netdev_priv(ft1000dev->net);
 
 	DEBUG("In probe: pft1000info=%p\n", pft1000info);
 	ret = dsp_reload(ft1000dev);
@@ -188,16 +185,15 @@ static int ft1000_probe(struct usb_interface *interface,
 		DEBUG("ft1000_probe::Waiting for Card Ready\n");
 	}
 
+	DEBUG("ft1000_probe::Card Ready!!!! Registering network device\n");
 
-    DEBUG("ft1000_probe::Card Ready!!!! Registering network device\n");
-
-    reg_ft1000_netdev(ft1000dev, interface);
+	reg_ft1000_netdev(ft1000dev, interface);
 
-    pft1000info->NetDevRegDone = 1;
+	pft1000info->NetDevRegDone = 1;
 
-		ft1000InitProc(ft1000dev->net);
+	ft1000InitProc(ft1000dev->net);
 
-       return 0;
+	return 0;
 
 err_load:
 	kfree(pFileStart);
@@ -208,70 +204,67 @@ err_fw:
 
 static void ft1000_disconnect(struct usb_interface *interface)
 {
-    FT1000_INFO *pft1000info;
+	FT1000_INFO *pft1000info;
 
-    DEBUG("ft1000_disconnect is called\n");
+	DEBUG("ft1000_disconnect is called\n");
 
-    pft1000info = (PFT1000_INFO)usb_get_intfdata(interface);
+	pft1000info = (PFT1000_INFO) usb_get_intfdata(interface);
 	DEBUG("In disconnect pft1000info=%p\n", pft1000info);
 
-
-
-    if (pft1000info) {
+	if (pft1000info) {
 		ft1000CleanupProc(pft1000info);
-        if (pft1000info->pPollThread)
-            kthread_stop(pft1000info->pPollThread );
+		if (pft1000info->pPollThread)
+			kthread_stop(pft1000info->pPollThread);
 
-        DEBUG("ft1000_disconnect: threads are terminated\n");
+		DEBUG("ft1000_disconnect: threads are terminated\n");
 
-        if (pft1000info->pFt1000Dev->net) {
-            DEBUG("ft1000_disconnect: destroy char driver\n");
-            ft1000_DestroyDevice(pft1000info->pFt1000Dev->net);
-            unregister_netdev(pft1000info->pFt1000Dev->net);
-            DEBUG("ft1000_disconnect: network device unregisterd\n");
-            free_netdev(pft1000info->pFt1000Dev->net);
+		if (pft1000info->pFt1000Dev->net) {
+			DEBUG("ft1000_disconnect: destroy char driver\n");
+			ft1000_DestroyDevice(pft1000info->pFt1000Dev->net);
+			unregister_netdev(pft1000info->pFt1000Dev->net);
+			DEBUG
+			    ("ft1000_disconnect: network device unregisterd\n");
+			free_netdev(pft1000info->pFt1000Dev->net);
 
-        }
+		}
 
-        usb_free_urb(pft1000info->pFt1000Dev->rx_urb);
-        usb_free_urb(pft1000info->pFt1000Dev->tx_urb);
+		usb_free_urb(pft1000info->pFt1000Dev->rx_urb);
+		usb_free_urb(pft1000info->pFt1000Dev->tx_urb);
 
-        DEBUG("ft1000_disconnect: urb freed\n");
+		DEBUG("ft1000_disconnect: urb freed\n");
 
 		kfree(pft1000info->pFt1000Dev);
-    }
+	}
 	kfree(pFileStart);
 
-    return;
+	return;
 }
 
 static struct usb_driver ft1000_usb_driver = {
-    .name  =    "ft1000usb",
-    .probe =    ft1000_probe,
-    .disconnect = ft1000_disconnect,
-    .id_table = id_table,
+	.name = "ft1000usb",
+	.probe = ft1000_probe,
+	.disconnect = ft1000_disconnect,
+	.id_table = id_table,
 };
 
 static int __init usb_ft1000_init(void)
 {
-    int ret = 0;
+	int ret = 0;
 
-    DEBUG("Initialize and register the driver\n");
+	DEBUG("Initialize and register the driver\n");
 
-    ret = usb_register(&ft1000_usb_driver);
-    if (ret)
-        err("usb_register failed. Error number %d", ret);
+	ret = usb_register(&ft1000_usb_driver);
+	if (ret)
+		err("usb_register failed. Error number %d", ret);
 
-    return ret;
+	return ret;
 }
 
 static void __exit usb_ft1000_exit(void)
 {
-    DEBUG("Deregister the driver\n");
-    usb_deregister(&ft1000_usb_driver);
+	DEBUG("Deregister the driver\n");
+	usb_deregister(&ft1000_usb_driver);
 }
 
-module_init (usb_ft1000_init);
-module_exit (usb_ft1000_exit);
-
-
+module_init(usb_ft1000_init);
+module_exit(usb_ft1000_exit);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] staging:ft1000: remove dead code.
  2010-10-14  9:40 [PATCH 0/5]staging:ft1000:various code cleanup Marek Belisko
                   ` (3 preceding siblings ...)
  2010-10-14  9:40 ` [PATCH 4/5] staging:ft1000: correct indentations for ft1000_usb.c file Marek Belisko
@ 2010-10-14  9:41 ` Marek Belisko
  4 siblings, 0 replies; 6+ messages in thread
From: Marek Belisko @ 2010-10-14  9:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Marek Belisko, Arnd Bergmann, devel, linux-kernel
  Cc: Marek Belisko

was #ifdef so remove code which was under #else to make
code more readable.

Signed-off-by: Marek Belisko <marek.belisko@gmail.com>
---
 .../staging/ft1000/ft1000-usb/ft1000_download.c    |   79 +-------------------
 1 files changed, 2 insertions(+), 77 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index bbb2430..4e506aa 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -17,7 +17,6 @@
 #include <linux/vmalloc.h>
 #include "ft1000_usb.h"
 
-#define  FIFO_DNLD               1
 
 #define  DWNLD_HANDSHAKE_LOC     0x02
 #define  DWNLD_TYPE_LOC          0x04
@@ -140,9 +139,7 @@ static ULONG check_usb_db (struct ft1000_device *ft1000dev)
       {
            DEBUG("FT1000:Got checkusb doorbell\n");
            status = ft1000_write_register (ft1000dev, 0x0080, FT1000_REG_DOORBELL);
-#if FIFO_DNLD
            status = ft1000_write_register (ft1000dev, 0x0100, FT1000_REG_DOORBELL);
-#endif
            status = ft1000_write_register (ft1000dev,  0x8000, FT1000_REG_DOORBELL);
            break;
       }
@@ -214,7 +211,6 @@ static USHORT get_handshake(struct ft1000_device *ft1000dev, USHORT expected_val
    while (loopcnt < 100)
    {
 
-#if FIFO_DNLD
            // Need to clear downloader doorbell if Hartley ASIC
            status = ft1000_write_register (ft1000dev,  FT1000_DB_DNLD_RX, FT1000_REG_DOORBELL);
            //DEBUG("FT1000:get_handshake:doorbell = 0x%x\n", temp);
@@ -236,47 +232,6 @@ static USHORT get_handshake(struct ft1000_device *ft1000dev, USHORT expected_val
                 //DEBUG("get_handshake: handshake is %x\n", tempx);
                 handshake = ntohs(handshake);
                 //DEBUG("get_handshake: after swap, handshake is %x\n", handshake);
-#else
-           // Need to clear downloader doorbell if Hartley ASIC
-           status = ft1000_read_register (ft1000dev, &temp, FT1000_REG_DOORBELL);
-           //DEBUG("FT1000:get_handshake:doorbell = 0x%x\n", temp);
-           if (temp)
-           {
-               if (temp & FT1000_DB_DNLD_RX)
-               {
-                   //DEBUG("get_handshake: write FT1000_DB_DNLD_RX to doorbell register\n");
-                   status = ft1000_write_register(ft1000dev, FT1000_DB_DNLD_RX, FT1000_REG_DOORBELL);
-               }
-
-               if (pft1000info->fcodeldr)
-               {
-                   DEBUG(" get_handshake: fcodeldr is %d\n", pft1000info->fcodeldr);
-                   pft1000info->fcodeldr = 0;
-                   status = check_usb_db(ft1000dev);
-                   if (status != STATUS_SUCCESS)
-                   {
-                       DEBUG("get_handshake: check_usb_db failed\n");
-                       status = STATUS_FAILURE;
-                       break;
-                   }
-
-                   status = ft1000_read_register (ft1000dev, &temp, FT1000_REG_DOORBELL);
-                   //DEBUG("FT1000:get_handshake:doorbell = 0x%x\n", temp);
-                   if (temp)
-                   {
-                       if (temp & FT1000_DB_DNLD_RX)
-                           status = ft1000_write_register(ft1000dev,FT1000_DB_DNLD_RX, FT1000_REG_DOORBELL);
-                   }
-                }
-
-                status = ft1000_read_dpram16 (ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC, (PUCHAR)&handshake, 1);
-                //DEBUG("get_handshake: handshake is %x\n", tempx);
-                handshake = ntohs(handshake);
-                //DEBUG("get_handshake: after swap, handshake is %x\n", handshake);
-
-           } //end of if temp
-#endif
-
 
         if (status)
            return HANDSHAKE_TIMEOUT_VALUE;
@@ -318,7 +273,6 @@ static void put_handshake(struct ft1000_device *ft1000dev,USHORT handshake_value
 {
     ULONG tempx;
     USHORT tempword;
-    int i;
     ULONG status;
 
 
@@ -331,23 +285,6 @@ static void put_handshake(struct ft1000_device *ft1000dev,USHORT handshake_value
         tempword = (USHORT)(tempx >> 16);
         status = ft1000_write_dpram16 (ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC, tempword, 1);
         status = ft1000_write_register(ft1000dev, FT1000_DB_DNLD_TX, FT1000_REG_DOORBELL);
-#if FIFO_DNLD
-        for (i=0; i<1000; i++);
-#else
-        for (i=0; i<10; i++)
-        {
-            status = ft1000_read_register (ft1000dev, &tempword, FT1000_REG_DOORBELL);
-            if ((tempword & FT1000_DB_DNLD_TX) == 0)
-                break;
-        }
-        if (i==10)
-        {
-            DEBUG("FT1000:put_handshake could not clear Tx doorbell\n");
-            status = ft1000_read_register (ft1000dev, &tempword, FT1000_REG_DOORBELL);
-            DEBUG("FT1000:put_handshake:doorbell = 0x%x\n",tempword);
-        }
-#endif
-
 }
 
 static USHORT get_handshake_usb(struct ft1000_device *ft1000dev, USHORT expected_value)
@@ -424,12 +361,8 @@ static USHORT get_request_type(struct ft1000_device *ft1000dev)
    }
    else
    {
-#if FIFO_DNLD
        tempx = 0;
-#else
-       status = ft1000_read_dpram16 (ft1000dev, DWNLD_MAG1_TYPE_LOC, (PUCHAR)&tempword, 0);
-       tempx = tempword;
-#endif
+
        status = ft1000_read_dpram16 (ft1000dev, DWNLD_MAG1_TYPE_LOC, (PUCHAR)&tempword, 1);
        tempx |= (tempword << 16);
        tempx = ntohl(tempx);
@@ -533,10 +466,8 @@ static long get_request_value_usb(struct ft1000_device *ft1000dev)
        value |= (tempword << 16);
        value = ntohl(value);
 
-#if FIFO_DNLD
    if (pft1000info->usbboot == 1)
        pft1000info->usbboot = 2;
-#endif
 
    //DEBUG("get_request_value_usb: value is %x\n", value);
    return value;
@@ -1056,9 +987,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG  FileLe
                }
                break;
             case  REQUEST_DONE_CL:
-#if FIFO_DNLD
                pft1000info->usbboot = 3;
-#endif
                /* Reposition ptrs to beginning of provisioning section */
                   pUsFile = (USHORT *)(pFileStart + pFileHdr5->commands_offset);
                   pUcFile = (UCHAR *)(pFileStart + pFileHdr5->commands_offset);
@@ -1104,7 +1033,6 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG  FileLe
 			word_length++;
 		   word_length = word_length / 2;
 
-#if FIFO_DNLD
    	       write_blk_fifo (ft1000dev, &pUsFile, &pUcFile, word_length);
                if (pft1000info->usbboot == 0)
                    pft1000info->usbboot++;
@@ -1112,10 +1040,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG  FileLe
                    tempword = 0;
                    ft1000_write_dpram16 (ft1000dev, DWNLD_MAG1_PS_HDR_LOC, tempword, 0);
                }
-#else
-   	       write_blk (ft1000dev, &pUsFile, &pUcFile, word_length);
-   	       //ft1000_write_dpram32 (ft1000dev, dpram, (PUCHAR)pUcFile, word_length);
-#endif
+
                break;
 
             case  REQUEST_MAILBOX_DATA:
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-10-14 13:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-14  9:40 [PATCH 0/5]staging:ft1000:various code cleanup Marek Belisko
2010-10-14  9:40 ` [PATCH 1/5] staging:ft1000: various checkpatch.pl fixes Marek Belisko
2010-10-14  9:40 ` [PATCH 2/5] staging:ft1000: lines over 80 characters corrected Marek Belisko
2010-10-14  9:40 ` [PATCH 3/5] staging:ft1000: replace and remove c99 comments Marek Belisko
2010-10-14  9:40 ` [PATCH 4/5] staging:ft1000: correct indentations for ft1000_usb.c file Marek Belisko
2010-10-14  9:41 ` [PATCH 5/5] staging:ft1000: remove dead code Marek Belisko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.