qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix some style problems in monitor
@ 2020-11-25  1:45 Yutao Ai
  2020-11-25  1:45 ` [PATCH 1/3] monitor:open brace '{' following struct go on the same line Yutao Ai
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Yutao Ai @ 2020-11-25  1:45 UTC (permalink / raw)
  To: dgilbert, armbru; +Cc: alex.chen, aiyutao, qemu-devel

I find some style problems while using checkpatch.pl to check monitor codes.
And I fixed these style problems in the submit patches.

Yutao Ai (3):
  monitor:open brace '{' following struct go on the same line
  monitor:braces {} are necessary for all arms of this statement
  monitor:Don't use '#' flag of printf format ('%#') in format strings

 monitor/hmp-cmds.c |  3 +--
 monitor/misc.c     | 16 ++++++++++------
 2 files changed, 11 insertions(+), 8 deletions(-)

-- 
2.19.1



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

* [PATCH 1/3] monitor:open brace '{' following struct go on the same line
  2020-11-25  1:45 [PATCH 0/3] Fix some style problems in monitor Yutao Ai
@ 2020-11-25  1:45 ` Yutao Ai
  2020-11-25  1:45 ` [PATCH 2/3] monitor:braces {} are necessary for all arms of this statement Yutao Ai
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Yutao Ai @ 2020-11-25  1:45 UTC (permalink / raw)
  To: dgilbert, armbru; +Cc: alex.chen, aiyutao, qemu-devel

Move the open brace '{' following struct go on the same line

Signed-off-by: Yutao Ai <aiyutao@huawei.com>
---
 monitor/hmp-cmds.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 8d7f5fee7e..64188c9fa2 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1548,8 +1548,7 @@ end:
     hmp_handle_error(mon, err);
 }
 
-typedef struct HMPMigrationStatus
-{
+typedef struct HMPMigrationStatus {
     QEMUTimer *timer;
     Monitor *mon;
     bool is_block_migration;
-- 
2.19.1



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

* [PATCH 2/3] monitor:braces {} are necessary for all arms of this statement
  2020-11-25  1:45 [PATCH 0/3] Fix some style problems in monitor Yutao Ai
  2020-11-25  1:45 ` [PATCH 1/3] monitor:open brace '{' following struct go on the same line Yutao Ai
@ 2020-11-25  1:45 ` Yutao Ai
  2020-11-25  1:45 ` [PATCH 3/3] monitor:Don't use '#' flag of printf format ('%#') in format strings Yutao Ai
  2020-12-08 16:39 ` [PATCH 0/3] Fix some style problems in monitor Dr. David Alan Gilbert
  3 siblings, 0 replies; 6+ messages in thread
From: Yutao Ai @ 2020-11-25  1:45 UTC (permalink / raw)
  To: dgilbert, armbru; +Cc: alex.chen, aiyutao, qemu-devel

Fix the errors by add {}

Signed-off-by: Yutao Ai <aiyutao@huawei.com>
---
 monitor/misc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/monitor/misc.c b/monitor/misc.c
index 398211a034..7588f12053 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -492,8 +492,10 @@ static void hmp_singlestep(Monitor *mon, const QDict *qdict)
 static void hmp_gdbserver(Monitor *mon, const QDict *qdict)
 {
     const char *device = qdict_get_try_str(qdict, "device");
-    if (!device)
+    if (!device) {
         device = "tcp::" DEFAULT_GDBSTUB_PORT;
+    }
+
     if (gdbserver_start(device) < 0) {
         monitor_printf(mon, "Could not open gdbserver on device '%s'\n",
                        device);
@@ -559,10 +561,11 @@ static void memory_dump(Monitor *mon, int count, int format, int wsize,
     }
 
     len = wsize * count;
-    if (wsize == 1)
+    if (wsize == 1) {
         line_size = 8;
-    else
+    } else {
         line_size = 16;
+    }
     max_digits = 0;
 
     switch(format) {
@@ -583,10 +586,11 @@ static void memory_dump(Monitor *mon, int count, int format, int wsize,
     }
 
     while (len > 0) {
-        if (is_physical)
+        if (is_physical) {
             monitor_printf(mon, TARGET_FMT_plx ":", addr);
-        else
+        } else {
             monitor_printf(mon, TARGET_FMT_lx ":", (target_ulong)addr);
+        }
         l = len;
         if (l > line_size)
             l = line_size;
-- 
2.19.1



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

* [PATCH 3/3] monitor:Don't use '#' flag of printf format ('%#') in format strings
  2020-11-25  1:45 [PATCH 0/3] Fix some style problems in monitor Yutao Ai
  2020-11-25  1:45 ` [PATCH 1/3] monitor:open brace '{' following struct go on the same line Yutao Ai
  2020-11-25  1:45 ` [PATCH 2/3] monitor:braces {} are necessary for all arms of this statement Yutao Ai
@ 2020-11-25  1:45 ` Yutao Ai
  2020-11-25  8:09   ` Philippe Mathieu-Daudé
  2020-12-08 16:39 ` [PATCH 0/3] Fix some style problems in monitor Dr. David Alan Gilbert
  3 siblings, 1 reply; 6+ messages in thread
From: Yutao Ai @ 2020-11-25  1:45 UTC (permalink / raw)
  To: dgilbert, armbru; +Cc: alex.chen, aiyutao, qemu-devel

Delete '#' and use '0x' prefix instead

Signed-off-by: Yutao Ai <aiyutao@huawei.com>
---
 monitor/misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitor/misc.c b/monitor/misc.c
index 7588f12053..2eb563f6f3 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -910,7 +910,7 @@ static void hmp_ioport_read(Monitor *mon, const QDict *qdict)
         suffix = 'l';
         break;
     }
-    monitor_printf(mon, "port%c[0x%04x] = %#0*x\n",
+    monitor_printf(mon, "port%c[0x%04x] = 0x%0*x\n",
                    suffix, addr, size * 2, val);
 }
 
-- 
2.19.1



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

* Re: [PATCH 3/3] monitor:Don't use '#' flag of printf format ('%#') in format strings
  2020-11-25  1:45 ` [PATCH 3/3] monitor:Don't use '#' flag of printf format ('%#') in format strings Yutao Ai
@ 2020-11-25  8:09   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-25  8:09 UTC (permalink / raw)
  To: Yutao Ai, dgilbert, armbru; +Cc: alex.chen, qemu-devel

On 11/25/20 2:45 AM, Yutao Ai wrote:
> Delete '#' and use '0x' prefix instead
> 
> Signed-off-by: Yutao Ai <aiyutao@huawei.com>
> ---
>  monitor/misc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



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

* Re: [PATCH 0/3] Fix some style problems in monitor
  2020-11-25  1:45 [PATCH 0/3] Fix some style problems in monitor Yutao Ai
                   ` (2 preceding siblings ...)
  2020-11-25  1:45 ` [PATCH 3/3] monitor:Don't use '#' flag of printf format ('%#') in format strings Yutao Ai
@ 2020-12-08 16:39 ` Dr. David Alan Gilbert
  3 siblings, 0 replies; 6+ messages in thread
From: Dr. David Alan Gilbert @ 2020-12-08 16:39 UTC (permalink / raw)
  To: Yutao Ai; +Cc: alex.chen, armbru, qemu-devel

* Yutao Ai (aiyutao@huawei.com) wrote:
> I find some style problems while using checkpatch.pl to check monitor codes.
> And I fixed these style problems in the submit patches.
> 
> Yutao Ai (3):
>   monitor:open brace '{' following struct go on the same line
>   monitor:braces {} are necessary for all arms of this statement
>   monitor:Don't use '#' flag of printf format ('%#') in format strings
> 
>  monitor/hmp-cmds.c |  3 +--
>  monitor/misc.c     | 16 ++++++++++------
>  2 files changed, 11 insertions(+), 8 deletions(-)

Queued

> -- 
> 2.19.1
> 
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



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

end of thread, other threads:[~2020-12-08 16:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-25  1:45 [PATCH 0/3] Fix some style problems in monitor Yutao Ai
2020-11-25  1:45 ` [PATCH 1/3] monitor:open brace '{' following struct go on the same line Yutao Ai
2020-11-25  1:45 ` [PATCH 2/3] monitor:braces {} are necessary for all arms of this statement Yutao Ai
2020-11-25  1:45 ` [PATCH 3/3] monitor:Don't use '#' flag of printf format ('%#') in format strings Yutao Ai
2020-11-25  8:09   ` Philippe Mathieu-Daudé
2020-12-08 16:39 ` [PATCH 0/3] Fix some style problems in monitor Dr. David Alan Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).