Skip to contentSkip to conversation

staging/ft1000: fix the no brace needed warning in ft1000_interrupt

PATCH In review Devendra Naga 2 participants 9 messages Jul 7, 2012 – Jul 9, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/8 staging/ft1000: fix the no brace needed warning in ft1000_interrupt

as the if statement encloses only one line braces around it are not needed.

The following warn fixed,
WARNING: braces {} are not necessary for single statement blocks

---
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +2 -3
index c4a8a0a..0bd080c 100644
@@ -1998,9 +1998,8 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id)
 
     // Make sure we process all interrupt before leaving the ISR due to the edge trigger interrupt type
     while (inttype) {
-	if (inttype & ISR_DOORBELL_PEND) {
-		ft1000_parse_dpram_msg(dev);
-	}
+		if (inttype & ISR_DOORBELL_PEND)
+			ft1000_parse_dpram_msg(dev);
 
 	if (inttype & ISR_RCV) {
 		DEBUG(1, "Data in FIFO\n");
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/8 staging/ft1000: fix the spaces issue at the start of line

The following warns fixed

drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c:2032: ERROR: code indent should use tabs where possible drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c:2032: WARNING: please, no spaces at the start of a line

---
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +1 -1
index 0bd080c..c709671 100644
@@ -2029,7 +2029,7 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id)
 	ft1000_write_reg(dev, FT1000_REG_SUP_ISR, tempword);
 
         // Read interrupt type
-        inttype = ft1000_read_reg (dev, FT1000_REG_SUP_ISR);
+		inttype = ft1000_read_reg (dev, FT1000_REG_SUP_ISR);
         DEBUG(1,"ft1000_hw: interrupt status register after clear = 0x%x\n",inttype);
     }
 	ft1000_enable_interrupts(dev);
Signature · 1 line
1.7.9.5
maintainer
#2 lore raw

Re: [PATCH 2/8] staging/ft1000: fix the spaces issue at the start of line

Quoted 15 lines · Devendra Naga

The following warns fixed

drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c:2032: ERROR: code indent should use tabs where possible drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c:2032: WARNING: please, no spaces at the start of a line

---
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +0 -0
index 0bd080c..c709671 100644

drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c static irqreturn_t ft1000_interrupt(int irq, void *dev_id) · line 2032

Quoted 5 lines
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +1 -1
@@ -2029,7 +2029,7 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id)
 	ft1000_write_reg(dev, FT1000_REG_SUP_ISR, tempword);
 
         // Read interrupt type
-        inttype = ft1000_read_reg (dev, FT1000_REG_SUP_ISR);
+		inttype = ft1000_read_reg (dev, FT1000_REG_SUP_ISR);

Did you just indent this one too many tabs? Remember, a tab is 8 spaces, this should have lined up wit the line above it. Which, for some odd reason, is also using spaces, so why didn't that get fixed also?

thanks,

greg k-h

#3 lore raw

PATCH 3/8 staging/ft1000: fix sparse warning

In reply to Devendra Naga

sparse warns about having 0 assigned to a pointer, fix it up by using NULL.

The following sparse warning is fixed

drivers/staging/ft1000/ft1000-usb/ft1000_debug.c:170:52: warning: Using plain integer as NULL pointer

---
 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/ft1000/ft1000-usb/ft1000_debug.c +1 -1
index 19db23f..6d911fd 100644
@@ -167,7 +167,7 @@ int ft1000_create_dev(struct ft1000_device *dev)
 		goto fail;
 	}
 
-	dir = debugfs_create_dir(info->DeviceName, 0);
+	dir = debugfs_create_dir(info->DeviceName, NULL);
 	if (IS_ERR(dir)) {
 		result = PTR_ERR(dir);
 		goto debug_dir_fail;
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/8 staging/ft1000: fix sparse warning about the kernel thread handler function

In reply to Devendra Naga

sparse throws warning about the ft1000_poll_thread as

drivers/staging/ft1000/ft1000-usb/ft1000_usb.c:40:5: warning: symbol 'ft1000_poll_thread' was not declared. Should it be static?

---
 drivers/staging/ft1000/ft1000-usb/ft1000_usb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/ft1000/ft1000-usb/ft1000_usb.c +1 -1
index bfead67..e434d33 100644
@@ -37,7 +37,7 @@ static struct usb_device_id id_table[] = {
 MODULE_DEVICE_TABLE(usb, id_table);
 
 static bool gPollingfailed = FALSE;
-int ft1000_poll_thread(void *arg)
+static int ft1000_poll_thread(void *arg)
 {
 	int ret = STATUS_SUCCESS;
 
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 5/8 staging/ft1000: fix the no brace needed warning in ft1000_read_fifo_len

In reply to Devendra Naga

as the if else statements enclose only one line, so braces around them are not needed.

The following warning is fixed

drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c:100: WARNING: braces {} are not necessary for any arm of this statement

---
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +2 -3
index c709671..67ad7ee 100644
@@ -97,11 +97,10 @@ static inline u16 ft1000_read_fifo_len(struct net_device *dev)
 {
 	struct ft1000_info *info = netdev_priv(dev);
 
-	if (info->AsicID == ELECTRABUZZ_ID) {
+	if (info->AsicID == ELECTRABUZZ_ID)
 		return (ft1000_read_reg(dev, FT1000_REG_UFIFO_STAT) - 16);
-	} else {
+	else
 		return (ft1000_read_reg(dev, FT1000_REG_MAG_UFSR) - 16);
-	}
 }
 
 //---------------------------------------------------------------------------
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 6/8 staging/ft1000: fix the foo * bar warning

In reply to Devendra Naga
---
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +1 -1
index 67ad7ee..9a5ba07 100644
@@ -115,7 +115,7 @@ static inline u16 ft1000_read_fifo_len(struct net_device *dev)
 //     value  - value of dpram
 //
 //---------------------------------------------------------------------------
-u16 ft1000_read_dpram(struct net_device * dev, int offset)
+u16 ft1000_read_dpram(struct net_device *dev, int offset)
 {
 	struct ft1000_info *info = netdev_priv(dev);
 	unsigned long flags;
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 7/8 staging/ft1000-pcmcia: fix checkpatch warnings

In reply to Devendra Naga

The below checkpatch warns fixed,

drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c:38: ERROR: that open brace { should be on the previous line drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c:45: ERROR: that open brace { should be on the previous line drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c:57: ERROR: that open brace { should be on the previous line

---
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c +4 -6
index 71aaad3..72727c6 100644
@@ -34,16 +34,14 @@
 
 #define PUTX_TO_PAGE(len, page, message, size, var) \
 	len += snprintf(page+len, PAGE_SIZE - len, message); \
-	for(i = 0; i < (size - 1); i++) \
-	{ \
+	for(i = 0; i < (size - 1); i++) { \
 		len += snprintf(page+len, PAGE_SIZE - len, "%02x:", var[i]); \
 	} \
 	len += snprintf(page+len, PAGE_SIZE - len, "%02x\n", var[i])
 
 #define PUTD_TO_PAGE(len, page, message, size, var) \
 	len += snprintf(page+len, PAGE_SIZE - len, message); \
-	for(i = 0; i < (size - 1); i++) \
-	{ \
+	for(i = 0; i < (size - 1); i++) { \
 		len += snprintf(page+len, PAGE_SIZE - len, "%d.", var[i]); \
 	} \
 	len += snprintf(page+len, PAGE_SIZE - len, "%d\n", var[i])
@@ -55,8 +53,8 @@ static int ft1000ReadProc(char *page, char **start, off_t off,
 	int len;
 	int i;
 	struct ft1000_info *info;
-	char *status[] =
-		{ "Idle (Disconnect)", "Searching", "Active (Connected)",
+	char *status[] = {
+		"Idle (Disconnect)", "Searching", "Active (Connected)",
 		"Waiting for L2", "Sleep", "No Coverage", "", ""
 	};
 	char *signal[] = { "", "*", "**", "***", "****" };
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 8/8 staging/ft1000: remove unnecessary assignment of ret with STATUS_SUCCESS

In reply to Devendra Naga

as ret is assigned to the return of ft1000_poll, we dont need to initialise ret with STATUS_SUCCESS.

---
 drivers/staging/ft1000/ft1000-usb/ft1000_usb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/ft1000/ft1000-usb/ft1000_usb.c +1 -1
index e434d33..7bd7fb2 100644
@@ -39,7 +39,7 @@ MODULE_DEVICE_TABLE(usb, id_table);
 static bool gPollingfailed = FALSE;
 static int ft1000_poll_thread(void *arg)
 {
-	int ret = STATUS_SUCCESS;
+	int ret;
 
 	while (!kthread_should_stop()) {
 		msleep(10);
Signature · 1 line
1.7.9.5