Patchwork [5/6] cpus.c: Drop unnecessary set_cpu_log()

login
register
mail settings
Submitter Peter Maydell
Date Feb. 11, 2013, 4:41 p.m.
Message ID <1360600885-6917-6-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/219653/
State New
Headers show

Comments

Peter Maydell - Feb. 11, 2013, 4:41 p.m.
The set_cpu_log() function in cpus.c is a fairly simple wrapper
which is only called from one location. Just inline the code
into vl.c, since there is no need to indirect it via cpus.c
and the handling of the error case is more appropriate to vl.c.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 cpus.c                |   12 ------------
 include/sysemu/cpus.h |    1 -
 vl.c                  |    9 ++++++++-
 3 files changed, 8 insertions(+), 14 deletions(-)
Andreas Färber - Feb. 11, 2013, 7:29 p.m.
Am 11.02.2013 17:41, schrieb Peter Maydell:
> The set_cpu_log() function in cpus.c is a fairly simple wrapper
> which is only called from one location. Just inline the code
> into vl.c, since there is no need to indirect it via cpus.c
> and the handling of the error case is more appropriate to vl.c.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  cpus.c                |   12 ------------
>  include/sysemu/cpus.h |    1 -
>  vl.c                  |    9 ++++++++-
>  3 files changed, 8 insertions(+), 14 deletions(-)

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas

Patch

diff --git a/cpus.c b/cpus.c
index 24e6aff..c4b021d 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1175,18 +1175,6 @@  void set_numa_modes(void)
     }
 }
 
-void set_cpu_log(const char *optarg)
-{
-    int mask;
-
-    mask = qemu_str_to_log_mask(optarg);
-    if (!mask) {
-        qemu_print_log_usage(stdout);
-        exit(1);
-    }
-    qemu_set_log(mask);
-}
-
 void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg)
 {
     /* XXX: implement xxx_cpu_list for targets that still miss it */
diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h
index 60e44bb..6502488 100644
--- a/include/sysemu/cpus.h
+++ b/include/sysemu/cpus.h
@@ -24,7 +24,6 @@  extern int smp_threads;
 #endif
 
 void set_numa_modes(void);
-void set_cpu_log(const char *optarg);
 void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg);
 
 #endif
diff --git a/vl.c b/vl.c
index 06e5369..2e204d0 100644
--- a/vl.c
+++ b/vl.c
@@ -3860,10 +3860,17 @@  int main(int argc, char **argv, char **envp)
      * location or level of logging.
      */
     if (log_mask) {
+        int mask;
         if (log_file) {
             qemu_set_log_filename(log_file);
         }
-        set_cpu_log(log_mask);
+
+        mask = qemu_str_to_log_mask(log_mask);
+        if (!mask) {
+            qemu_print_log_usage(stdout);
+            exit(1);
+        }
+        qemu_set_log(mask);
     }
 
     if (!trace_backend_init(trace_events, trace_file)) {