Skip to contentSkip to conversation

staging: silicom: coding style fixes for bp_proc.c

PATCH In review Chad Williamson 2 participants 7 messages Oct 15, 2012 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: silicom: coding style fixes for bp_proc.c

This patch set corrects many of the coding style issues detected by checkpatch.pl in bp_proc.c.

Chad Williamson (5):
staging: silicom: fix whitespace in bp_proc.c
staging: silicom: fix C99 comments in bp_proc.c
staging: silicom: remove parentheses from return statements in bg_proc.c
staging: silicom: remove unnecessary braces in bp_proc.c
staging: silicom: fix explicit intialization of procfs_dir in bp_proc.c

 drivers/staging/silicom/bp_proc.c | 82 +++++++++++++++------------------------
 1 file changed, 31 insertions(+), 51 deletions(-)
Signature · 1 line
1.7.12.2
#1 lore raw

PATCH 1/5 staging: silicom: fix whitespace in bp_proc.c

Remove superfluous spaces in bp_proc.c to resolve checkpatch.pl errors.

---
 drivers/staging/silicom/bp_proc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/silicom/bp_proc.c +6 -6
index 6ad4b27..f7b4699 100644
@@ -11,7 +11,7 @@
 /******************************************************************************/
 
 #include <linux/version.h>
-#if defined(CONFIG_SMP) && ! defined(__SMP__)
+#if defined(CONFIG_SMP) && !defined(__SMP__)
 #define __SMP__
 #endif
 
@@ -24,7 +24,7 @@
 #define BP_PROC_DIR "bypass"
 //#define BYPASS_SUPPORT "bypass"
 
-#ifdef  BYPASS_SUPPORT
+#ifdef BYPASS_SUPPORT
 
 #define GPIO6_SET_ENTRY_SD           "gpio6_set"
 #define GPIO6_CLEAR_ENTRY_SD         "gpio6_clear"
@@ -98,8 +98,8 @@ static struct proc_dir_entry *proc_getdir(char *name,
 int
 bypass_proc_create_entry_sd(struct pfs_unit *pfs_unit_curr,
 			    char *proc_name,
-			    write_proc_t * write_proc,
-			    read_proc_t * read_proc,
+			    write_proc_t *write_proc,
+			    read_proc_t *read_proc,
 			    struct proc_dir_entry *parent_pfs, void *data)
 {
 	strcpy(pfs_unit_curr->proc_name, proc_name);
@@ -1147,7 +1147,7 @@ set_hw_reset_pfs(struct file *file, const char *buffer,
 
 #endif				/*PMC_FIX_FLAG */
 
-int bypass_proc_create_dev_sd(bpctl_dev_t * pbp_device_block)
+int bypass_proc_create_dev_sd(bpctl_dev_t *pbp_device_block)
 {
 	struct bypass_pfs_sd *current_pfs = &(pbp_device_block->bypass_pfs_set);
 	static struct proc_dir_entry *procfs_dir = NULL;
@@ -1327,7 +1327,7 @@ int bypass_proc_create_dev_sd(bpctl_dev_t * pbp_device_block)
 	return ret;
 }
 
-int bypass_proc_remove_dev_sd(bpctl_dev_t * pbp_device_block)
+int bypass_proc_remove_dev_sd(bpctl_dev_t *pbp_device_block)
 {
 
 	struct bypass_pfs_sd *current_pfs = &pbp_device_block->bypass_pfs_set;
Signature · 1 line
1.7.12.2
#2 lore raw

PATCH 2/5 staging: silicom: fix C99 comments in bp_proc.c

In reply to Chad Williamson

Fix C99 // comments in bp_proc.c to resolve checkpatch.pl errors.

---
 drivers/staging/silicom/bp_proc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/silicom/bp_proc.c +3 -3
index f7b4699..4599cc9 100644
@@ -18,11 +18,11 @@
 #include <linux/proc_fs.h>
 #include <linux/netdevice.h>
 #include <asm/uaccess.h>
-//#include <linux/smp_lock.h>
+/* #include <linux/smp_lock.h> */
 #include "bp_mod.h"
 
 #define BP_PROC_DIR "bypass"
-//#define BYPASS_SUPPORT "bypass"
+/* #define BYPASS_SUPPORT "bypass" */
 
 #ifdef BYPASS_SUPPORT
 
@@ -70,7 +70,7 @@
 #define DISC_CHANGE_ENTRY_SD      "disc_change"
 #define DIS_DISC_ENTRY_SD         "dis_disc"
 #define DISC_PWUP_ENTRY_SD        "disc_pwup"
-#endif				//bypass_support
+#endif	/* bypass_support */
 static struct proc_dir_entry *bp_procfs_dir;
 
 static struct proc_dir_entry *proc_getdir(char *name,
Signature · 1 line
1.7.12.2
#3 lore raw

PATCH 3/5 staging: silicom: remove parentheses from return statements in bg_proc.c

In reply to Chad Williamson

Remove unnecessary parentheses from return statements in bg_proc.c to resolve checkpatch.pl errors.

---
 drivers/staging/silicom/bp_proc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/silicom/bp_proc.c +2 -2
index 4599cc9..aa084ef 100644
@@ -87,10 +87,10 @@ static struct proc_dir_entry *proc_getdir(char *name,
 		/* create the directory */
 		pde = create_proc_entry(name, S_IFDIR, proc_dir);
 		if (pde == (struct proc_dir_entry *)0) {
-			return (pde);
+			return pde;
 		}
 	}
-	return (pde);
+	return pde;
 }
 
 #ifdef BYPASS_SUPPORT
Signature · 1 line
1.7.12.2
#4 lore raw

PATCH 4/5 staging: silicom: remove unnecessary braces in bp_proc.c

In reply to Chad Williamson

Remove unnecessary braces from single statement blocks in bp_proc.c, resolving checkpatch.pl warnings.

---
 drivers/staging/silicom/bp_proc.c | 58 +++++++++++++--------------------------
 1 file changed, 19 insertions(+), 39 deletions(-)
drivers/staging/silicom/bp_proc.c +19 -39
index aa084ef..0f110aa 100644
@@ -86,9 +86,8 @@ static struct proc_dir_entry *proc_getdir(char *name,
 	if (pde == (struct proc_dir_entry *)0) {
 		/* create the directory */
 		pde = create_proc_entry(name, S_IFDIR, proc_dir);
-		if (pde == (struct proc_dir_entry *)0) {
+		if (pde == (struct proc_dir_entry *)0)
 			return pde;
-		}
 	}
 	return pde;
 }
@@ -107,10 +106,8 @@ bypass_proc_create_entry_sd(struct pfs_unit *pfs_unit_curr,
 						      S_IFREG | S_IRUSR |
 						      S_IWUSR | S_IRGRP |
 						      S_IROTH, parent_pfs);
-	if (pfs_unit_curr->proc_entry == 0) {
-
+	if (pfs_unit_curr->proc_entry == 0)
 		return -1;
-	}
 
 	pfs_unit_curr->proc_entry->read_proc = read_proc;
 	pfs_unit_curr->proc_entry->write_proc = write_proc;
@@ -207,9 +204,8 @@ set_bypass_pfs(struct file *file, const char *buffer,
 	if (count > (sizeof(kbuf) - 1))
 		return -1;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	kbuf[count] = '\0';
 	length = strlen(kbuf);
@@ -239,9 +235,8 @@ set_tap_pfs(struct file *file, const char *buffer,
 	if (count > (sizeof(kbuf) - 1))
 		return -1;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	kbuf[count] = '\0';
 	length = strlen(kbuf);
@@ -271,9 +266,8 @@ set_disc_pfs(struct file *file, const char *buffer,
 	if (count > (sizeof(kbuf) - 1))
 		return -1;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	kbuf[count] = '\0';
 	length = strlen(kbuf);
@@ -421,9 +415,8 @@ set_bypass_wd_pfs(struct file *file, const char *buffer,
 	unsigned int timeout = 0;
 	char *timeout_ptr = kbuf;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	timeout_ptr = kbuf;
 	timeout = atoi(&timeout_ptr);
@@ -570,9 +563,8 @@ set_dis_bypass_pfs(struct file *file, const char *buffer,
 
 	int bypass_param = 0, length = 0;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	kbuf[count] = '\0';
 	length = strlen(kbuf);
@@ -599,9 +591,8 @@ set_dis_tap_pfs(struct file *file, const char *buffer,
 
 	int tap_param = 0, length = 0;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	kbuf[count] = '\0';
 	length = strlen(kbuf);
@@ -628,9 +619,8 @@ set_dis_disc_pfs(struct file *file, const char *buffer,
 
 	int tap_param = 0, length = 0;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	kbuf[count] = '\0';
 	length = strlen(kbuf);
@@ -717,9 +707,8 @@ set_bypass_pwup_pfs(struct file *file, const char *buffer,
 
 	int bypass_param = 0, length = 0;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	kbuf[count] = '\0';
 	length = strlen(kbuf);
@@ -746,9 +735,8 @@ set_bypass_pwoff_pfs(struct file *file, const char *buffer,
 
 	int bypass_param = 0, length = 0;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	kbuf[count] = '\0';
 	length = strlen(kbuf);
@@ -775,9 +763,8 @@ set_tap_pwup_pfs(struct file *file, const char *buffer,
 
 	int tap_param = 0, length = 0;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	kbuf[count] = '\0';
 	length = strlen(kbuf);
@@ -804,9 +791,8 @@ set_disc_pwup_pfs(struct file *file, const char *buffer,
 
 	int tap_param = 0, length = 0;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	kbuf[count] = '\0';
 	length = strlen(kbuf);
@@ -913,9 +899,8 @@ set_std_nic_pfs(struct file *file, const char *buffer,
 
 	int bypass_param = 0, length = 0;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	kbuf[count] = '\0';
 	length = strlen(kbuf);
@@ -988,9 +973,8 @@ set_wd_exp_mode_pfs(struct file *file, const char *buffer,
 	if (count > (sizeof(kbuf) - 1))
 		return -1;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	kbuf[count] = '\0';
 	length = strlen(kbuf);
@@ -1036,9 +1020,8 @@ set_wd_autoreset_pfs(struct file *file, const char *buffer,
 	u32 timeout = 0;
 	char *timeout_ptr = kbuf;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	timeout_ptr = kbuf;
 	timeout = atoi(&timeout_ptr);
@@ -1061,9 +1044,8 @@ set_tpl_pfs(struct file *file, const char *buffer,
 	if (count > (sizeof(kbuf) - 1))
 		return -1;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	kbuf[count] = '\0';
 	length = strlen(kbuf);
@@ -1094,9 +1076,8 @@ set_wait_at_pwup_pfs(struct file *file, const char *buffer,
 	if (count > (sizeof(kbuf) - 1))
 		return -1;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	kbuf[count] = '\0';
 	length = strlen(kbuf);
@@ -1126,9 +1107,8 @@ set_hw_reset_pfs(struct file *file, const char *buffer,
 	if (count > (sizeof(kbuf) - 1))
 		return -1;
 
-	if (copy_from_user(&kbuf, buffer, count)) {
+	if (copy_from_user(&kbuf, buffer, count))
 		return -1;
-	}
 
 	kbuf[count] = '\0';
 	length = strlen(kbuf);
Signature · 1 line
1.7.12.2
#5 lore raw

PATCH 5/5 staging: silicom: fix explicit intialization of procfs_dir in bp_proc.c

In reply to Chad Williamson

Remove explicit intialization of static procfs_dir to NULL, resolving a checkpatch.pl error.

---
 drivers/staging/silicom/bp_proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/silicom/bp_proc.c +1 -1
index 0f110aa..37f998c 100644
@@ -1130,7 +1130,7 @@ set_hw_reset_pfs(struct file *file, const char *buffer,
 int bypass_proc_create_dev_sd(bpctl_dev_t *pbp_device_block)
 {
 	struct bypass_pfs_sd *current_pfs = &(pbp_device_block->bypass_pfs_set);
-	static struct proc_dir_entry *procfs_dir = NULL;
+	static struct proc_dir_entry *procfs_dir;
 	int ret = 0;
 
 	sprintf(current_pfs->dir_name, "bypass_%s", dev->name);
Signature · 1 line
1.7.12.2
#6 lore raw
In reply to Chad Williamson
Quoted 10 lines · Chad Williamson

This patch set corrects many of the coding style issues detected by checkpatch.pl in bp_proc.c.

Chad Williamson (5):
staging: silicom: fix whitespace in bp_proc.c
staging: silicom: fix C99 comments in bp_proc.c
staging: silicom: remove parentheses from return statements in bg_proc.c
staging: silicom: remove unnecessary braces in bp_proc.c
staging: silicom: fix explicit intialization of procfs_dir in bp_proc.c

Quoted 6 lines
 drivers/staging/silicom/bp_proc.c | 82 +++++++++++++++------------------------
 1 file changed, 31 insertions(+), 51 deletions(-)
Signature · 1 line
1.7.12.2

Looks good to me (and as soon as asrock support pulls their head out I'll run HW tests).

Regards,
Daniel Cotey