From ac86048bcd41129b18702ba63395f222871804de Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 10 Nov 2013 14:20:16 +0100 Subject: [PATCH 01/14] trace: Remove trace.h from console.h (less dependencies) This reduces the dependencies on trace.h. Only two source files which need console.h also need trace.h. Signed-off-by: Stefan Weil Signed-off-by: Michael Tokarev --- hw/display/vmware_vga.c | 1 + include/ui/console.h | 1 - ui/console.c | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index a6a8cdc2e1..aba292ccde 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -23,6 +23,7 @@ */ #include "hw/hw.h" #include "hw/loader.h" +#include "trace.h" #include "ui/console.h" #include "hw/pci/pci.h" diff --git a/include/ui/console.h b/include/ui/console.h index 98edf413a6..4156a876e1 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -6,7 +6,6 @@ #include "qapi/qmp/qdict.h" #include "qemu/notify.h" #include "monitor/monitor.h" -#include "trace.h" #include "qapi-types.h" #include "qapi/error.h" diff --git a/ui/console.c b/ui/console.c index 199ba69101..61ed2190a3 100644 --- a/ui/console.c +++ b/ui/console.c @@ -27,6 +27,7 @@ #include "qemu/timer.h" #include "qmp-commands.h" #include "sysemu/char.h" +#include "trace.h" //#define DEBUG_CONSOLE #define DEFAULT_BACKSCROLL 512 From 12269616227c2ee34f4c853cae676e18a5e01b18 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 10 Nov 2013 14:20:17 +0100 Subject: [PATCH 02/14] trace: Remove trace.h from hw/usb/hcd-ehci.h (less dependencies) This reduces the dependencies on trace.h. Only one source file which needs hcd-ehci.h also needs trace.h. Signed-off-by: Stefan Weil Signed-off-by: Michael Tokarev --- hw/usb/hcd-ehci.c | 1 + hw/usb/hcd-ehci.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 22bdbf4a7d..0ba38c9c40 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -28,6 +28,7 @@ */ #include "hw/usb/hcd-ehci.h" +#include "trace.h" /* Capability Registers Base Address - section 2.2 */ #define CAPLENGTH 0x0000 /* 1-byte, 0x0001 reserved */ diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h index 065c9fa741..1ad4b96cce 100644 --- a/hw/usb/hcd-ehci.h +++ b/hw/usb/hcd-ehci.h @@ -21,7 +21,6 @@ #include "qemu/timer.h" #include "hw/usb.h" #include "monitor/monitor.h" -#include "trace.h" #include "sysemu/dma.h" #include "sysemu/sysemu.h" #include "hw/pci/pci.h" From 5d28b0e960cd3a99f7e013900a0e12468720b402 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 10 Nov 2013 16:04:16 +0100 Subject: [PATCH 03/14] console: Replace conditional debug messages by trace methods Signed-off-by: Stefan Weil Reviewed-by: Gerd Hoffmann Signed-off-by: Michael Tokarev --- trace-events | 2 ++ ui/console.c | 11 +++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/trace-events b/trace-events index 8695e9e5b7..d196234489 100644 --- a/trace-events +++ b/trace-events @@ -1010,6 +1010,8 @@ dma_map_wait(void *dbs) "dbs=%p" # ui/console.c console_gfx_new(void) "" +console_putchar_csi(int esc_param0, int esc_param1, int ch, int nb_esc_params) "escape sequence CSI%d;%d%c, %d parameters" +console_putchar_unhandled(int ch) "unhandled escape character '%c'" console_txt_new(int w, int h) "%dx%d" console_select(int nr) "%d" console_refresh(int interval) "interval %d ms" diff --git a/ui/console.c b/ui/console.c index 61ed2190a3..586fc6d6f1 100644 --- a/ui/console.c +++ b/ui/console.c @@ -29,7 +29,6 @@ #include "sysemu/char.h" #include "trace.h" -//#define DEBUG_CONSOLE #define DEFAULT_BACKSCROLL 512 #define MAX_CONSOLES 12 #define CONSOLE_CURSOR_PERIOD 500 @@ -867,10 +866,8 @@ static void console_putchar(QemuConsole *s, int ch) s->nb_esc_params++; if (ch == ';') break; -#ifdef DEBUG_CONSOLE - fprintf(stderr, "escape sequence CSI%d;%d%c, %d parameters\n", - s->esc_params[0], s->esc_params[1], ch, s->nb_esc_params); -#endif + trace_console_putchar_csi(s->esc_params[0], s->esc_params[1], + ch, s->nb_esc_params); s->state = TTY_STATE_NORM; switch(ch) { case 'A': @@ -984,9 +981,7 @@ static void console_putchar(QemuConsole *s, int ch) s->y = s->y_saved; break; default: -#ifdef DEBUG_CONSOLE - fprintf(stderr, "unhandled escape character '%c'\n", ch); -#endif + trace_console_putchar_unhandled(ch); break; } break; From ef0dd982cb7dbff3ea234fe48187d556e69d6765 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 10 Nov 2013 16:24:02 +0100 Subject: [PATCH 04/14] gtk: Replace conditional debug messages by trace methods Signed-off-by: Stefan Weil Signed-off-by: Michael Tokarev --- trace-events | 5 +++++ ui/gtk.c | 19 +++++-------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/trace-events b/trace-events index d196234489..bc6788f105 100644 --- a/trace-events +++ b/trace-events @@ -1022,6 +1022,11 @@ displaychangelistener_register(void *dcl, const char *name) "%p [ %s ]" displaychangelistener_unregister(void *dcl, const char *name) "%p [ %s ]" ppm_save(const char *filename, void *display_surface) "%s surface=%p" +# ui/gtk.c +gd_switch(int width, int height) "width=%d, height=%d" +gd_update(int x, int y, int w, int h) "x=%d, y=%d, w=%d, h=%d" +gd_key_event(int gdk_keycode, int qemu_keycode, const char *action) "translated GDK keycode %d to QEMU keycode %d (%s)" + # hw/display/vmware_vga.c vmware_value_read(uint32_t index, uint32_t value) "index %d, value 0x%x" vmware_value_write(uint32_t index, uint32_t value) "index %d, value 0x%x" diff --git a/ui/gtk.c b/ui/gtk.c index b5f4f0bd40..6316f5ba00 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -53,6 +53,7 @@ #include #include +#include "trace.h" #include "ui/console.h" #include "sysemu/sysemu.h" #include "qmp-commands.h" @@ -60,14 +61,6 @@ #include "keymaps.h" #include "sysemu/char.h" -//#define DEBUG_GTK - -#ifdef DEBUG_GTK -#define DPRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__) -#else -#define DPRINTF(fmt, ...) do { } while (0) -#endif - #define MAX_VCS 10 @@ -302,7 +295,7 @@ static void gd_update(DisplayChangeListener *dcl, int fbw, fbh; int ww, wh; - DPRINTF("update(x=%d, y=%d, w=%d, h=%d)\n", x, y, w, h); + trace_gd_update(x, y, w, h); if (s->convert) { pixman_image_composite(PIXMAN_OP_SRC, s->ds->image, NULL, s->convert, @@ -396,8 +389,7 @@ static void gd_switch(DisplayChangeListener *dcl, GtkDisplayState *s = container_of(dcl, GtkDisplayState, dcl); bool resized = true; - DPRINTF("resize(width=%d, height=%d)\n", - surface_width(surface), surface_height(surface)); + trace_gd_switch(surface_width(surface), surface_height(surface)); if (s->surface) { cairo_surface_destroy(s->surface); @@ -732,9 +724,8 @@ static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque) qemu_keycode = 0; } - DPRINTF("translated GDK keycode %d to QEMU keycode %d (%s)\n", - gdk_keycode, qemu_keycode, - (key->type == GDK_KEY_PRESS) ? "down" : "up"); + trace_gd_key_event(gdk_keycode, qemu_keycode, + (key->type == GDK_KEY_PRESS) ? "down" : "up"); for (i = 0; i < ARRAY_SIZE(modifier_keycode); i++) { if (qemu_keycode == modifier_keycode[i]) { From b2e2395f1308f784acd2e0af0d6f2a6f5668aafb Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Fri, 22 Nov 2013 14:39:56 +0800 Subject: [PATCH 05/14] .gitignore: Ignore config.status Signed-off-by: Fam Zheng Reviewed-by: Stefan Weil Signed-off-by: Michael Tokarev --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5584b5fcb0..1c9d63d651 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ config-all-devices.* config-all-disas.* config-host.* config-target.* +config.status trace/generated-tracers.h trace/generated-tracers.c trace/generated-tracers-dtrace.h From 867d898ccf50ef095b95c403d7dc809c188b14e2 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 17 Nov 2013 19:00:22 +0100 Subject: [PATCH 06/14] acpi-build: Fix compiler warning (missing gnu_printf format attribute) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra): CC m68k-softmmu/hw/m68k/mcf5206.o hw/i386/acpi-build.c: In function ‘build_append_nameseg’: hw/i386/acpi-build.c:294:5: error: function might be possible candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format] g_string_vprintf(s, format, args); ^ When this warning is fixed, there is a new compiler warning: CC i386-softmmu/hw/i386/acpi-build.o hw/i386/acpi-build.c: In function ‘build_append_notify’: hw/i386/acpi-build.c:632:5: error: format not a string literal and no format arguments [-Werror=format-security] build_append_nameseg(method, name); ^ This is fixed here, too. Signed-off-by: Stefan Weil Signed-off-by: Michael Tokarev --- hw/i386/acpi-build.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 1f22fb60a4..befc39f253 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -285,7 +285,8 @@ static inline void build_append_array(GArray *array, GArray *val) g_array_append_vals(array, val->data, val->len); } -static void build_append_nameseg(GArray *array, const char *format, ...) +static void GCC_FMT_ATTR(2, 3) +build_append_nameseg(GArray *array, const char *format, ...) { /* It would be nicer to use g_string_vprintf but it's only there in 2.22 */ char s[] = "XXXX"; @@ -630,7 +631,7 @@ build_append_notify(GArray *device, const char *name, GArray *method = build_alloc_array(); uint8_t op = 0x14; /* MethodOp */ - build_append_nameseg(method, name); + build_append_nameseg(method, "%s", name); build_append_byte(method, 0x02); /* MethodFlags: ArgCount */ for (i = skip; i < count; i++) { GArray *target = build_alloc_array(); From 47908a0f66c5369a94e93d951a5d0c28d007ff80 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 17 Nov 2013 19:00:42 +0100 Subject: [PATCH 07/14] qobject: Fix compiler warning (missing gnu_printf format attribute) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra): CC qobject/qerror.o qobject/qerror.c: In function ‘qerror_from_info’: qobject/qerror.c:53:5: error: function might be possible candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format] qerr->err_msg = g_strdup_vprintf(fmt, *va); ^ Signed-off-by: Stefan Weil Signed-off-by: Michael Tokarev --- qobject/qerror.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qobject/qerror.c b/qobject/qerror.c index 3aee1cf6a6..fc8331aa67 100644 --- a/qobject/qerror.c +++ b/qobject/qerror.c @@ -42,8 +42,8 @@ static QError *qerror_new(void) * * Return strong reference. */ -static QError *qerror_from_info(ErrorClass err_class, const char *fmt, - va_list *va) +static QError * GCC_FMT_ATTR(2, 0) +qerror_from_info(ErrorClass err_class, const char *fmt, va_list *va) { QError *qerr; From 1246b259f846136d58a89568fdc0421d02e4df65 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 1 Dec 2013 08:49:47 +0100 Subject: [PATCH 08/14] misc: Replace 'struct QEMUTimer' by 'QEMUTimer' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Most code already used QEMUTimer without the redundant 'struct' keyword. Signed-off-by: Stefan Weil Reviewed-by: Andreas Färber Signed-off-by: Michael Tokarev --- hw/char/cadence_uart.c | 4 ++-- hw/ppc/ppc.c | 6 +++--- hw/ppc/ppc405_uc.c | 2 +- hw/ppc/ppc_booke.c | 4 ++-- hw/timer/m48t59.c | 4 ++-- include/hw/char/serial.h | 4 ++-- include/hw/ppc/ppc.h | 4 ++-- target-alpha/cpu-qom.h | 2 +- target-mips/cpu.h | 2 +- target-openrisc/cpu.h | 2 +- target-sparc/cpu.h | 2 +- ui/console.c | 2 +- 12 files changed, 19 insertions(+), 19 deletions(-) diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c index f8ccbdd13a..f18db53bca 100644 --- a/hw/char/cadence_uart.c +++ b/hw/char/cadence_uart.c @@ -120,8 +120,8 @@ typedef struct { uint64_t char_tx_time; CharDriverState *chr; qemu_irq irq; - struct QEMUTimer *fifo_trigger_handle; - struct QEMUTimer *tx_time_handle; + QEMUTimer *fifo_trigger_handle; + QEMUTimer *tx_time_handle; } UartState; static void uart_update_status(UartState *s) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index bf2d3d4b35..114be64480 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -684,7 +684,7 @@ static inline void cpu_ppc_hdecr_excp(PowerPCCPU *cpu) } static void __cpu_ppc_store_decr(PowerPCCPU *cpu, uint64_t *nextp, - struct QEMUTimer *timer, + QEMUTimer *timer, void (*raise_excp)(PowerPCCPU *), uint32_t decr, uint32_t value, int is_excp) @@ -856,9 +856,9 @@ typedef struct ppc40x_timer_t ppc40x_timer_t; struct ppc40x_timer_t { uint64_t pit_reload; /* PIT auto-reload value */ uint64_t fit_next; /* Tick for next FIT interrupt */ - struct QEMUTimer *fit_timer; + QEMUTimer *fit_timer; uint64_t wdt_next; /* Tick for next WDT interrupt */ - struct QEMUTimer *wdt_timer; + QEMUTimer *wdt_timer; /* 405 have the PIT, 440 have a DECR. */ unsigned int decr_excp; diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c index 6d6a7f1203..8109f92200 100644 --- a/hw/ppc/ppc405_uc.c +++ b/hw/ppc/ppc405_uc.c @@ -1234,7 +1234,7 @@ struct ppc4xx_gpt_t { MemoryRegion iomem; int64_t tb_offset; uint32_t tb_freq; - struct QEMUTimer *timer; + QEMUTimer *timer; qemu_irq irqs[5]; uint32_t oe; uint32_t ol; diff --git a/hw/ppc/ppc_booke.c b/hw/ppc/ppc_booke.c index b421620708..d8399602d6 100644 --- a/hw/ppc/ppc_booke.c +++ b/hw/ppc/ppc_booke.c @@ -64,10 +64,10 @@ typedef struct booke_timer_t booke_timer_t; struct booke_timer_t { uint64_t fit_next; - struct QEMUTimer *fit_timer; + QEMUTimer *fit_timer; uint64_t wdt_next; - struct QEMUTimer *wdt_timer; + QEMUTimer *wdt_timer; uint32_t flags; }; diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c index d3d78ec5a8..be0592b53d 100644 --- a/hw/timer/m48t59.c +++ b/hw/timer/m48t59.c @@ -61,8 +61,8 @@ struct M48t59State { time_t stop_time; /* Alarm & watchdog */ struct tm alarm; - struct QEMUTimer *alrm_timer; - struct QEMUTimer *wd_timer; + QEMUTimer *alrm_timer; + QEMUTimer *wd_timer; /* NVRAM storage */ uint8_t *buffer; /* Model parameters */ diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 85f58acd51..f431764bf5 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -65,13 +65,13 @@ struct SerialState { /* Interrupt trigger level for recv_fifo */ uint8_t recv_fifo_itl; - struct QEMUTimer *fifo_timeout_timer; + QEMUTimer *fifo_timeout_timer; int timeout_ipending; /* timeout interrupt pending state */ uint64_t char_transmit_time; /* time to transmit a char in ticks */ int poll_msl; - struct QEMUTimer *modem_status_poll; + QEMUTimer *modem_status_poll; MemoryRegion io; }; diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h index 132ab97b58..835418aeb0 100644 --- a/include/hw/ppc/ppc.h +++ b/include/hw/ppc/ppc.h @@ -24,10 +24,10 @@ struct ppc_tb_t { /* Decrementer management */ uint64_t decr_next; /* Tick for next decr interrupt */ uint32_t decr_freq; /* decrementer frequency */ - struct QEMUTimer *decr_timer; + QEMUTimer *decr_timer; /* Hypervisor decrementer management */ uint64_t hdecr_next; /* Tick for next hdecr interrupt */ - struct QEMUTimer *hdecr_timer; + QEMUTimer *hdecr_timer; uint64_t purr_load; uint64_t purr_start; void *opaque; diff --git a/target-alpha/cpu-qom.h b/target-alpha/cpu-qom.h index 2ebc9bcacb..198f1b13a3 100644 --- a/target-alpha/cpu-qom.h +++ b/target-alpha/cpu-qom.h @@ -62,7 +62,7 @@ typedef struct AlphaCPU { CPUAlphaState env; /* This alarm doesn't exist in real hardware; we wish it did. */ - struct QEMUTimer *alarm_timer; + QEMUTimer *alarm_timer; } AlphaCPU; static inline AlphaCPU *alpha_env_get_cpu(CPUAlphaState *env) diff --git a/target-mips/cpu.h b/target-mips/cpu.h index a29c82faf1..9caf4474b9 100644 --- a/target-mips/cpu.h +++ b/target-mips/cpu.h @@ -476,7 +476,7 @@ struct CPUMIPSState { const mips_def_t *cpu_model; void *irq[8]; - struct QEMUTimer *timer; /* Internal timer */ + QEMUTimer *timer; /* Internal timer */ }; #include "cpu-qom.h" diff --git a/target-openrisc/cpu.h b/target-openrisc/cpu.h index 0f9efdf6de..51d6afd153 100644 --- a/target-openrisc/cpu.h +++ b/target-openrisc/cpu.h @@ -307,7 +307,7 @@ typedef struct CPUOpenRISCState { #ifndef CONFIG_USER_ONLY CPUOpenRISCTLBContext * tlb; - struct QEMUTimer *timer; + QEMUTimer *timer; uint32_t ttmr; /* Timer tick mode register */ uint32_t ttcr; /* Timer tick count register */ diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index 41194ec06b..c519063ba9 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -370,7 +370,7 @@ struct CPUTimer uint32_t disabled; uint64_t disabled_mask; int64_t clock_offset; - struct QEMUTimer *qtimer; + QEMUTimer *qtimer; }; typedef struct CPUTimer CPUTimer; diff --git a/ui/console.c b/ui/console.c index 586fc6d6f1..502e1600ab 100644 --- a/ui/console.c +++ b/ui/console.c @@ -161,7 +161,7 @@ struct QemuConsole { }; struct DisplayState { - struct QEMUTimer *gui_timer; + QEMUTimer *gui_timer; uint64_t last_update; uint64_t update_interval; bool refreshing; From cb77e358152afb348a513d8eb404cb7ff65cfad2 Mon Sep 17 00:00:00 2001 From: Zhi Yong Wu Date: Wed, 27 Nov 2013 15:35:26 +0800 Subject: [PATCH 09/14] virtio-net: fix the indent Signed-off-by: Zhi Yong Wu Reviewed-by: Fam Zheng Signed-off-by: Michael Tokarev --- hw/net/virtio-net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index b75c753305..90eca9a87e 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1428,7 +1428,7 @@ static NetClientInfo net_virtio_info = { .size = sizeof(NICState), .can_receive = virtio_net_can_receive, .receive = virtio_net_receive, - .cleanup = virtio_net_cleanup, + .cleanup = virtio_net_cleanup, .link_status_changed = virtio_net_set_link_status, .query_rx_filter = virtio_net_query_rxfilter, }; From 754e72e195faca8042072ada054bc3668aa1647d Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 17 Nov 2013 22:11:23 +0100 Subject: [PATCH 10/14] libcacard/cac: Remove unused statement (value stored is never read) Warning from ccc-analyzer: libcacard/cac.c:192:13: warning: Value stored to 'ret' is never read ret = VCARD_DONE; ^ ~~~~~~~~~~ Here 'ret' is assigned a value inside of a switch statement and also after that switch statement. Signed-off-by: Stefan Weil Signed-off-by: Michael Tokarev --- libcacard/cac.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libcacard/cac.c b/libcacard/cac.c index 7a06b5a31b..74ef3e3cec 100644 --- a/libcacard/cac.c +++ b/libcacard/cac.c @@ -189,7 +189,6 @@ cac_applet_pki_process_apdu(VCard *card, VCardAPDU *apdu, pki_applet->sign_buffer = sign_buffer; pki_applet->sign_buffer_len = size; *response = vcard_make_response(VCARD7816_STATUS_SUCCESS); - ret = VCARD_DONE; break; case 0x00: /* we now have the whole buffer, do the operation, result will be From efbc42e5848bb8000bfa6927847f1870850942ba Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 17 Nov 2013 22:12:18 +0100 Subject: [PATCH 11/14] libcacard/vcard_emul_nss: Remove unused statement (value stored is never read) Warning from ccc-analyzer: libcacard/vcard_emul_nss.c:937:9: warning: Value stored to 'cert_count' is never read cert_count = options->vreader[i].cert_count; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Stefan Weil Signed-off-by: Michael Tokarev --- libcacard/vcard_emul_nss.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c index fb429b1f82..ee2dfaee82 100644 --- a/libcacard/vcard_emul_nss.c +++ b/libcacard/vcard_emul_nss.c @@ -934,7 +934,6 @@ vcard_emul_init(const VCardEmulOptions *options) vreader = vreader_new(options->vreader[i].vname, vreader_emul, vreader_emul_delete); vreader_add_reader(vreader); - cert_count = options->vreader[i].cert_count; vcard_emul_alloc_arrays(&certs, &cert_len, &keys, options->vreader[i].cert_count); From 4282c8277013dc5613b8f27845f6121b66b7cbff Mon Sep 17 00:00:00 2001 From: Don Koch Date: Tue, 19 Nov 2013 15:01:59 -0500 Subject: [PATCH 12/14] Don't crash on keyboard input with no handler Prevent a call to put_kbd if null. On shutdown of some OSes, the keyboard handler goes away before the system is down. If a key is typed during this window, qemu crashes. Signed-off-by: Don Koch Signed-off-by: Michael Tokarev --- ui/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/input.c b/ui/input.c index 10d8c056f1..1c70f60e0d 100644 --- a/ui/input.c +++ b/ui/input.c @@ -414,7 +414,7 @@ void kbd_put_keycode(int keycode) if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) { return; } - if (entry) { + if (entry && entry->put_kbd) { entry->put_kbd(entry->opaque, keycode); } } From a6b6d08a3bf93c8cc6521336a89ac0467ab7edca Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Mon, 2 Dec 2013 21:17:19 +0400 Subject: [PATCH 13/14] hw/ppc/mac.h: remove unused BIOS_FILENAME definition This definition has been moved to prep.c. Signed-off-by: Michael Tokarev --- hw/ppc/mac.h | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index 1e578dd59d..c1faf9ce27 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -34,7 +34,6 @@ #define MAX_CPUS 1 #define BIOS_SIZE (1024 * 1024) -#define BIOS_FILENAME "ppc_rom.bin" #define NVRAM_SIZE 0x2000 #define PROM_FILENAME "openbios-ppc" #define PROM_ADDR 0xfff00000 From 6fedcaa1c5419fa89c31fd34dabbd71861c615d2 Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Wed, 4 Dec 2013 10:27:29 +0400 Subject: [PATCH 14/14] eeprom93xx: fix coding style scripts/checkpatch.pl reports about some style problems, this commit fixes some of them: ERROR: space prohibited before open square bracket '[' + .fields = (VMStateField []) { ERROR: space prohibited after that '!' (ctx:BxW) + if (! eeprom->eecs && eecs) { ^ ERROR: space prohibited after that '!' (ctx:WxW) + } else if (eeprom->eecs && ! eecs) { ^ ERROR: space prohibited after that '!' (ctx:WxW) + } else if (eecs && ! eeprom->eesk && eesk) { ^ ERROR: switch and case should be at the same indent switch (address >> (eeprom->addrbits - 2)) { + case 0: [...] + case 1: [...] + case 2: [...] + case 3: ERROR: return is not a function, parentheses are not required + return (eeprom->eedo); ERROR: switch and case should be at the same indent switch (nwords) { + case 16: + case 64: [...] + case 128: + case 256: [...] + default: Signed-off-by: Antony Pavlov Cc: Stefan Weil Reviewed-by: Stefan Weil Cc: qemu-trivial@nongnu.org Signed-off-by: Michael Tokarev --- hw/nvram/eeprom93xx.c | 62 +++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/hw/nvram/eeprom93xx.c b/hw/nvram/eeprom93xx.c index 08f4df586c..a98f924b81 100644 --- a/hw/nvram/eeprom93xx.c +++ b/hw/nvram/eeprom93xx.c @@ -126,7 +126,7 @@ static const VMStateDescription vmstate_eeprom = { .version_id = EEPROM_VERSION, .minimum_version_id = OLD_EEPROM_VERSION, .minimum_version_id_old = OLD_EEPROM_VERSION, - .fields = (VMStateField []) { + .fields = (VMStateField[]) { VMSTATE_UINT8(tick, eeprom_t), VMSTATE_UINT8(address, eeprom_t), VMSTATE_UINT8(command, eeprom_t), @@ -157,13 +157,13 @@ void eeprom93xx_write(eeprom_t *eeprom, int eecs, int eesk, int eedi) logout("CS=%u SK=%u DI=%u DO=%u, tick = %u\n", eecs, eesk, eedi, eedo, tick); - if (! eeprom->eecs && eecs) { + if (!eeprom->eecs && eecs) { /* Start chip select cycle. */ logout("Cycle start, waiting for 1st start bit (0)\n"); tick = 0; command = 0x0; address = 0x0; - } else if (eeprom->eecs && ! eecs) { + } else if (eeprom->eecs && !eecs) { /* End chip select cycle. This triggers write / erase. */ if (eeprom->writable) { uint8_t subcommand = address >> (eeprom->addrbits - 2); @@ -189,7 +189,7 @@ void eeprom93xx_write(eeprom_t *eeprom, int eecs, int eesk, int eedi) } /* Output DO is tristate, read results in 1. */ eedo = 1; - } else if (eecs && ! eeprom->eesk && eesk) { + } else if (eecs && !eeprom->eesk && eesk) { /* Raising edge of clock shifts data in. */ if (tick == 0) { /* Wait for 1st start bit. */ @@ -230,20 +230,20 @@ void eeprom93xx_write(eeprom_t *eeprom, int eecs, int eesk, int eedi) if (command == 0) { /* Command code in upper 2 bits of address. */ switch (address >> (eeprom->addrbits - 2)) { - case 0: - logout("write disable command\n"); - eeprom->writable = 0; - break; - case 1: - logout("write all command\n"); - break; - case 2: - logout("erase all command\n"); - break; - case 3: - logout("write enable command\n"); - eeprom->writable = 1; - break; + case 0: + logout("write disable command\n"); + eeprom->writable = 0; + break; + case 1: + logout("write all command\n"); + break; + case 2: + logout("erase all command\n"); + break; + case 3: + logout("write enable command\n"); + eeprom->writable = 1; + break; } } else { /* Read, write or erase word. */ @@ -276,7 +276,7 @@ uint16_t eeprom93xx_read(eeprom_t *eeprom) { /* Return status of pin DO (0 or 1). */ logout("CS=%u DO=%u\n", eeprom->eecs, eeprom->eedo); - return (eeprom->eedo); + return eeprom->eedo; } #if 0 @@ -296,18 +296,18 @@ eeprom_t *eeprom93xx_new(DeviceState *dev, uint16_t nwords) uint8_t addrbits; switch (nwords) { - case 16: - case 64: - addrbits = 6; - break; - case 128: - case 256: - addrbits = 8; - break; - default: - assert(!"Unsupported EEPROM size, fallback to 64 words!"); - nwords = 64; - addrbits = 6; + case 16: + case 64: + addrbits = 6; + break; + case 128: + case 256: + addrbits = 8; + break; + default: + assert(!"Unsupported EEPROM size, fallback to 64 words!"); + nwords = 64; + addrbits = 6; } eeprom = (eeprom_t *)g_malloc0(sizeof(*eeprom) + nwords * 2);