kernel/debug/kdb: code enhancement for 3 areas.
PATCH 1/1 kernel/debug/kdb: code enhancement for 3 areas.
Delete waste '{' for 'case' statement.
For the return variable 'long res' in function kdb_task_state_string(), neither it matches the function return type 'unsigned long', nor is suitable as a flag variable to make 'or' operation. So use 'unsigned long' instead of 'long'.
If "case 'A'" happen in function kdb_task_state_string(), can return ~0UL directly to save the useless looping.
--- kernel/debug/kdb/kdb_main.c | 3 --- kernel/debug/kdb/kdb_support.c | 5 ++--- 2 files changed, 2 insertions(+), 6 deletions(-)
kernel/debug/kdb/kdb_main.c +0 -3
@@ -1151,7 +1151,6 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs,switch (reason) {case KDB_REASON_DEBUG : - {/* * If re-entering kdb after a single step * command, don't print the message.
@@ -1176,8 +1175,6 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs, db_result);break ; } - - }break ;case KDB_REASON_ENTER :if (KDB_STATE (KEYBOARD ))
kernel/debug/kdb/kdb_support.c +2 -3
@@ -560,7 +560,7 @@ int kdb_putword(unsigned long addr, unsigned long word, size_t size)unsigned long kdb_task_state_string (const char *s) { -long res =0 ; +unsigned long res =0 ;if (!s) { s =kdbgetenv ("PS" );if (!s)
@@ -599,8 +599,7 @@ unsigned long kdb_task_state_string(const char *s) res |=DAEMON ;break ;case 'A' : - res = ~0UL ; -break ; +return ~0UL ;default :kdb_printf ("%s: unknown flag '%c' ignored\n" , __func__, *s);
Signature · 1 line
1.7.7.6
Quoted 11 lines · Chen Gang
Delete waste '{' for 'case' statement.
For the return variable 'long res' in function
kdb_task_state_string(), neither it matches the function return type 'unsigned long', nor is suitable as a flag variable to make 'or' operation. So use 'unsigned long' instead of 'long'.If "case 'A'" happen in function
kdb_task_state_string(), can return ~0UL directly to save the useless looping.Signed-off-by Chen Gang <[email protected]>
If anything, these should be 3 separate patches...
Thanks!
Anton
Quoted 8 lines · Anton Vorontsov
Quoted 7 lines · Chen Gang
Quoted 7 lines
Delete waste '{' for 'case' statement.
For the return variable 'long res' in function
kdb_task_state_string(), neither it matches the function return type 'unsigned long', nor is suitable as a flag variable to make 'or' operation. So use 'unsigned long' instead of 'long'.
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
If "case 'A'" happen in function
kdb_task_state_string(), can return ~0UL directly to save the useless looping.Signed-off-by Chen Gang <[email protected]>If anything, these should be 3 separate patches...
OK, I will separate them into 3 patches (originally, I think for trivial cleanup patches, better let them in one patch, so can save the reviewers and appliers time)
Excuse me, I have to do something else, so I will finish them within this month (2013-05-31)
Thanks.
Signature · 3 lines
Chen Gang Asianux Corporation
Quoted 9 lines · Chen Gang
Quoted 8 lines · Anton Vorontsov
Quoted 8 lines · Chen Gang
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Delete waste '{' for 'case' statement.
For the return variable 'long res' in function
kdb_task_state_string(), neither it matches the function return type 'unsigned long', nor is suitable as a flag variable to make 'or' operation. So use 'unsigned long' instead of 'long'.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
If "case 'A'" happen in function
kdb_task_state_string(), can return ~0UL directly to save the useless looping.Signed-off-by Chen Gang <[email protected]>If anything, these should be 3 separate patches...
My original 3 fix issues old patches for "kernel/debug" are still non-reply, then the new minor cleanup patches (if I will provide the 3 patches) will of cause be none-reply, too.
Now, I am not a newbie anymore, so I can/should understand it, at least, it should not stop me to continue providing patches to another members.
And thank you for your encouraging.
:-)
Quoted 10 lines
OK, I will separate them into 3 patches (originally, I think for trivial cleanup patches, better let them in one patch, so can save the reviewers and appliers time)
Excuse me, I have to do something else, so I will finish them within this month (2013-05-31)
Thanks.
-- Chen Gang Asianux Corporation
Signature · 3 lines
Chen Gang Asianux Corporation