public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel/debug/kdb: code enhancement for 3 areas.
@ 2013-05-16 11:25 Chen Gang
  2013-05-23 17:28 ` Anton Vorontsov
  0 siblings, 1 reply; 4+ messages in thread
From: Chen Gang @ 2013-05-16 11:25 UTC (permalink / raw)
  To: jason.wessel, anton.vorontsov, sasha.levin, vincent.stehle,
	john.blackwood
  Cc: kgdb-bugreport, linux-kernel@vger.kernel.org


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 <gang.chen@asianux.com>
---
 kernel/debug/kdb/kdb_main.c    |    3 ---
 kernel/debug/kdb/kdb_support.c |    5 ++---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index 00eb8f7..62a0d4a 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -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))
diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c
index d35cc2d..75377d1 100644
--- a/kernel/debug/kdb/kdb_support.c
+++ b/kernel/debug/kdb/kdb_support.c
@@ -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);
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] kernel/debug/kdb: code enhancement for 3 areas.
  2013-05-16 11:25 [PATCH] kernel/debug/kdb: code enhancement for 3 areas Chen Gang
@ 2013-05-23 17:28 ` Anton Vorontsov
  2013-05-24  1:18   ` Chen Gang
  0 siblings, 1 reply; 4+ messages in thread
From: Anton Vorontsov @ 2013-05-23 17:28 UTC (permalink / raw)
  To: Chen Gang
  Cc: jason.wessel, sasha.levin, vincent.stehle, john.blackwood,
	kgdb-bugreport, linux-kernel@vger.kernel.org

On Thu, May 16, 2013 at 07:25:46PM +0800, Chen Gang wrote:
> 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 <gang.chen@asianux.com>

If anything, these should be 3 separate patches...

Thanks!

Anton

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kernel/debug/kdb: code enhancement for 3 areas.
  2013-05-23 17:28 ` Anton Vorontsov
@ 2013-05-24  1:18   ` Chen Gang
  2013-05-28  6:07     ` Chen Gang
  0 siblings, 1 reply; 4+ messages in thread
From: Chen Gang @ 2013-05-24  1:18 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: jason.wessel, sasha.levin, vincent.stehle, john.blackwood,
	kgdb-bugreport, linux-kernel@vger.kernel.org

On 05/24/2013 01:28 AM, Anton Vorontsov wrote:
> On Thu, May 16, 2013 at 07:25:46PM +0800, Chen Gang wrote:
>> > 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 <gang.chen@asianux.com>
> 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.
-- 
Chen Gang

Asianux Corporation

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kernel/debug/kdb: code enhancement for 3 areas.
  2013-05-24  1:18   ` Chen Gang
@ 2013-05-28  6:07     ` Chen Gang
  0 siblings, 0 replies; 4+ messages in thread
From: Chen Gang @ 2013-05-28  6:07 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: jason.wessel, sasha.levin, vincent.stehle, john.blackwood,
	kgdb-bugreport, linux-kernel@vger.kernel.org

On 05/24/2013 09:18 AM, Chen Gang wrote:
> On 05/24/2013 01:28 AM, Anton Vorontsov wrote:
>> > On Thu, May 16, 2013 at 07:25:46PM +0800, Chen Gang wrote:
>>>> >> > 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 <gang.chen@asianux.com>
>> > 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.

:-)


> 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


-- 
Chen Gang

Asianux Corporation

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-28  6:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-16 11:25 [PATCH] kernel/debug/kdb: code enhancement for 3 areas Chen Gang
2013-05-23 17:28 ` Anton Vorontsov
2013-05-24  1:18   ` Chen Gang
2013-05-28  6:07     ` Chen Gang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox