Skip to contentSkip to conversation

Code Styte

PATCH In review Ricardo Ribalda Delgado 2 participants 4 messages Feb 2, 2015 Staging

lore
Share & tools
lore
#0 lore raw

cover Code Styte

Fix minor code stype problems found by checkpatch.pl

Ricardo Ribalda Delgado (2):
staging/unisys/visorutil/procobjecttree: Code Style staging/unisys/visorutil/procobjecttree: Replace typedef

 drivers/staging/unisys/visorutil/procobjecttree.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/2 staging/unisys/visorutil/procobjecttree: Code Style

Lines should not be over 80 characters

---
 drivers/staging/unisys/visorutil/procobjecttree.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/unisys/visorutil/procobjecttree.c +5 -5
index 195772d..637c5ef 100644
@@ -260,9 +260,9 @@ MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type,
 		ERRDRV("out of memory\n");
 		goto Away;
 	}
-	obj->procDirProperties =
-		kzalloc((type->nProperties + 1) * sizeof(struct proc_dir_entry *),
-			GFP_KERNEL | __GFP_NORETRY);
+	obj->procDirProperties = kzalloc((type->nProperties + 1) *
+					 sizeof(struct proc_dir_entry *),
+					 GFP_KERNEL | __GFP_NORETRY);
 	if (obj->procDirProperties == NULL) {
 		ERRDRV("out of memory\n");
 		goto Away;
@@ -276,8 +276,8 @@ MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type,
 			/* only create properties that have names */
 			obj->procDirProperties[i] =
 				createProcFile(type->propertyNames[i],
-					       obj->procDir, &proc_fops,
-					       &obj->procDirPropertyContexts[i]);
+					obj->procDir, &proc_fops,
+					&obj->procDirPropertyContexts[i]);
 			if (obj->procDirProperties[i] == NULL) {
 				rc = NULL;
 				goto Away;
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/2 staging/unisys/visorutil/procobjecttree: Replace typedef

In reply to Ricardo Ribalda Delgado

Instead of declaring a new type, define a new struct.

---
 drivers/staging/unisys/visorutil/procobjecttree.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/staging/unisys/visorutil/procobjecttree.c +8 -5
index 637c5ef..fb5df92 100644
@@ -25,12 +25,12 @@
  *  need in order to call the callback function that supplies the /proc read
  *  info for that file.
  */
-typedef struct {
+struct proc_dir_entry_context {
 	void (*show_property)(struct seq_file *, void *, int);
 	MYPROCOBJECT *procObject;
 	int propertyIndex;
 
-} PROCDIRENTRYCONTEXT;
+};
 
 /** This describes the attributes of a tree rooted at
  *  <procDirRoot>/<name[0]>/<name[1]>/...
@@ -86,7 +86,7 @@ struct MYPROCOBJECT_Tag {
 
 	/** this is a holding area for the context information that is needed
 	 *  to run the /proc callback function */
-	PROCDIRENTRYCONTEXT *procDirPropertyContexts;
+	struct proc_dir_entry_context *procDirPropertyContexts;
 };
 
 
@@ -254,7 +254,8 @@ MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type,
 			goto Away;
 	}
 	obj->procDirPropertyContexts =
-		kzalloc((type->nProperties + 1) * sizeof(PROCDIRENTRYCONTEXT),
+		kzalloc((type->nProperties + 1) *
+			sizeof(struct proc_dir_entry_context),
 			GFP_KERNEL | __GFP_NORETRY);
 	if (obj->procDirPropertyContexts == NULL) {
 		ERRDRV("out of memory\n");
@@ -340,7 +341,9 @@ EXPORT_SYMBOL_GPL(visor_proc_DestroyObject);
 
 static int seq_show(struct seq_file *seq, void *offset)
 {
-	PROCDIRENTRYCONTEXT *ctx = (PROCDIRENTRYCONTEXT *)(seq->private);
+	struct proc_dir_entry_context *ctx;
+
+	ctx = (struct proc_dir_entry_context *)(seq->private);
 
 	if (ctx == NULL) {
 		ERRDRV("I don't have a freakin' clue...");
Signature · 1 line
2.1.4
#3 lore raw

Re: [PATCH 2/2] staging/unisys/visorutil/procobjecttree: Replace typedef

Quoted 1 line · Ricardo Ribalda Delgado

Instead of declaring a new type, define a new struct.

[]

drivers/staging/unisys/visorutil/procobjecttree.c

Quoted 1 line
drivers/staging/unisys/visorutil/procobjecttree.c +0 -0

[]

drivers/staging/unisys/visorutil/procobjecttree.c EXPORT_SYMBOL_GPL(visor_proc_DestroyObject); · line 346

Quoted 8 lines
drivers/staging/unisys/visorutil/procobjecttree.c +3 -1
@@ -340,7 +341,9 @@ EXPORT_SYMBOL_GPL(visor_proc_DestroyObject);
 
 static int seq_show(struct seq_file *seq, void *offset)
 {
-	PROCDIRENTRYCONTEXT *ctx = (PROCDIRENTRYCONTEXT *)(seq->private);
+	struct proc_dir_entry_context *ctx;
+
+	ctx = (struct proc_dir_entry_context *)(seq->private);

seq-private is a void * and doesn't need to be cast here.

	struct proc_dir_entry_context *ctx = seq->private;

should work well enough.

Quoted 3 lines
drivers/staging/unisys/visorutil/procobjecttree.c +0 -0
 	if (ctx == NULL) {
 		ERRDRV("I don't have a freakin' clue...");