Skip to contentSkip to conversation

Edit CamelCase function names to make code more readable

PATCH In review Vatsala Narang 3 participants 4 messages Mar 17, 2019 – Mar 18, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Edit CamelCase function names to make code more readable

[PATCH] Edit CamelCase function names to make code more readable Issue reported by checkpatch.pl tool

---
drivers/staging/sm750fb/ddk75
0_display.c | 10 +++++-----

 1 file changed, 5 insertions(+), 5 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/sm750fb/ddk750_display.c
index f38051eedb6c..7f28e4cc4c79 100644

drivers/staging/sm750fb/ddk750_display.c +2 -3
@@ -85,7 +85,7 @@ static void primary_wait_vertical_sync(int delay)
        }
 }
 
-static void swPanelPowerSequence(int disp, int delay)
+static void sw_panel_power_sequence(int disp, int delay)
 {
        unsigned int reg;
 
@@ -111,7 +111,7 @@ static void swPanelPowerSequence(int disp, int delay)
        primary_wait_vertical_sync(delay);
 }
 
-void ddk750_setLogicalDispOut(enum disp_output output)
+void ddk750_set_logical_disp_out(enum disp_output output)
 {
        unsigned int reg;
 
@@ -147,12 +147,12 @@ void ddk750_setLogicalDispOut(enum disp_output output)
 
        if (output & PNL_SEQ_USAGE) {
                /* set  panel sequence */
-               swPanelPowerSequence((output & PNL_SEQ_MASK) >> 

PNL_SEQ_OFFSET,
- 4);
+ sw_panel_power_sequence
+ ((output & PNL_SEQ_MASK) >> PNL_SEQ_OFFSET, 4);
}

if (output & DAC_USAGE)
- setDAC((output & DAC_MASK) >> DAC_OFFSET);
+ set_DAC((output & DAC_MASK) >> DAC_OFFSET);

if (output & DPMS_USAGE)
ddk750_set_dpms((output & DPMS_MASK) >> DPMS_OFFSET);

#1 lore raw
Quoted 2 lines · Vatsala Narang

[PATCH] EDIT CAMELCASE FUNCTION NAMES TO MAKE CODE MORE READABLE

Please don't use all capital letters for the log message. Also, you don't need to put [PATCH] in the log message.

On the other hand, the subject line can be more concise. Just "eliminate camel case" could be fine.

The subject line also needs to give some information about the affected files. You can use

git log --oneline drivers/staging/sm750fb/ddk750_display.c

to find something suitable. Don't try to make it up. Do what others have done.

Quoted 3 lines

Issue reported by checkpatch.pl tool

This should be your full name, with normal capitalization and spacing. You can upadte your git configuration file with this information, and then you don't have to think about it any more.

Quoted 19 lines

---
 drivers/staging/sm750fb/ddk750_display.c | 10 +++++-----

 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/sm750fb/ddk750_display.c +1 -1
index f38051eedb6c..7f28e4cc4c79 100644
@@ -85,7 +85,7 @@ static void primary_wait_vertical_sync(int delay)
         }
  }
 
-static void swPanelPowerSequence(int disp, int delay)
+static void sw_panel_power_sequence(int disp, int delay)
  {
         unsigned int reg;
 

drivers/staging/sm750fb/ddk750_display.c static void swPanelPowerSequence(int disp, int delay) · line 114

Quoted 5 lines
drivers/staging/sm750fb/ddk750_display.c +1 -1
@@ -111,7 +111,7 @@ static void swPanelPowerSequence(int disp, int delay)
         primary_wait_vertical_sync(delay);
  }
 
-void ddk750_setLogicalDispOut(enum disp_output output)
+void ddk750_set_logical_disp_out(enum disp_output output)

The above changes look fine.

drivers/staging/sm750fb/ddk750_display.c void ddk750_setLogicalDispOut(enum disp_output output) · line 152

Quoted 12 lines
drivers/staging/sm750fb/ddk750_display.c +2 -2
  {
         unsigned int reg;
 
@@ -147,12 +147,12 @@ void ddk750_setLogicalDispOut(enum disp_output output)
 
         if (output & PNL_SEQ_USAGE) {
                 /* set  panel sequence */
-               swPanelPowerSequence((output & PNL_SEQ_MASK) >>
 PNL_SEQ_OFFSET,
-                                    4);
+               sw_panel_power_sequence
+               ((output & PNL_SEQ_MASK) >> PNL_SEQ_OFFSET, 4);

Please don't do this. Function calls should have the ( on the same line as the function name, to be quickly understandable. It may be that going a few characters over 80 is the best solution in this case.

drivers/staging/sm750fb/ddk750_display.c void ddk750_setLogicalDispOut(enum disp_output output) · line 156

Quoted 5 lines
drivers/staging/sm750fb/ddk750_display.c +1 -1
         }
 
         if (output & DAC_USAGE)
-               setDAC((output & DAC_MASK) >> DAC_OFFSET);
+               set_DAC((output & DAC_MASK) >> DAC_OFFSET);

If you change a call without changing the definition, the code is not going to compile.

Furthermore, above you changed a definition but made no changes on the uses of the function. Is the function never used?

If you change the name of a defined function, then you have to update the name at all of the call sites, in the same patch. No patch should break the build.

julia

Quoted 14 lines
drivers/staging/sm750fb/ddk750_display.c +0 -1
         if (output & DPMS_USAGE)
                 ddk750_set_dpms((output & DPMS_MASK) >> DPMS_OFFSET);
 
--

You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/434bf516-9e31-4dcf-ab81- 32842a588aee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw

Okay,I was not sure about the format of log message. I'll keep this in mind and resend the patch.

Thanks
Vatsala

maintainer
#3 lore raw
In reply to Vatsala Narang
Quoted 9 lines · Vatsala Narang

[PATCH] Edit CamelCase function names to make code more readable Issue reported by checkpatch.pl tool

---
drivers/staging/sm750fb/ddk75
0_display.c | 10 +++++-----

 1 file changed, 5 insertions(+), 5 deletions(-)

Along with what Julia said, you can't send patches in html format or they will be rejected by the developer mailing lists, as well as not being able to be applied at all.

thanks,

greg k-h