Remove some of the fprintf(stderr, "*
Re: [Qemu-devel] [PATCH v2 37/47] hw/sparc*: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 3 lines
Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>
Quoted 145 lines
Cc Fabien Chouteau <[email protected]>Cc Mark Cave-Ayland <[email protected]>Cc Artyom Tarasenko <[email protected]>---
V2:
- Split hw patch into individual directorieshw/sparc/leon3.c | 9 +++++---- hw/sparc/sun4m.c | 8 ++++---- hw/sparc64/niagara.c | 2 +- hw/sparc64/sun4u.c | 9 +++++---- 4 files changed, 15 insertions(+), 13 deletions(-)hw/sparc/leon3.c +5
-4@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -172,7 +173,7 @@ static void leon3_generic_hw_init(MachineState *machine) }if (bios_size > prom_size) { -fprintf (stderr,"qemu: could not load prom '%s': file too big\n" , +error_report ("qemu: could not load prom '%s': file too big" , filename);exit (1 ); }@@ -180,11 +181,11 @@ static void leon3_generic_hw_init(MachineState *machine)if (bios_size >0 ) { ret =load_image_targphys (filename,0x00000000 , bios_size);if (ret <0 || ret > prom_size) { -fprintf (stderr,"qemu: could not load prom '%s'\n" , filename); +error_report ("qemu: could not load prom '%s'" , filename);exit (1 ); } }else if (kernel_filename ==NULL && !qtest_enabled ()) { -fprintf (stderr,"Can't read bios image %s\n" , filename); +error_report ("Can't read bios image %s" , filename);exit (1 ); }g_free (filename);@@ -197,7 +198,7 @@ static void leon3_generic_hw_init(MachineState *machine) kernel_size =load_elf (kernel_filename,NULL ,NULL , &entry,NULL ,NULL ,1 /* big endian */ ,EM_SPARC ,0 ,0 );if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }hw/sparc/sun4m.c +4
-4@@ -261,7 +261,7 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,KERNEL_LOAD_ADDR , RAM_size - KERNEL_LOAD_ADDR);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }@@ -273,8 +273,8 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,INITRD_LOAD_ADDR , RAM_size - INITRD_LOAD_ADDR);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + initrd_filename);exit (1 ); } }@@ -688,7 +688,7 @@ static void prom_init(hwaddr addr, const char *bios_name) ret =-1 ; }if (ret <0 || ret >PROM_SIZE_MAX ) { -fprintf (stderr,"qemu: could not load prom '%s'\n" , bios_name); +error_report ("qemu: could not load prom '%s'" , bios_name);exit (1 ); } }hw/sparc64/niagara.c +1
-1@@ -153,7 +153,7 @@ static void niagara_init(MachineState *machine) dinfo->is_default =1 ;rom_add_file_fixed (blk_bs (blk)->filename,NIAGARA_VDISK_BASE ,-1 ); }else { -fprintf (stderr,"qemu: could not load ram disk '%s'\n" , +error_report ("qemu: could not load ram disk '%s'" ,blk_bs (blk)->filename);exit (1 ); }hw/sparc64/sun4u.c +5
-4@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -165,7 +166,7 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename, RAM_size - KERNEL_LOAD_ADDR); }if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }@@ -178,8 +179,8 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename, *initrd_addr, RAM_size - *initrd_addr);if ((int )*initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + initrd_filename);exit (1 ); } }@@ -322,7 +323,7 @@ static void prom_init(hwaddr addr, const char *bios_name) ret =-1 ; }if (ret <0 || ret >PROM_SIZE_MAX ) { -fprintf (stderr,"qemu: could not load prom '%s'\n" , bios_name); +error_report ("qemu: could not load prom '%s'" , bios_name);exit (1 ); } }
Re: [Qemu-devel] [PATCH v2 43/47] util: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 1 line
Signed-off-by Alistair Francis <[email protected]>
Quoted 345 lines
Cc Kevin Wolf <[email protected]>Cc Markus Armbruster <[email protected]>Cc Paolo Bonzini <[email protected]>Cc Stefan Weil <[email protected]>---
util/aio-posix.c | 5 +++-- util/coroutine-sigaltstack.c | 2 +- util/error.c | 2 +- util/main-loop.c | 2 +- util/mmap-alloc.c | 3 ++- util/module.c | 6 +++--- util/osdep.c | 4 ++-- util/oslib-posix.c | 3 ++- util/oslib-win32.c | 3 ++- util/qemu-coroutine.c | 5 +++-- util/qemu-progress.c | 3 ++- util/qemu-thread-posix.c | 5 +++-- util/qemu-thread-win32.c | 5 +++-- util/qemu-timer-common.c | 3 ++- util/qht.c | 2 +- 15 files changed, 31 insertions(+), 22 deletions(-)util/aio-posix.c +3
-2@@ -15,6 +15,7 @@#include "qemu/osdep.h" #include "qemu-common.h" +#include "qemu/error-report.h" #include "block/block.h" #include "qemu/rcu_queue.h" #include "qemu/sockets.h" @@ -696,8 +697,8 @@ void aio_context_setup(AioContext *ctx) {/* TODO remove this in final patch submission */ if (getenv ("QEMU_AIO_POLL_MAX_NS" )) { -fprintf (stderr,"The QEMU_AIO_POLL_MAX_NS environment variable has " -"been replaced with -object iothread,poll-max-ns=NUM\n" ); +error_report ("The QEMU_AIO_POLL_MAX_NS environment variable has " +"been replaced with -object iothread,poll-max-ns=NUM" );exit (1 ); }util/coroutine-sigaltstack.c +1
-1@@ -80,7 +80,7 @@ static void __attribute__((constructor)) coroutine_init(void) ret =pthread_key_create (&thread_state_key, qemu_coroutine_thread_cleanup);if (ret !=0 ) { -fprintf (stderr,"unable to create leader key: %s\n" ,strerror (errno)); +error_report ("unable to create leader key: %s" ,strerror (errno));abort (); } }util/error.c +1
-1@@ -32,7 +32,7 @@ Error *error_fatal;static void error_handle_fatal (Error **errp,Error *err) {if (errp == &error_abort) { -fprintf (stderr,"Unexpected error in %s() at %s:%d:\n" , +error_report ("Unexpected error in %s() at %s:%d:" , err->func, err->src, err->line);error_report_err (err);abort ();util/main-loop.c +1
-1@@ -95,7 +95,7 @@ static int qemu_signal_init(void)sigdelset (&set,SIG_IPI ); sigfd =qemu_signalfd (&set);if (sigfd ==-1 ) { -fprintf (stderr,"failed to create signalfd\n" ); +error_report ("failed to create signalfd" );return -errno; }util/mmap-alloc.c +2
-1@@ -11,6 +11,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu/mmap-alloc.h" #include "qemu/host-utils.h" @@ -51,7 +52,7 @@ size_t qemu_mempath_getpagesize(const char *mem_path) }while (ret !=0 && errno ==EINTR );if (ret !=0 ) { -fprintf (stderr,"Couldn't statfs() memory path: %s\n" , +error_report ("Couldn't statfs() memory path: %s" ,strerror (errno));exit (1 ); }util/module.c +3
-3@@ -124,13 +124,13 @@ static int module_load_file(const char *fname) g_module =g_module_open (fname,G_MODULE_BIND_LAZY |G_MODULE_BIND_LOCAL );if (!g_module) { -fprintf (stderr,"Failed to open module: %s\n" , +error_report ("Failed to open module: %s" ,g_module_error ()); ret = -EINVAL ; goto out; }if (!g_module_symbol (g_module,DSO_STAMP_FUN_STR , (gpointer *)&sym)) { -fprintf (stderr,"Failed to initialize module: %s\n" , +error_report ("Failed to initialize module: %s" , fname);/* Print some info if this is a QEMU module (but from different build), * this will make debugging user problems easier. */ @@ -169,7 +169,7 @@ void module_load_one(const char *prefix, const char *lib_name)static GHashTable *loaded_modules;if (!g_module_supported ()) { -fprintf (stderr,"Module is not supported by system.\n" ); +error_report ("Module is not supported by system." );return ; }util/osdep.c +2
-2@@ -425,7 +425,7 @@ void fips_set_state(bool requested)#endif /* __linux__ */ #ifdef _FIPS_DEBUG -fprintf (stderr,"FIPS mode %s (requested %s)\n" , +error_report ("FIPS mode %s (requested %s)" , (fips_enabled ?"enabled" :"disabled" ), (requested ?"enabled" :"disabled" ));#endif @@ -452,7 +452,7 @@ int socket_init(void) ret =WSAStartup (MAKEWORD (2 ,2 ), &Data);if (ret !=0 ) { err =WSAGetLastError (); -fprintf (stderr,"WSAStartup: %d\n" , err); +error_report ("WSAStartup: %d" , err);return -1 ; }atexit (socket_cleanup);util/oslib-posix.c +2
-1@@ -34,6 +34,7 @@#include "sysemu/sysemu.h" #include "trace.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "qemu/sockets.h" #include <libgen.h> #include <sys/signal.h> @@ -87,7 +88,7 @@ int qemu_daemon(int nochdir, int noclose)void *qemu_oom_check (void *ptr) {if (ptr ==NULL ) { -fprintf (stderr,"Failed to allocate memory: %s\n" ,strerror (errno)); +error_report ("Failed to allocate memory: %s" ,strerror (errno));abort (); }return ptr;util/oslib-win32.c +2
-1@@ -30,6 +30,7 @@* see the license comment there. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include <windows.h> #include "qapi/error.h" #include "sysemu/sysemu.h" @@ -44,7 +45,7 @@void *qemu_oom_check (void *ptr) {if (ptr ==NULL ) { -fprintf (stderr,"Failed to allocate memory: %lu\n" ,GetLastError ()); +error_report ("Failed to allocate memory: %lu" ,GetLastError ());abort (); }return ptr;util/qemu-coroutine.c +3
-2@@ -13,6 +13,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "trace.h" #include "qemu-common.h" #include "qemu/thread.h" @@ -110,7 +111,7 @@ void qemu_aio_coroutine_enter(AioContext *ctx, Coroutine *co)trace_qemu_aio_coroutine_enter (ctx, self, co, co->entry_arg);if (co->caller) { -fprintf (stderr,"Co-routine re-entered recursively\n" ); +error_report ("Co-routine re-entered recursively" );abort (); }@@ -164,7 +165,7 @@ void coroutine_fn qemu_coroutine_yield(void)trace_qemu_coroutine_yield (self, to);if (!to) { -fprintf (stderr,"Co-routine is yielding to no one\n" ); +error_report ("Co-routine is yielding to no one" );abort (); }util/qemu-progress.c +2
-1@@ -23,6 +23,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" struct progress_state {@@ -68,7 +69,7 @@ static void sigusr_print(int signal)static void progress_dummy_print (void ) {if (print_pending) { -fprintf (stderr," (%3.2f/100%%)\n" , state.current); +error_report (" (%3.2f/100%%)" , state.current); print_pending =0 ; } }util/qemu-thread-posix.c +3
-2@@ -11,6 +11,7 @@* */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu/thread.h" #include "qemu/atomic.h" #include "qemu/notify.h" @@ -25,14 +26,14 @@ void qemu_thread_naming(bool enable)#ifndef CONFIG_THREAD_SETNAME_BYTHREAD /* This is a debugging option, not fatal */ if (enable) { -fprintf (stderr,"qemu: thread naming not supported on this host\n" ); +error_report ("qemu: thread naming not supported on this host" ); }#endif }static void error_exit (int err,const char *msg) { -fprintf (stderr,"qemu: %s: %s\n" , msg,strerror (err)); +error_report ("qemu: %s: %s" , msg,strerror (err));abort (); }util/qemu-thread-win32.c +3
-2@@ -16,6 +16,7 @@#endif #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "qemu/thread.h" #include "qemu/notify.h" @@ -29,7 +30,7 @@ void qemu_thread_naming(bool enable)/* But note we don't actually name them on Windows yet */ name_threads = enable; -fprintf (stderr,"qemu: thread naming not supported on this host\n" ); +error_report ("qemu: thread naming not supported on this host" ); }static void error_exit (int err,const char *msg)@@ -38,7 +39,7 @@ static void error_exit(int err, const char *msg)FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_ALLOCATE_BUFFER ,NULL , err,0 , (LPTSTR )&pstr,2 ,NULL ); -fprintf (stderr,"qemu: %s: %s\n" , msg, pstr); +error_report ("qemu: %s: %s" , msg, pstr);LocalFree (pstr);abort (); }util/qemu-timer-common.c +2
-1@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu/timer.h" /***********************************************************/ @@ -37,7 +38,7 @@ static void __attribute__((constructor)) init_get_clock(void)int ret; ret =QueryPerformanceFrequency (&freq);if (ret ==0 ) { -fprintf (stderr,"Could not calibrate ticks\n" ); +error_report ("Could not calibrate ticks" );exit (1 ); } clock_freq = freq.QuadPart;util/qht.c +1
-1@@ -154,7 +154,7 @@ static void qht_bucket_debug__locked(struct qht_bucket *b)continue ; }if (seen_empty) { -fprintf (stderr,"%s: b: %p, pos: %i, hash: 0x%x, p: %p\n" , +error_report ("%s: b: %p, pos: %i, hash: 0x%x, p: %p" , __func__, b, i, b->hashes[i], b->pointers[i]); corrupt = true; }
Re: [Qemu-devel] [PATCH v2 23/47] hw/microblaze: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 3 lines
Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>
Quoted 22 lines
Cc "Edgar E. Iglesias" <[email protected]>---
V2:
- Split hw patch into individual directorieshw/microblaze/boot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/microblaze/boot.c +1
-1@@ -86,7 +86,7 @@ static int microblaze_load_dtb(hwaddr addr, r =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , kernel_cmdline);if (r <0 ) { -fprintf (stderr,"couldn't set /chosen/bootargs\n" ); +error_report ("couldn't set /chosen/bootargs" ); } }
Re: [Qemu-arm] [PATCH v2 05/47] hw/arm: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 123 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>---
V2:
- Split hw patch into individual directorieshw/arm/armv7m.c | 2 +- hw/arm/boot.c | 34 +++++++++++++++++----------------- hw/arm/gumstix.c | 13 +++++++------ hw/arm/mainstone.c | 7 ++++--- hw/arm/musicpal.c | 2 +- hw/arm/omap1.c | 5 +++-- hw/arm/omap2.c | 23 ++++++++++++----------- hw/arm/omap_sx1.c | 6 +++--- hw/arm/palm.c | 10 +++++----- hw/arm/pxa2xx.c | 7 ++++--- hw/arm/stellaris.c | 3 ++- hw/arm/tosa.c | 17 +++++++++-------- hw/arm/versatilepb.c | 2 +- hw/arm/vexpress.c | 8 ++++---- hw/arm/z2.c | 6 +++--- 15 files changed, 76 insertions(+), 69 deletions(-)hw/arm/armv7m.c +1
-1@@ -278,7 +278,7 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename, int mem_size)#endif if (!kernel_filename && !qtest_enabled ()) { -fprintf (stderr,"Guest image must be specified (using -kernel)\n" ); +error_report ("Guest image must be specified (using -kernel)" );exit (1 ); }hw/arm/boot.c +5
-4@@ -8,6 +8,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include <libfdt.h> #include "hw/hw.h" @@ -418,13 +419,13 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,char *filename; filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , binfo->dtb_filename);if (!filename) { -fprintf (stderr,"Couldn't open dtb file %s\n" , binfo->dtb_filename); +error_report ("Couldn't open dtb file %s" , binfo->dtb_filename); goto fail; } fdt =load_device_tree (filename, &size);if (!fdt) { -fprintf (stderr,"Couldn't open dtb file %s\n" , filename); +error_report ("Couldn't open dtb file %s" , filename);g_free (filename); goto fail; }@@ -432,7 +433,7 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo, }else { fdt = binfo->get_dtb (binfo, &size);if (!fdt) { -fprintf (stderr,"Board was unable to create a dtb blob\n" ); +error_report ("Board was unable to create a dtb blob" ); goto fail; } }@@ -451,7 +452,7 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo, scells =qemu_fdt_getprop_cell (fdt,"/" ,"#size-cells" ,NULL , &error_fatal);if (acells ==0 || scells ==0 ) { -fprintf (stderr,"dtb file invalid (#address-cells or #size-cells 0)\n" ); +error_report ("dtb file invalid (#address-cells or #size-cells 0)" ); goto fail; }
hw/arm/boot.c static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo, · line 463
Quoted 5 lines
hw/arm/boot.c +0
-2@@ -459,8 +460,7 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,/* This is user error so deserves a friendlier error message * than the failure of setprop_sized_cells would provide */ -fprintf (stderr,"qemu: dtb file not compatible with " -"RAM size > 4GB\n" );
Maybe we can drop the "qemu:"
Quoted 207 lines
hw/arm/boot.c +12
-11+error_report ("qemu: dtb file not compatible with RAM size > 4GB" ); goto fail; }@@ -480,7 +480,7 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo, acells, mem_base, scells, mem_len);if (rc <0 ) { -fprintf (stderr,"couldn't set %s/reg for node %d\n" , nodename, +error_report ("couldn't set %s/reg for node %d" , nodename, i); goto fail; }@@ -505,7 +505,7 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo, acells, binfo->loader_start, scells, binfo->ram_size);if (rc <0 ) { -fprintf (stderr,"couldn't set /memory/reg\n" ); +error_report ("couldn't set /memory/reg" ); goto fail; } }@@ -519,7 +519,7 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo, rc =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , binfo->kernel_cmdline);if (rc <0 ) { -fprintf (stderr,"couldn't set /chosen/bootargs\n" ); +error_report ("couldn't set /chosen/bootargs" ); goto fail; } }@@ -528,14 +528,14 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo, rc =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , binfo->initrd_start);if (rc <0 ) { -fprintf (stderr,"couldn't set /chosen/linux,initrd-start\n" ); +error_report ("couldn't set /chosen/linux,initrd-start" ); goto fail; } rc =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , binfo->initrd_start + binfo->initrd_size);if (rc <0 ) { -fprintf (stderr,"couldn't set /chosen/linux,initrd-end\n" ); +error_report ("couldn't set /chosen/linux,initrd-end" ); goto fail; } }@@ -690,7 +690,7 @@ static void load_image_to_fw_cfg(FWCfgState *fw_cfg, uint16_t size_key,gsize length;if (!g_file_get_contents (image_name, &contents, &length,NULL )) { -fprintf (stderr,"failed to load \"%s\"\n" , image_name); +error_report ("failed to load \"%s\"" , image_name);exit (1 ); } size = length;@@ -956,7 +956,7 @@ static void arm_load_kernel_notify(Notifier *notifier, void *data) is_linux =1 ; }if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , info->kernel_filename);exit (1 ); }@@ -976,7 +976,7 @@ static void arm_load_kernel_notify(Notifier *notifier, void *data) info->initrd_start); }if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initrd '%s'\n" , +error_report ("qemu: could not load initrd '%s'" , info->initrd_filename);exit (1 ); }@@ -1021,9 +1021,9 @@ static void arm_load_kernel_notify(Notifier *notifier, void *data) }else { fixupcontext[FIXUP_ARGPTR ] = info->loader_start +KERNEL_ARGS_ADDR ;if (info->ram_size >= (1ULL <<32 )) { -fprintf (stderr,"qemu: RAM size must be less than 4GB to boot" -" Linux kernel using ATAGS (try passing a device tree" -" using -dtb)\n" ); +error_report ("qemu: RAM size must be less than 4GB to boot" +" Linux kernel using ATAGS (try passing a device tree" +" using -dtb)" );exit (1 ); } }hw/arm/gumstix.c +7
-6@@ -35,6 +35,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/arm/pxa.h" #include "net/net.h" @@ -62,8 +63,8 @@ static void connex_init(MachineState *machine) dinfo =drive_get (IF_PFLASH ,0 ,0 );if (!dinfo && !qtest_enabled ()) { -fprintf (stderr,"A flash image must be given with the " -"'pflash' parameter\n" ); +error_report ("A flash image must be given with the " +"'pflash' parameter" );exit (1 ); }@@ -76,7 +77,7 @@ static void connex_init(MachineState *machine) dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, sector_len, connex_rom / sector_len, 2, 0, 0, 0, 0, be)) { -fprintf (stderr,"qemu: Error registering flash memory.\n" ); +error_report ("qemu: Error registering flash memory." );exit (1 ); }@@ -99,8 +100,8 @@ static void verdex_init(MachineState *machine) dinfo =drive_get (IF_PFLASH ,0 ,0 );if (!dinfo && !qtest_enabled ()) { -fprintf (stderr,"A flash image must be given with the " -"'pflash' parameter\n" ); +error_report ("A flash image must be given with the " +"'pflash' parameter" );exit (1 ); }@@ -113,7 +114,7 @@ static void verdex_init(MachineState *machine) dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, sector_len, verdex_rom / sector_len, 2, 0, 0, 0, 0, be)) { -fprintf (stderr,"qemu: Error registering flash memory.\n" ); +error_report ("qemu: Error registering flash memory." );exit (1 ); }hw/arm/mainstone.c +4
-3@@ -12,6 +12,7 @@* GNU GPL, version 2 or (at your option) any later version. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "hw/hw.h" #include "hw/arm/pxa.h" @@ -143,8 +144,8 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,if (qtest_enabled ()) {break ; } -fprintf (stderr,"Two flash images must be given with the " -"'pflash' parameter\n" ); +error_report ("Two flash images must be given with the " +"'pflash' parameter" );exit (1 ); }@@ -154,7 +155,7 @@ static void mainstone_common_init(MemoryRegion *address_space_mem, blk_by_legacy_dinfo(dinfo), sector_len, MAINSTONE_FLASH / sector_len, 4, 0, 0, 0, 0, be)) { -fprintf (stderr,"qemu: Error registering flash memory.\n" ); +error_report ("qemu: Error registering flash memory." );exit (1 ); } }hw/arm/musicpal.c +1
-1@@ -1626,7 +1626,7 @@ static void musicpal_init(MachineState *machine) flash_size =blk_getlength (blk);if (flash_size !=8 *1024 *1024 && flash_size !=16 *1024 *1024 && flash_size !=32 *1024 *1024 ) { -fprintf (stderr,"Invalid flash image size\n" ); +error_report ("Invalid flash image size" );exit (1 ); }hw/arm/omap1.c +2
-1@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -2313,7 +2314,7 @@ void omap_uwire_attach(struct omap_uwire_s *s, uWireSlave *slave, int chipselect) {if (chipselect <0 || chipselect >3 ) { -fprintf (stderr,"%s: Bad chipselect %i\n" , __func__, chipselect); +error_report ("%s: Bad chipselect %i" , __func__, chipselect);exit (-1 ); }
hw/arm/omap1.c struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory, · line 3993
Quoted 5 lines
hw/arm/omap1.c +1
-1@@ -3989,7 +3990,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory, dinfo =drive_get (IF_SD ,0 ,0 );if (!dinfo) { -fprintf (stderr,"qemu: missing SecureDigital device\n" ); +error_report ("qemu: missing SecureDigital device" );
anyway:
Quoted 349 lines
hw/arm/omap1.c +0
-0exit (1 ); } s->mmc = omap_mmc_init(0xfffb7800, system_memory,hw/arm/omap2.c +12
-11@@ -19,6 +19,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -1311,8 +1312,8 @@ static void omap_prcm_apll_update(struct omap_prcm_s *s)/* TODO: update clocks */ if (mode[0 ] ==1 || mode[0 ] ==2 || mode[1 ] ==1 || mode[1 ] ==2 ) -fprintf (stderr,"%s: bad EN_54M_PLL or bad EN_96M_PLL\n" , - __func__); +error_report ("%s: bad EN_54M_PLL or bad EN_96M_PLL" , + __func__); }static void omap_prcm_dpll_update (struct omap_prcm_s *s)@@ -1331,7 +1332,7 @@ static void omap_prcm_dpll_update(struct omap_prcm_s *s) s->dpll_lock =0 ;switch (mode) {case 0 : -fprintf (stderr,"%s: bad EN_DPLL\n" , __func__); +error_report ("%s: bad EN_DPLL" , __func__);break ;case 1 :/* Low-power bypass mode (Default) */ case 2 :/* Fast-relock bypass mode */ @@ -1358,7 +1359,7 @@ static void omap_prcm_dpll_update(struct omap_prcm_s *s)omap_clk_reparent (core, dpll_x2);break ;case 3 : -fprintf (stderr,"%s: bad CORE_CLK_SRC\n" , __func__); +error_report ("%s: bad CORE_CLK_SRC" , __func__);break ; } }@@ -1627,8 +1628,8 @@ static void omap_prcm_write(void *opaque, hwaddr addr,case 0x500 :/* CM_CLKEN_PLL */ if (value &0xffffff30 ) -fprintf (stderr,"%s: write 0s in CM_CLKEN_PLL for " -"future compatibility\n" , __func__); +error_report ("%s: write 0s in CM_CLKEN_PLL for " +"future compatibility" , __func__);if ((s->clken[9 ] ^ value) &0xcc ) { s->clken[9 ] &= ~0xcc ; s->clken[9 ] |= value &0xcc ;@@ -1646,8 +1647,8 @@ static void omap_prcm_write(void *opaque, hwaddr addr,break ;case 0x540 :/* CM_CLKSEL1_PLL */ if (value &0xfc4000d7 ) -fprintf (stderr,"%s: write 0s in CM_CLKSEL1_PLL for " -"future compatibility\n" , __func__); +error_report ("%s: write 0s in CM_CLKSEL1_PLL for " +"future compatibility" , __func__);if ((s->clksel[5 ] ^ value) &0x003fff00 ) { s->clksel[5 ] = value &0x03bfff28 ;omap_prcm_dpll_update (s);@@ -1658,8 +1659,8 @@ static void omap_prcm_write(void *opaque, hwaddr addr,break ;case 0x544 :/* CM_CLKSEL2_PLL */ if (value & ~3 ) -fprintf (stderr,"%s: write 0s in CM_CLKSEL2_PLL[31:2] for " -"future compatibility\n" , __func__); +error_report ("%s: write 0s in CM_CLKSEL2_PLL[31:2] for " +"future compatibility" , __func__);if (s->clksel[6 ] != (value &3 )) { s->clksel[6 ] = value &3 ;omap_prcm_dpll_update (s);@@ -2486,7 +2487,7 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem, dinfo =drive_get (IF_SD ,0 ,0 );if (!dinfo) { -fprintf (stderr,"qemu: missing SecureDigital device\n" ); +error_report ("qemu: missing SecureDigital device" );exit (1 ); } s->mmc = omap2_mmc_init(omap_l4tao(s->l4, 9),hw/arm/omap_sx1.c +3
-3@@ -158,7 +158,7 @@ static void sx1_init(MachineState *machine, const int version) blk_by_legacy_dinfo(dinfo), sector_size, flash_size / sector_size, 4, 0, 0, 0, 0, be)) { -fprintf (stderr,"qemu: Error registering flash memory %d.\n" , +error_report ("qemu: Error registering flash memory %d." , fl_idx); } fl_idx++;@@ -182,7 +182,7 @@ static void sx1_init(MachineState *machine, const int version) blk_by_legacy_dinfo(dinfo), sector_size, flash1_size / sector_size, 4, 0, 0, 0, 0, be)) { -fprintf (stderr,"qemu: Error registering flash memory %d.\n" , +error_report ("qemu: Error registering flash memory %d." , fl_idx); } fl_idx++;@@ -194,7 +194,7 @@ static void sx1_init(MachineState *machine, const int version) }if (!machine->kernel_filename && !fl_idx && !qtest_enabled ()) { -fprintf (stderr,"Kernel or Flash image must be specified\n" ); +error_report ("Kernel or Flash image must be specified" );exit (1 ); }hw/arm/palm.c +5
-5@@ -233,8 +233,8 @@ static void palmte_init(MachineState *machine)if (nb_option_roms) { rom_size =get_image_size (option_rom[0 ].name);if (rom_size > flash_size) { -fprintf (stderr,"%s: ROM image too big (%x > %x)\n" , - __func__, rom_size, flash_size); +error_report ("%s: ROM image too big (%x > %x)" , + __func__, rom_size, flash_size); rom_size =0 ; }if (rom_size >0 ) {@@ -243,13 +243,13 @@ static void palmte_init(MachineState *machine) rom_loaded =1 ; }if (rom_size <0 ) { -fprintf (stderr,"%s: error loading '%s'\n" , - __func__, option_rom[0 ].name); +error_report ("%s: error loading '%s'" , + __func__, option_rom[0 ].name); } }if (!rom_loaded && !kernel_filename && !qtest_enabled ()) { -fprintf (stderr,"Kernel or ROM image must be specified\n" ); +fprintf (stderr,"Kernel or ROM image must be specified" );exit (1 ); }hw/arm/pxa2xx.c +4
-3@@ -8,6 +8,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -2062,7 +2063,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space, s =g_new0 (PXA2xxState,1 );if (strncmp (cpu_type,"pxa27" ,5 )) { -fprintf (stderr,"Machine requires a PXA27x processor.\n" ); +error_report ("Machine requires a PXA27x processor." );exit (1 ); }@@ -2095,7 +2096,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space, dinfo =drive_get (IF_SD ,0 ,0 );if (!dinfo) { -fprintf (stderr,"qemu: missing SecureDigital device\n" ); +error_report ("qemu: missing SecureDigital device" );exit (1 ); } s->mmc = pxa2xx_mmci_init(address_space, 0x41100000,@@ -2220,7 +2221,7 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size) dinfo =drive_get (IF_SD ,0 ,0 );if (!dinfo) { -fprintf (stderr,"qemu: missing SecureDigital device\n" ); +error_report ("qemu: missing SecureDigital device" );exit (1 ); } s->mmc = pxa2xx_mmci_init(address_space, 0x41100000,hw/arm/stellaris.c +2
-1@@ -8,6 +8,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "hw/sysbus.h" #include "hw/ssi/ssi.h" @@ -559,7 +560,7 @@ static void ssys_write(void *opaque, hwaddr offset,case 0x040 :/* SRCR0 */ case 0x044 :/* SRCR1 */ case 0x048 :/* SRCR2 */ -fprintf (stderr,"Peripheral reset not implemented\n" ); +error_report ("Peripheral reset not implemented" );break ;case 0x054 :/* IMC */ s->int_mask = value &0x7f ;hw/arm/tosa.c +9
-8@@ -12,6 +12,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "hw/hw.h" #include "hw/arm/pxa.h" @@ -70,19 +71,19 @@ static void tosa_out_switch(void *opaque, int line, int level) {switch (line) {case 0 : -fprintf (stderr,"blue LED %s.\n" , level ?"on" :"off" ); +error_report ("blue LED %s." , level ?"on" :"off" );break ;case 1 : -fprintf (stderr,"green LED %s.\n" , level ?"on" :"off" ); +error_report ("green LED %s." , level ?"on" :"off" );break ;case 2 : -fprintf (stderr,"amber LED %s.\n" , level ?"on" :"off" ); +error_report ("amber LED %s." , level ?"on" :"off" );break ;case 3 : -fprintf (stderr,"wlan LED %s.\n" , level ?"on" :"off" ); +fprintf (stderr,"wlan LED %s." , level ?"on" :"off" );break ;default : -fprintf (stderr,"Uhandled out event: %d = %d\n" , line, level); +fprintf (stderr,"Uhandled out event: %d = %d" , line, level);break ; } }@@ -133,7 +134,7 @@ static void tosa_gpio_setup(PXA2xxState *cpu,static uint32_t tosa_ssp_tansfer (SSISlave *dev,uint32_t value) { -fprintf (stderr,"TG: %d %02x\n" , value >>5 , value &0x1f ); +error_report ("TG: %d %02x" , value >>5 , value &0x1f );return 0 ; }@@ -159,13 +160,13 @@ static int tosa_dac_send(I2CSlave *i2c, uint8_t data) s->buf[s->len] = data;if (s->len ++ >2 ) {#ifdef VERBOSE -fprintf (stderr,"%s: message too long (%i bytes)\n" , __func__, s->len); +error_report ("%s: message too long (%i bytes)" , __func__, s->len);#endif return 1 ; }if (s->len ==2 ) { -fprintf (stderr,"dac: channel %d value 0x%02x\n" , +error_report ("dac: channel %d value 0x%02x" , s->buf[0 ], s->buf[1 ]); }hw/arm/versatilepb.c +1
-1@@ -364,7 +364,7 @@ static void versatile_init(MachineState *machine, int board_id) VERSATILE_FLASH_SECT_SIZE, VERSATILE_FLASH_SIZE / VERSATILE_FLASH_SECT_SIZE, 4, 0x0089, 0x0018, 0x0000, 0x0, 0)) { -fprintf (stderr,"qemu: Error registering flash memory.\n" ); +error_report ("qemu: Error registering flash memory." ); } versatile_binfo.ram_size = machine->ram_size;hw/arm/vexpress.c +4
-4@@ -266,7 +266,7 @@ static void a9_daughterboard_init(const VexpressMachineState *vms,if (ram_size >0x40000000 ) {/* 1GB is the maximum the address space permits */ -fprintf (stderr,"vexpress-a9: cannot model more than 1GB RAM\n" ); +error_report ("vexpress-a9: cannot model more than 1GB RAM" );exit (1 ); }@@ -355,7 +355,7 @@ static void a15_daughterboard_init(const VexpressMachineState *vms,*/ uint64_t rsz = ram_size;if (rsz > (30ULL *1024 *1024 *1024 )) { -fprintf (stderr,"vexpress-a15: cannot model more than 30GB RAM\n" ); +error_report ("vexpress-a15: cannot model more than 30GB RAM" );exit (1 ); } }@@ -640,7 +640,7 @@ static void vexpress_common_init(MachineState *machine) pflash0 =ve_pflash_cfi01_register (map[VE_NORFLASH0 ],"vexpress.flash0" , dinfo);if (!pflash0) { -fprintf (stderr,"vexpress: error registering flash 0.\n" ); +error_report ("vexpress: error registering flash 0." );exit (1 ); }@@ -655,7 +655,7 @@ static void vexpress_common_init(MachineState *machine) dinfo =drive_get_next (IF_PFLASH );if (!ve_pflash_cfi01_register (map[VE_NORFLASH1 ],"vexpress.flash1" , dinfo)) { -fprintf (stderr,"vexpress: error registering flash 1.\n" ); +error_report ("vexpress: error registering flash 1." );exit (1 ); }hw/arm/z2.c +3
-3@@ -319,8 +319,8 @@ static void z2_init(MachineState *machine)#endif dinfo =drive_get (IF_PFLASH ,0 ,0 );if (!dinfo && !qtest_enabled ()) { -fprintf (stderr,"Flash image must be given with the " -"'pflash' parameter\n" ); +error_report ("Flash image must be given with the " +"'pflash' parameter" );exit (1 ); }@@ -329,7 +329,7 @@ static void z2_init(MachineState *machine) dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, sector_len, Z2_FLASH_SIZE / sector_len, 4, 0, 0, 0, 0, be)) { -fprintf (stderr,"qemu: Error registering flash memory.\n" ); +error_report ("qemu: Error registering flash memory." );exit (1 ); }
Re: [Qemu-devel] [PATCH v2 02/47] Fixes after renaming __FUNCTION__ to __func__
In reply to Alistair FrancisQuoted 23 lines · Alistair Francis
Signed-off-by Alistair Francis <[email protected]>Cc Eric Blake <[email protected]>---
hw/arm/omap1.c | 4 ++-- hw/arm/omap2.c | 2 +- hw/block/onenand.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)hw/arm/omap1.c +1
-1@@ -1717,7 +1717,7 @@ static void omap_clkm_write(void *opaque, hwaddr addr,if ((s->clkm.clocking_scheme ^ (value >>11 )) &7 ) { s->clkm.clocking_scheme = (value >>11 ) &7 ;printf ("%s: clocking scheme set to %s\n" , __func__, - clkschemename[s->clkm.clocking_scheme]); + clkschemename[s->clkm.clocking_scheme]); } s->clkm.cold_start &= value &0x3f ;return ;
hw/arm/omap1.c static void omap_mcbsp_writeh(void *opaque, hwaddr addr, · line 3339
Quoted 5 lines
hw/arm/omap1.c +1
-1@@ -3336,7 +3336,7 @@ static void omap_mcbsp_writeh(void *opaque, hwaddr addr, s->mcr[0 ] = value &0x03e1 ;if (value &1 )/* RMCM */ printf ("%s: Rx channel selection mode enable attempt\n" , - __func__); + __func__);
That would now also fit into one line.
hw/arm/omap2.c static void omap_prcm_apll_update(struct omap_prcm_s *s) · line 1315
Quoted 13 lines
hw/arm/omap1.c +0
-0return ;case 0x1c :/* RCERA */ s->rcer[0 ] = value &0xffff ;hw/arm/omap2.c +1
-1@@ -1312,7 +1312,7 @@ static void omap_prcm_apll_update(struct omap_prcm_s *s)if (mode[0 ] ==1 || mode[0 ] ==2 || mode[1 ] ==1 || mode[1 ] ==2 )fprintf (stderr,"%s: bad EN_54M_PLL or bad EN_96M_PLL\n" , - __func__); + __func__);
You're changing the indentation here again in patch 5 when you replace it with error_report ... so this hunk really seems like unnecessary code churn - I'd suggest to drop it.
Quoted 9 lines
hw/arm/omap2.c +0
-0}static void omap_prcm_dpll_update (struct omap_prcm_s *s)hw/block/onenand.c +0
-0
hw/block/onenand.c static uint64_t onenand_read(void *opaque, hwaddr addr, · line 669
Quoted 8 lines
hw/block/onenand.c +1
-1@@ -663,7 +663,7 @@ static uint64_t onenand_read(void *opaque, hwaddr addr,case 0xff02 :/* ECC Result of spare area data */ case 0xff03 :/* ECC Result of main area data */ case 0xff04 :/* ECC Result of spare area data */ -hw_error ("%s: imeplement ECC\n" , __func__); +hw_error ("%s: implement ECC\n" , __func__);return 0x0000 ; }
Thomas
Re: [Qemu-devel] [PATCH v2 03/47] audio: Replace AUDIO_FUNC with __func__
In reply to Alistair FrancisQuoted 3 lines · Alistair Francis
Apparently we don't use
__MSC_VERas a compiler anymore and we always require a C99 compiler (which means we always have__func__) so we don't need a specialAUDIO_FUNCmacro. We can just repleaceAUDIO_FUNCwith
s/repleace/replace/
Quoted 3 lines
__func__instead.Checkpatch failures where manually fixed.
s/where/were/
Re: [Qemu-devel] [PATCH v2 22/47] hw/m68k: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 4 lines
Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>Thomas Huth <[email protected]>
I guess the last line should have a "Cc:" prefix?
Anyway, patch looks fine to me, so:
Re: [Qemu-devel] [PATCH v2 29/47] hw/nvram: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 78 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>---
V2:
- Split hw patch into individual directorieshw/nvram/eeprom93xx.c | 5 +++-- hw/nvram/fw_cfg.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)hw/nvram/eeprom93xx.c +3
-2@@ -36,6 +36,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/nvram/eeprom93xx.h" @@ -105,8 +106,8 @@ static int get_uint16_from_uint8(QEMUFile *f, void *pv, size_t size,static int put_unused (QEMUFile *f,void *pv,size_t size,VMStateField *field,QJSON *vmdesc) { -fprintf (stderr,"uint16_from_uint8 is used only for backwards compatibility.\n" ); -fprintf (stderr,"Never should be used to write a new state.\n" ); +error_report ("uint16_from_uint8 is used only for backwards compatibility." ); +error_report ("Never should be used to write a new state." );exit (0 );return 0 ;hw/nvram/fw_cfg.c +0
-0
hw/nvram/fw_cfg.c static int get_uint32_as_uint16(QEMUFile *f, void *pv, size_t size, · line 522
Quoted 10 lines
hw/nvram/fw_cfg.c +2
-2@@ -515,8 +515,8 @@ static int get_uint32_as_uint16(QEMUFile *f, void *pv, size_t size,static int put_unused (QEMUFile *f,void *pv,size_t size,VMStateField *field,QJSON *vmdesc) { -fprintf (stderr,"uint32_as_uint16 is only used for backward compatibility.\n" ); -fprintf (stderr,"This functions shouldn't be called.\n" ); +error_report ("uint32_as_uint16 is only used for backward compatibility." ); +error_report ("This functions shouldn't be called." );return 0 ; }
Looking at that code, it sounds like we should rather drop the error printing here and use g_assert_not_reached() instead?
Thomas
Re: [Qemu-devel] [PATCH v2 30/47] hw/openrisc: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisHi Alistair,
Quoted 63 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>Cc Jia Liu <[email protected]>Cc Stafford Horne <[email protected]>---
V2:
- Split hw patch into individual directorieshw/openrisc/openrisc_sim.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/openrisc/openrisc_sim.c +1
-0@@ -19,6 +19,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h"
hw/openrisc/openrisc_sim.c static void cpu_openrisc_load_kernel(ram_addr_t ram_size, · line 94
Quoted 8 lines
hw/openrisc/openrisc_sim.c +1
-1@@ -87,7 +88,7 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size, }if (kernel_size <0 ) { -fprintf (stderr,"QEMU: couldn't load the kernel '%s'\n" , +error_report ("QEMU: couldn't load the kernel '%s'" , kernel_filename);exit (1 ); }
Re: [Qemu-devel] [PATCH v2 40/47] hw/usb: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 318 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>Cc Gerd Hoffmann <[email protected]>---
V2:
- Split hw patch into individual directorieshw/usb/core.c | 15 ++++++++------- hw/usb/desc.c | 4 ++-- hw/usb/dev-audio.c | 29 +++++++++++++++-------------- hw/usb/dev-bluetooth.c | 4 ++-- hw/usb/dev-mtp.c | 9 +++++---- hw/usb/dev-network.c | 20 ++++++++++---------- hw/usb/hcd-ehci.c | 32 ++++++++++++++++---------------- hw/usb/hcd-musb.c | 4 ++-- hw/usb/hcd-xhci.c | 3 ++- hw/usb/host-legacy.c | 2 +- 10 files changed, 63 insertions(+), 59 deletions(-)hw/usb/core.c +8
-7@@ -24,6 +24,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "hw/usb.h" #include "qemu/iov.h" @@ -599,7 +600,7 @@ void usb_packet_copy(USBPacket *p, void *ptr, size_t bytes)iov_from_buf (iov->iov, iov->niov, p->actual_length, ptr, bytes);break ;default : -fprintf (stderr,"%s: invalid pid: %x\n" , __func__, p->pid); +error_report ("%s: invalid pid: %x" , __func__, p->pid);abort (); } p->actual_length += bytes;@@ -681,7 +682,7 @@ void usb_ep_dump(USBDevice *dev) };int ifnum, ep, first; -fprintf (stderr,"Device \"%s\", config %d\n" , +error_report ("Device \"%s\", config %d" , dev->product_desc, dev->configuration);for (ifnum =0 ; ifnum <16 ; ifnum++) { first =1 ;@@ -690,10 +691,10 @@ void usb_ep_dump(USBDevice *dev) dev->ep_in[ep].ifnum == ifnum) {if (first) { first =0 ; -fprintf (stderr," Interface %d, alternative %d\n" , +error_report (" Interface %d, alternative %d" , ifnum, dev->altsetting[ifnum]); } -fprintf (stderr," Endpoint %d, IN, %s, %d max\n" , ep, +error_report (" Endpoint %d, IN, %s, %d max" , ep, tname[dev->ep_in[ep].type], dev->ep_in[ep].max_packet_size); }@@ -701,16 +702,16 @@ void usb_ep_dump(USBDevice *dev) dev->ep_out[ep].ifnum == ifnum) {if (first) { first =0 ; -fprintf (stderr," Interface %d, alternative %d\n" , +error_report (" Interface %d, alternative %d" , ifnum, dev->altsetting[ifnum]); } -fprintf (stderr," Endpoint %d, OUT, %s, %d max\n" , ep, +error_report (" Endpoint %d, OUT, %s, %d max" , ep, tname[dev->ep_out[ep].type], dev->ep_out[ep].max_packet_size); } } } -fprintf (stderr,"--\n" ); +error_report ("--" ); }struct USBEndpoint *usb_ep_get (USBDevice *dev,int pid,int ep)hw/usb/desc.c +2
-2@@ -1,5 +1,5 @@#include "qemu/osdep.h" - +#include "qemu/error-report.h" #include "hw/usb.h" #include "hw/usb/desc.h" #include "trace.h" @@ -688,7 +688,7 @@ int usb_desc_get_descriptor(USBDevice *dev, USBPacket *p,break ;default : -fprintf (stderr,"%s: %d unknown type %d (len %zd)\n" , __func__, +error_report ("%s: %d unknown type %d (len %zd)" , __func__, dev->addr, type, len);break ; }hw/usb/dev-audio.c +15
-14@@ -30,6 +30,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "hw/usb.h" #include "hw/usb/desc.h" @@ -398,7 +399,7 @@ static int usb_audio_set_output_altset(USBAudioState *s, int altset) }if (s->debug) { -fprintf (stderr,"usb-audio: set interface %d\n" , altset); +error_report ("usb-audio: set interface %d" , altset); } s->out.altset = altset;return 0 ;@@ -478,7 +479,7 @@ static int usb_audio_set_control(USBAudioState *s, uint8_t attrib,uint16_t vol = data[0 ] + (data[1 ] <<8 );if (s->debug) { -fprintf (stderr,"usb-audio: vol %04x\n" , (uint16_t )vol); +error_report ("usb-audio: vol %04x" , (uint16_t )vol); } vol -=0x8000 ;@@ -496,7 +497,7 @@ static int usb_audio_set_control(USBAudioState *s, uint8_t attrib,if (set_vol) {if (s->debug) { -fprintf (stderr,"usb-audio: mute %d, lvol %3d, rvol %3d\n" , +error_report ("usb-audio: mute %d, lvol %3d, rvol %3d" , s->out.mute, s->out.vol[0 ], s->out.vol[1 ]); } AUD_set_volume_out(s->out.voice, s->out.mute,@@ -514,8 +515,8 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p,int ret =0 ;if (s->debug) { -fprintf (stderr,"usb-audio: control transaction: " -"request 0x%04x value 0x%04x index 0x%04x length 0x%04x\n" , +error_report ("usb-audio: control transaction: " +"request 0x%04x value 0x%04x index 0x%04x length 0x%04x" , request, value, index, length); }@@ -533,7 +534,7 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, length, data);if (ret <0 ) {if (s->debug) { -fprintf (stderr,"usb-audio: fail: get control\n" ); +error_report ("usb-audio: fail: get control" ); } goto fail; }@@ -548,7 +549,7 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, length, data);if (ret <0 ) {if (s->debug) { -fprintf (stderr,"usb-audio: fail: set control\n" ); +error_report ("usb-audio: fail: set control" ); } goto fail; }@@ -557,8 +558,8 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p,default : fail:if (s->debug) { -fprintf (stderr,"usb-audio: failed control transaction: " -"request 0x%04x value 0x%04x index 0x%04x length 0x%04x\n" , +error_report ("usb-audio: failed control transaction: " +"request 0x%04x value 0x%04x index 0x%04x length 0x%04x" , request, value, index, length); } p->status =USB_RET_STALL ;@@ -581,7 +582,7 @@ static void usb_audio_handle_reset(USBDevice *dev)USBAudioState *s =USB_AUDIO (dev);if (s->debug) { -fprintf (stderr,"usb-audio: reset\n" ); +error_report ("usb-audio: reset" ); }usb_audio_set_output_altset (s,ALTSET_OFF ); }@@ -595,7 +596,7 @@ static void usb_audio_handle_dataout(USBAudioState *s, USBPacket *p)streambuf_put (&s->out.buf, p);if (p->actual_length < p->iov.size && s->debug >1 ) { -fprintf (stderr,"usb-audio: output overrun (%zd bytes)\n" , +error_report ("usb-audio: output overrun (%zd bytes)" , p->iov.size - p->actual_length); } }@@ -611,8 +612,8 @@ static void usb_audio_handle_data(USBDevice *dev, USBPacket *p) p->status =USB_RET_STALL ;if (s->debug) { -fprintf (stderr,"usb-audio: failed data transaction: " -"pid 0x%x ep 0x%x len 0x%zx\n" , +error_report ("usb-audio: failed data transaction: " +"pid 0x%x ep 0x%x len 0x%zx" , p->pid, p->ep->nr, p->iov.size); } }@@ -622,7 +623,7 @@ static void usb_audio_unrealize(USBDevice *dev, Error **errp)USBAudioState *s =USB_AUDIO (dev);if (s->debug) { -fprintf (stderr,"usb-audio: destroy\n" ); +error_report ("usb-audio: destroy" ); }usb_audio_set_output_altset (s,ALTSET_OFF );hw/usb/dev-bluetooth.c +2
-2@@ -274,13 +274,13 @@ static void usb_bt_fifo_enqueue(struct usb_hci_in_fifo_s *fifo,if (off <=DFIFO_LEN_MASK ) {if (off + len >DFIFO_LEN_MASK +1 && (fifo->dsize = off + len) > (DFIFO_LEN_MASK +1 ) *2 ) { -fprintf (stderr,"%s: can't alloc %i bytes\n" , __func__, len); +error_report ("%s: can't alloc %i bytes" , __func__, len);exit (-1 ); } buf = fifo->data + off; }else {if (fifo->dlen > fifo->dsize) { -fprintf (stderr,"%s: can't alloc %i bytes\n" , __func__, len); +error_report ("%s: can't alloc %i bytes" , __func__, len);exit (-1 ); } buf = fifo->data + off - fifo->dsize;hw/usb/dev-mtp.c +4
-3@@ -10,6 +10,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include <wchar.h> #include <dirent.h> @@ -546,7 +547,7 @@ static void inotify_watchfn(void *arg)break ;default : -fprintf (stderr,"usb-mtp: failed to parse inotify event\n" ); +error_report ("usb-mtp: failed to parse inotify event" );continue ; }@@ -617,7 +618,7 @@ static void usb_mtp_object_readdir(MTPState *s, MTPObject *o)#ifdef CONFIG_INOTIFY1 int watchfd =usb_mtp_add_watch (s->inotifyfd, o->path);if (watchfd ==-1 ) { -fprintf (stderr,"usb-mtp: failed to add watch for %s\n" , o->path); +error_report ("usb-mtp: failed to add watch for %s" , o->path); }else {trace_usb_mtp_inotify_event (s->dev.addr, o->path,0 ,"Watch Added" );@@ -1144,7 +1145,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *c)usb_mtp_object_alloc (s, s->next_handle++,NULL , s->root);#ifdef CONFIG_INOTIFY1 if (usb_mtp_inotify_init (s)) { -fprintf (stderr,"usb-mtp: file monitoring init failed\n" ); +error_report ("usb-mtp: file monitoring init failed" ); }#endif break ;
hw/usb/dev-mtp.c static void usb_mtp_handle_control(USBDevice *dev, USBPacket *p, · line 1352
Quoted 5 lines
hw/usb/dev-mtp.c +1
-1@@ -1348,7 +1349,7 @@ static void usb_mtp_handle_control(USBDevice *dev, USBPacket *p,static void usb_mtp_cancel_packet (USBDevice *dev,USBPacket *p) {/* we don't use async packets, so this should never be called */ -fprintf (stderr,"%s\n" , __func__); +error_report ("%s" , __func__);
what about using tracepoint instead? this report is probably confusing instead of being useful for the user imho.
Quoted 17 lines
hw/usb/dev-mtp.c +0
-0}static void usb_mtp_handle_data (USBDevice *dev,USBPacket *p)hw/usb/dev-network.c +1
-1@@ -815,7 +815,7 @@ static int ndis_query(USBNetState *s, uint32_t oid,return sizeof (le32);default : -fprintf (stderr,"usbnet: unknown OID 0x%08x\n" , oid); +error_report ("usbnet: unknown OID 0x%08x" , oid);return 0 ; }return -1 ;
hw/usb/dev-network.c static void usb_net_handle_control(USBDevice *dev, USBPacket *p, · line 1089
Quoted 8 lines
hw/usb/dev-network.c +2
-2@@ -1084,9 +1084,9 @@ static void usb_net_handle_control(USBDevice *dev, USBPacket *p,for (i =0 ; i < length; i++) {if (!(i &15 ))fprintf (stderr,"\n%04x:" , i); -fprintf (stderr," %02x" , data[i]); +error_report (" %02x" , data[i]); } -fprintf (stderr,"\n\n" ); +fprintf (stderr,"\n" );
eh?
hw/usb/dev-network.c static void usb_net_handle_control(USBDevice *dev, USBPacket *p, · line 1116
Quoted 12 lines
hw/usb/dev-network.c +2
-2}#endif ret =rndis_parse (s, data, length);@@ -1111,17 +1111,17 @@ static void usb_net_handle_control(USBDevice *dev, USBPacket *p,for (i =0 ; i < p->actual_length; i++) {if (!(i &15 ))fprintf (stderr,"\n%04x:" , i); -fprintf (stderr," %02x" , data[i]); +error_report (" %02x" , data[i]); } -fprintf (stderr,"\n\n" ); +fprintf (stderr,"\n" );
eh?
Quoted 210 lines
hw/usb/dev-network.c +5
-5}#endif break ;default : fail: -fprintf (stderr,"usbnet: failed control transaction: " -"request 0x%x value 0x%x index 0x%x length 0x%x\n" , +error_report ("usbnet: failed control transaction: " +"request 0x%x value 0x%x index 0x%x length 0x%x" , request, value, index, length); p->status =USB_RET_STALL ;break ;@@ -1190,7 +1190,7 @@ static void usb_net_handle_dataout(USBNetState *s, USBPacket *p)uint32_t len;#ifdef TRAFFIC_DEBUG -fprintf (stderr,"usbnet: data out len %zu\n" , p->iov.size); +error_report ("usbnet: data out len %zu" , p->iov.size);iov_hexdump (p->iov.iov, p->iov.niov, stderr,"usbnet" , p->iov.size);#endif @@ -1260,8 +1260,8 @@ static void usb_net_handle_data(USBDevice *dev, USBPacket *p) }if (p->status ==USB_RET_STALL ) { -fprintf (stderr,"usbnet: failed data transaction: " -"pid 0x%x ep 0x%x len 0x%zx\n" , +error_report ("usbnet: failed data transaction: " +"pid 0x%x ep 0x%x len 0x%zx" , p->pid, p->ep->nr, p->iov.size); } }hw/usb/hcd-ehci.c +16
-16@@ -419,7 +419,7 @@ static int ehci_get_pid(EHCIqtd *qtd)case 2 :return USB_TOKEN_SETUP ;default : -fprintf (stderr,"bad token\n" ); +error_report ("bad token" );return 0 ; } }@@ -1033,7 +1033,7 @@ static void ehci_opreg_write(void *ptr, hwaddr addr,/* not supporting dynamic frame list size at the moment */ if ((val &USBCMD_FLS ) && !(s->usbcmd &USBCMD_FLS )) { -fprintf (stderr,"attempt to set frame list size -- value %d\n" , +error_report ("attempt to set frame list size -- value %d" , (int )val &USBCMD_FLS ); val &= ~USBCMD_FLS ; }@@ -1190,7 +1190,7 @@ static int ehci_init_transfer(EHCIPacket *p)while (bytes >0 ) {if (cpage >4 ) { -fprintf (stderr,"cpage out of range (%d)\n" , cpage); +error_report ("cpage out of range (%d)" , cpage);qemu_sglist_destroy (&p->sgl);return -1 ; }@@ -1296,7 +1296,7 @@ static void ehci_execute_complete(EHCIQueue *q)break ;default :/* should not be triggerable */ -fprintf (stderr,"USB invalid response %d\n" , p->packet.status); +error_report ("USB invalid response %d" , p->packet.status);g_assert_not_reached ();break ; }@@ -1345,7 +1345,7 @@ static int ehci_execute(EHCIPacket *p, const char *action) p->async == EHCI_ASYNC_INITIALIZED);if (!(p->qtd.token &QTD_TOKEN_ACTIVE )) { -fprintf (stderr,"Attempting to execute inactive qtd\n" ); +error_report ("Attempting to execute inactive qtd" );return -1 ; }@@ -1383,7 +1383,7 @@ static int ehci_execute(EHCIPacket *p, const char *action) p->packet.actual_length);if (p->packet.actual_length >BUFF_SIZE ) { -fprintf (stderr,"ret from usb_handle_packet > BUFF_SIZE\n" ); +error_report ("ret from usb_handle_packet > BUFF_SIZE" );return -1 ; }@@ -1461,7 +1461,7 @@ static int ehci_process_itd(EHCIState *ehci,case USB_RET_SUCCESS :break ;default : -fprintf (stderr,"Unexpected iso usb result: %d\n" , +error_report ("Unexpected iso usb result: %d" , ehci->ipacket.status);/* Fall through */ case USB_RET_IOERROR :@@ -1564,7 +1564,7 @@ static int ehci_state_fetchentry(EHCIState *ehci, int async)/* section 4.8, only QH in async schedule */ if (async && (NLPTR_TYPE_GET (entry) !=NLPTR_TYPE_QH )) { -fprintf (stderr,"non queue head request in async schedule\n" ); +error_report ("non queue head request in async schedule" );return -1 ; }@@ -1586,8 +1586,8 @@ static int ehci_state_fetchentry(EHCIState *ehci, int async)default :/* TODO: handle FSTN type */ -fprintf (stderr,"FETCHENTRY: entry at %X is of type %d " -"which is not supported yet\n" , entry,NLPTR_TYPE_GET (entry)); +error_report ("FETCHENTRY: entry at %X is of type %d " +"which is not supported yet" , entry,NLPTR_TYPE_GET (entry));return -1 ; }@@ -2086,7 +2086,7 @@ static void ehci_advance_state(EHCIState *ehci, int async)break ;default : -fprintf (stderr,"Bad state!\n" ); +error_report ("Bad state!" ); again =-1 ;g_assert_not_reached ();break ;@@ -2094,7 +2094,7 @@ static void ehci_advance_state(EHCIState *ehci, int async)if (again <0 || itd_count >16 ) {/* TODO: notify guest (raise HSE irq?) */ -fprintf (stderr,"processing error - resetting ehci HC\n" ); +error_report ("processing error - resetting ehci HC" );ehci_reset (ehci); again =0 ; }@@ -2151,8 +2151,8 @@ static void ehci_advance_async_state(EHCIState *ehci)default :/* this should only be due to a developer mistake */ -fprintf (stderr,"ehci: Bad asynchronous state %d. " -"Resetting to active\n" , ehci->astate); +error_report ("ehci: Bad asynchronous state %d. " +"Resetting to active" , ehci->astate);g_assert_not_reached (); } }@@ -2201,8 +2201,8 @@ static void ehci_advance_periodic_state(EHCIState *ehci)default :/* this should only be due to a developer mistake */ -fprintf (stderr,"ehci: Bad periodic state %d. " -"Resetting to active\n" , ehci->pstate); +error_report ("ehci: Bad periodic state %d. " +"Resetting to active" , ehci->pstate);g_assert_not_reached (); } }hw/usb/hcd-musb.c +2
-2@@ -253,8 +253,8 @@/* #define MUSB_DEBUG */ #ifdef MUSB_DEBUG -#define TRACE (fmt, ...) fprintf(stderr, "%s@%d: " fmt "\n", __func__, \ - __LINE__, ##__VA_ARGS__) +#define TRACE (fmt, ...) error_report("%s@%d: " fmt "", __func__, \ + __LINE__, ##__VA_ARGS__)#else #define TRACE (...)#endif hw/usb/hcd-xhci.c +2
-1@@ -19,6 +19,7 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "qemu/timer.h" #include "qemu/queue.h" @@ -39,7 +40,7 @@#else #define DPRINTF (...) do {} while (0)#endif -#define FIXME (_msg) do { fprintf(stderr, "FIXME %s:%d %s\n", \ +#define FIXME (_msg) do { error_report("FIXME %s:%d %s", \ __func__, __LINE__, _msg); abort(); } while (0)#define TRB_LINK_LIMIT 32hw/usb/host-legacy.c +1
-1@@ -86,7 +86,7 @@ static int parse_filter(const char *spec, struct USBAutoFilter *f) }if (i <DEV ) { -fprintf (stderr,"husb: invalid auto filter spec %s\n" , spec); +error_report ("husb: invalid auto filter spec %s" , spec);return -1 ; }
Re: [Qemu-devel] [PATCH v2 39/47] hw/timer: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 3 lines
Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>
Quoted 100 lines
---
V2:
- Split hw patch into individual directorieshw/timer/omap_gptimer.c | 11 ++++++----- hw/timer/twl92230.c | 2 +- hw/timer/xilinx_timer.c | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-)hw/timer/omap_gptimer.c +6
-5@@ -18,6 +18,7 @@* with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "qemu/timer.h" #include "hw/arm/omap.h" @@ -356,7 +357,7 @@ static void omap_gp_timer_write(void *opaque, hwaddr addr,case 0x10 :/* TIOCP_CFG */ s->config = value &0x33d ;if (((value >>3 ) &3 ) ==3 )/* IDLEMODE */ -fprintf (stderr,"%s: illegal IDLEMODE value in TIOCP_CFG\n" , +error_report ("%s: illegal IDLEMODE value in TIOCP_CFG" , __func__);if (value &2 )/* SOFTRESET */ omap_gp_timer_reset (s);@@ -394,11 +395,11 @@ static void omap_gp_timer_write(void *opaque, hwaddr addr, s->ar = (value >>1 ) &1 ; s->st = (value >>0 ) &1 ;if (s->inout && s->trigger != gpt_trigger_none) -fprintf (stderr,"%s: GP timer pin must be an output " -"for this trigger mode\n" , __func__); +error_report ("%s: GP timer pin must be an output " +"for this trigger mode" , __func__);if (!s->inout && s->capture != gpt_capture_none) -fprintf (stderr,"%s: GP timer pin must be an input " -"for this capture mode\n" , __func__); +error_report ("%s: GP timer pin must be an input " +"for this capture mode" , __func__);if (s->trigger == gpt_trigger_none)omap_gp_timer_out (s, s->scpwm);/* TODO: make sure this doesn't overflow 32-bits */ hw/timer/twl92230.c +1
-1@@ -614,7 +614,7 @@ static void menelaus_write(void *opaque, uint8_t addr, uint8_t value)break ; rtc_badness:default : -fprintf (stderr,"%s: bad RTC_UPDATE value %02x\n" , +error_report ("%s: bad RTC_UPDATE value %02x" , __func__, value); s->status |=1 <<10 ;/* RTCERR */ menelaus_update (s);hw/timer/xilinx_timer.c +4
-4@@ -127,7 +127,7 @@ timer_read(void *opaque, hwaddr addr, unsigned int size)break ; } -D (fprintf (stderr,"%s timer=%d %x=%x\n" , __func__, timer, addr *4 , r)); +D (error_report ("%s timer=%d %x=%x" , __func__, timer, addr *4 , r));return r; }@@ -135,7 +135,7 @@ static void timer_enable(struct xlx_timer *xt) {uint64_t count; -D (fprintf (stderr,"%s timer=%d down=%d\n" , __func__, +D (error_report ("%s timer=%d down=%d" , __func__, xt->nr, xt->regs[R_TCSR ] &TCSR_UDT ));ptimer_stop (xt->ptimer);@@ -160,7 +160,7 @@ timer_write(void *opaque, hwaddr addr, addr >>=2 ; timer =timer_from_addr (addr); xt = &t->timers[timer]; -D (fprintf (stderr,"%s addr=%x val=%x (timer=%d off=%d)\n" , +D (error_report ("%s addr=%x val=%x (timer=%d off=%d)" , __func__, addr *4 , value, timer, addr &3 ));/* Further decoding to address a specific timers reg. */ addr &=3 ;@@ -197,7 +197,7 @@ static void timer_hit(void *opaque) {struct xlx_timer *xt = opaque;struct timerblock *t = xt->parent; -D (fprintf (stderr,"%s %d\n" , __func__, xt->nr)); +D (error_report ("%s %d" , __func__, xt->nr)); xt->regs[R_TCSR ] |=TCSR_TINT ;if (xt->regs[R_TCSR ] &TCSR_ARHT )
Re: [Qemu-devel] [PATCH v2 38/47] hw/ssi: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 3 lines
Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>
Quoted 32 lines
---
V2:
- Split hw patch into individual directorieshw/ssi/omap_spi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)hw/ssi/omap_spi.c +3
-2@@ -20,6 +20,7 @@* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/arm/omap.h" @@ -295,9 +296,9 @@ static void omap_mcspi_write(void *opaque, hwaddr addr,if ((value ^ s->ch[ch].config) & (3 <<14 ))/* DMAR | DMAW */ omap_mcspi_dmarequest_update (s->ch + ch);if (((value >>12 ) &3 ) ==3 )/* TRM */ -fprintf (stderr,"%s: invalid TRM value (3)\n" , __func__); +error_report ("%s: invalid TRM value (3)" , __func__);if (((value >>7 ) &0x1f ) <3 )/* WL */ -fprintf (stderr,"%s: invalid WL value (%" PRIx64")\n" , +error_report ("%s: invalid WL value (%" PRIx64")" , __func__, (value >>7 ) &0x1f ); s->ch[ch].config = value &0x7fffff ;break ;
Re: [Qemu-devel] [PATCH v2 35/47] hw/sd: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 102 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>---
V2:
- Split hw patch into individual directorieshw/sd/pl181.c | 5 +++-- hw/sd/sd.c | 14 +++++++------- 2 files changed, 10 insertions(+), 9 deletions(-)hw/sd/pl181.c +3
-2@@ -8,6 +8,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "hw/sysbus.h" @@ -146,7 +147,7 @@ static void pl181_fifo_push(PL181State *s, uint32_t value)int n;if (s->fifo_len ==PL181_FIFO_LEN ) { -fprintf (stderr,"pl181: FIFO overflow\n" ); +error_report ("pl181: FIFO overflow" );return ; } n = (s->fifo_pos + s->fifo_len) & (PL181_FIFO_LEN -1 );@@ -160,7 +161,7 @@ static uint32_t pl181_fifo_pop(PL181State *s)uint32_t value;if (s->fifo_len ==0 ) { -fprintf (stderr,"pl181: FIFO underflow\n" ); +error_report ("pl181: FIFO underflow" );return 0 ; } value = s->fifo[s->fifo_pos];hw/sd/sd.c +2
-2@@ -700,7 +700,7 @@ static void sd_lock_command(SDState *sd) sd->card_status &= ~CARD_IS_LOCKED ; sd->pwd_len =0 ;/* Erasing the entire card here! */ -fprintf (stderr,"SD: Card force-erased by CMD42\n" ); +error_report ("SD: Card force-erased by CMD42" );return ; }@@ -1282,7 +1282,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,return sd_r1;case 56 :/* CMD56: GEN_CMD */ -fprintf (stderr,"SD: GEN_CMD 0x%08x\n" , req.arg); +error_report ("SD: GEN_CMD 0x%08x" , req.arg);switch (sd->state) {case sd_transfer_state:
hw/sd/sd.c send_response: · line 1567
Quoted 3 lines
hw/sd/sd.c +0
-0@@ -1565,10 +1565,10 @@ send_response:int i;DPRINTF ("Response:" );for (i =0 ; i < rsplen; i++)
please while here:
{hw/sd/sd.c send_response: · line 1568
Quoted 2 lines
hw/sd/sd.c +1
-1-fprintf (stderr," %02x" , response[i]); +error_report (" %02x" , response[i]);
}
hw/sd/sd.c send_response: · line 1571
Quoted 5 lines
hw/sd/sd.c +2
-2-fprintf (stderr," state %d\n" , sd->state); +error_report (" state %d" , sd->state); }else { -DPRINTF ("No response %d\n" , sd->state); +DPRINTF ("No response %d" , sd->state);
hmm?
Quoted 21 lines
hw/sd/sd.c +2
-2}#endif @@ -1580,14 +1580,14 @@ static void sd_blk_read(SDState *sd, uint64_t addr, uint32_t len)DPRINTF ("sd_blk_read: addr = 0x%08llx, len = %d\n" , (unsigned long long ) addr, len);if (!sd->blk ||blk_pread (sd->blk, addr, sd->data, len) <0 ) { -fprintf (stderr,"sd_blk_read: read error on host side\n" ); +error_report ("sd_blk_read: read error on host side" ); } }static void sd_blk_write (SDState *sd,uint64_t addr,uint32_t len) {if (!sd->blk ||blk_pwrite (sd->blk, addr, sd->data, len,0 ) <0 ) { -fprintf (stderr,"sd_blk_write: write error on host side\n" ); +error_report ("sd_blk_write: write error on host side" ); } }
Re: [Qemu-devel] [PATCH v2 31/47] hw/pci*: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 80 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Cc Marcel Apfelbaum <[email protected]>---
V2:
- Split hw patch into individual directorieshw/pci-host/bonito.c | 6 +++--- hw/pci/pci.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-)hw/pci-host/bonito.c +3
-3@@ -38,7 +38,7 @@*/ #include "qemu/osdep.h" - +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/pci/pci.h" #include "hw/i386/pc.h" @@ -449,8 +449,8 @@ static uint32_t bonito_sbridge_pciaddr(void *opaque, hwaddr addr) regno = (cfgaddr &BONITO_PCICONF_REG_MASK ) >>BONITO_PCICONF_REG_OFFSET ;if (idsel ==0 ) { -fprintf (stderr,"error in bonito pci config address " TARGET_FMT_plx -",pcimap_cfg=%x\n" , addr, s->regs[BONITO_PCIMAP_CFG ]); +error_report ("error in bonito pci config address " TARGET_FMT_plx +",pcimap_cfg=%x" , addr, s->regs[BONITO_PCIMAP_CFG ]);exit (1 ); } pciaddr =PCI_ADDR (pci_bus_num (phb->bus), devno, funno, regno);hw/pci/pci.c +0
-0
hw/pci/pci.c static int get_pci_irq_state(QEMUFile *f, void *pv, size_t size, · line 518
Quoted 5 lines
hw/pci/pci.c +1
-1@@ -515,7 +515,7 @@ static int get_pci_irq_state(QEMUFile *f, void *pv, size_t size,for (i =0 ; i <PCI_NUM_PINS ; ++i) { irq_state[i] =qemu_get_be32 (f);if (irq_state[i] !=0x1 && irq_state[i] !=0 ) { - fprintf(stderr, "irq state %d: must be 0 or 1.\n", + error_report("irq state %d: must be 0 or 1.",
Maybe drop the trailing dot?
Anyway:
Quoted 33 lines
hw/pci/pci.c +4
-4irq_state[i]);return -EINVAL ; }@@ -678,7 +678,7 @@ static PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root,unsigned slot;if (!root) { -fprintf (stderr,"No primary PCI bus\n" ); +error_report ("No primary PCI bus" );return NULL ; }@@ -694,7 +694,7 @@ static PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, }if (dom !=0 ) { -fprintf (stderr,"No support for non-zero PCI domains\n" ); +error_report ("No support for non-zero PCI domains" );return NULL ; }@@ -1118,8 +1118,8 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,assert (region_num >=0 );assert (region_num <PCI_NUM_REGIONS );if (size & (size-1 )) { -fprintf (stderr,"ERROR: PCI region size must be pow2 " -"type=0x%x, size=0x%" FMT_PCIBUS "\n" , type, size); +error_report ("ERROR: PCI region size must be pow2 " +"type=0x%x, size=0x%" FMT_PCIBUS "" , type, size);exit (1 ); }
Re: [Qemu-devel] [PATCH v2 27/47] hw/net: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 72 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>Cc Alexander Graf <[email protected]>Cc Jason Wang <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>---
V2:
- Split hw patch into individual directorieshw/net/fsl_etsec/etsec.c | 2 +- hw/net/pcnet.c | 2 +- hw/net/smc91c111.c | 5 +++-- hw/net/vhost_net.c | 16 ++++++++-------- 4 files changed, 13 insertions(+), 12 deletions(-)hw/net/fsl_etsec/etsec.c +1
-1@@ -347,7 +347,7 @@ static ssize_t etsec_receive(NetClientState *nc,eTSEC *etsec =qemu_get_nic_opaque (nc);#if defined(HEX_DUMP ) -fprintf (stderr,"%s receive size:%zd\n" , nc->name, size); +error_report ("%s receive size:%zd" , nc->name, size);qemu_hexdump ((void *)buf, stderr,"" , size);#endif /* Flush is unnecessary as are already in receiving path */ hw/net/pcnet.c +0
-0
hw/net/pcnet.c ssize_t pcnet_receive(NetClientState *nc, const uint8_t *buf, size_t size_) · line 1073
Quoted 5 lines
hw/net/pcnet.c +1
-1@@ -1070,7 +1070,7 @@ ssize_t pcnet_receive(NetClientState *nc, const uint8_t *buf, size_t size_)if (!s->looptest) {if (size >4092 ) {#ifdef PCNET_DEBUG_RMD -fprintf (stderr,"pcnet: truncates rx packet.\n" ); +error_report ("pcnet: truncates rx packet." );
drop trailing dot to unify?
Quoted 90 lines
hw/net/pcnet.c +0
-0#endif size =4092 ; }hw/net/smc91c111.c +3
-2@@ -8,6 +8,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/sysbus.h" #include "net/net.h" #include "hw/devices.h" @@ -362,9 +363,9 @@ static void smc91c111_writeb(void *opaque, hwaddr offset,return ;case 12 :/* Control */ if (value &1 ) -fprintf (stderr,"smc91c111:EEPROM store not implemented\n" ); +error_report ("smc91c111:EEPROM store not implemented" );if (value &2 ) -fprintf (stderr,"smc91c111:EEPROM reload not implemented\n" ); +error_report ("smc91c111:EEPROM reload not implemented" ); value &= ~3 ;SET_LOW (ctr, value);return ;hw/net/vhost_net.c +8
-8@@ -135,7 +135,7 @@ static int vhost_net_get_fd(NetClientState *backend)case NET_CLIENT_DRIVER_TAP :return tap_get_fd (backend);default : -fprintf (stderr,"vhost-net requires tap backend\n" ); +error_report ("vhost-net requires tap backend" );return -EBADFD ; } }@@ -148,7 +148,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)uint64_t features =0 ;if (!options->net_backend) { -fprintf (stderr,"vhost-net requires net backend to be setup\n" ); +error_report ("vhost-net requires net backend to be setup" ); goto fail; } net->nc = options->net_backend;@@ -186,8 +186,8 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) net->dev.features &= ~(1ULL <<VIRTIO_NET_F_MRG_RXBUF ); }if (~net->dev.features & net->dev.backend_features) { -fprintf (stderr,"vhost lacks feature mask %" PRIu64 -" for backend\n" , +error_report ("vhost lacks feature mask %" PRIu64 +" for backend" , (uint64_t )(~net->dev.features & net->dev.backend_features)); goto fail; }@@ -197,8 +197,8 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)if (net->nc->info->type ==NET_CLIENT_DRIVER_VHOST_USER ) { features =vhost_user_get_acked_features (net->nc);if (~net->dev.features & features) { -fprintf (stderr,"vhost lacks feature mask %" PRIu64 -" for backend\n" , +error_report ("vhost lacks feature mask %" PRIu64 +" for backend" , (uint64_t )(~net->dev.features & features)); goto fail; }@@ -349,7 +349,7 @@ err_start: } e = k->set_guest_notifiers (qbus->parent, total_queues *2 , false);if (e <0 ) { -fprintf (stderr,"vhost guest notifier cleanup failed: %d\n" , e); +error_report ("vhost guest notifier cleanup failed: %d" , e);fflush (stderr); } err:@@ -370,7 +370,7 @@ void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs, r = k->set_guest_notifiers (qbus->parent, total_queues *2 , false);if (r <0 ) { -fprintf (stderr,"vhost guest notifier cleanup failed: %d\n" , r); +error_report ("vhost guest notifier cleanup failed: %d" , r);fflush (stderr); }assert (r >=0 );
Re: [Qemu-devel] [PATCH v2 26/47] hw/moxie: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 3 lines
Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>
Quoted 41 lines
Cc Anthony Green <[email protected]>---
V2:
- Split hw patch into individual directorieshw/moxie/moxiesim.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)hw/moxie/moxiesim.c +4
-3@@ -25,6 +25,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -61,7 +62,7 @@ static void load_kernel(MoxieCPU *cpu, LoaderParams *loader_params) 0, 0);if (kernel_size <=0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , loader_params->kernel_filename);exit (1 ); }@@ -85,8 +86,8 @@ static void load_kernel(MoxieCPU *cpu, LoaderParams *loader_params) ram_size); }if (initrd_size == (target_ulong)-1 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - loader_params->initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + loader_params->initrd_filename);exit (1 ); } }
Re: [Qemu-devel] [PATCH v2 25/47] hw/misc: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 3 lines
Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>
Quoted 154 lines
---
V2:
- Split hw patch into individual directorieshw/misc/a9scu.c | 3 ++- hw/misc/omap_gpmc.c | 11 ++++++----- hw/misc/omap_l4.c | 5 +++-- hw/misc/omap_sdrc.c | 3 ++- hw/misc/vmport.c | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-)hw/misc/a9scu.c +2
-1@@ -9,6 +9,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/misc/a9scu.h" static uint64_t a9_scu_read(void *opaque, hwaddr offset,@@ -59,7 +60,7 @@ static void a9_scu_write(void *opaque, hwaddr offset, mask =0xffffffff ;break ;default : -fprintf (stderr,"Invalid size %u in write to a9 scu register %x\n" , +error_report ("Invalid size %u in write to a9 scu register %x" , size, (unsigned )offset);return ; }hw/misc/omap_gpmc.c +6
-5@@ -19,6 +19,7 @@* with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/block/flash.h" #include "hw/arm/omap.h" @@ -408,7 +409,7 @@ static void omap_gpmc_cs_map(struct omap_gpmc_s *s, int cs)/* TODO: check for overlapping regions and report access errors */ if (mask !=0x8 && mask !=0xc && mask !=0xe && mask !=0xf && !(s->accept_256 && !mask)) { -fprintf (stderr,"%s: invalid chip-select mask address (0x%x)\n" , +error_report ("%s: invalid chip-select mask address (0x%x)" , __func__, mask); }@@ -642,7 +643,7 @@ static void omap_gpmc_write(void *opaque, hwaddr addr,case 0x010 :/* GPMC_SYSCONFIG */ if ((value >>3 ) ==0x3 ) -fprintf (stderr,"%s: bad SDRAM idle mode %" PRIi64"\n" , +error_report ("%s: bad SDRAM idle mode %" PRIi64"" , __func__, value >>3 );if (value &2 )omap_gpmc_reset (s);@@ -806,7 +807,7 @@ static void omap_gpmc_write(void *opaque, hwaddr addr,break ;case 0x230 :/* GPMC_TESTMODE_CTRL */ if (value &7 ) -fprintf (stderr,"%s: test mode enable attempt\n" , __func__); +error_report ("%s: test mode enable attempt" , __func__);break ;default :@@ -864,7 +865,7 @@ void omap_gpmc_attach(struct omap_gpmc_s *s, int cs, MemoryRegion *iomem)assert (iomem);if (cs <0 || cs >=8 ) { -fprintf (stderr,"%s: bad chip-select %i\n" , __func__, cs); +error_report ("%s: bad chip-select %i" , __func__, cs);exit (-1 ); } f = &s->cs_file[cs];@@ -881,7 +882,7 @@ void omap_gpmc_attach_nand(struct omap_gpmc_s *s, int cs, DeviceState *nand)assert (nand);if (cs <0 || cs >=8 ) { -fprintf (stderr,"%s: bad chip-select %i\n" , __func__, cs); +error_report ("%s: bad chip-select %i" , __func__, cs);exit (-1 ); } f = &s->cs_file[cs];hw/misc/omap_l4.c +3
-2@@ -18,6 +18,7 @@* with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/arm/omap.h" @@ -126,7 +127,7 @@ struct omap_target_agent_s *omap_l4ta_get(struct omap_l4_s *bus,break ; }if (!ta) { -fprintf (stderr,"%s: bad target agent (%i)\n" , __func__, cs); +error_report ("%s: bad target agent (%i)" , __func__, cs);exit (-1 ); }@@ -151,7 +152,7 @@ hwaddr omap_l4_attach(struct omap_target_agent_s *ta,hwaddr base;if (region <0 || region >= ta->regions) { -fprintf (stderr,"%s: bad io region (%i)\n" , __func__, region); +error_report ("%s: bad io region (%i)" , __func__, region);exit (-1 ); }hw/misc/omap_sdrc.c +2
-1@@ -18,6 +18,7 @@* with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/arm/omap.h" @@ -108,7 +109,7 @@ static void omap_sdrc_write(void *opaque, hwaddr addr,case 0x10 :/* SDRC_SYSCONFIG */ if ((value >>3 ) !=0x2 ) -fprintf (stderr,"%s: bad SDRAM idle mode %i\n" , +error_report ("%s: bad SDRAM idle mode %i" , __func__, (unsigned )value >>3 );if (value &2 )omap_sdrc_reset (s);hw/misc/vmport.c +1
-1@@ -80,7 +80,7 @@ static uint64_t vmport_ioport_read(void *opaque, hwaddr addr,if (!s->func[command]) {#ifdef VMPORT_DEBUG -fprintf (stderr,"vmport: unknown command %x\n" , command); +error_report ("vmport: unknown command %x" , command);#endif return eax; }
Re: [Qemu-devel] [PATCH v2 21/47] hw/lm32: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 3 lines
Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>
Quoted 70 lines
Cc Michael Walle <[email protected]>---
V2:
- Split hw patch into individual directorieshw/lm32/lm32_boards.c | 5 +++-- hw/lm32/milkymist.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)hw/lm32/lm32_boards.c +3
-2@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "cpu.h" #include "hw/sysbus.h" @@ -152,7 +153,7 @@ static void lm32_evr_init(MachineState *machine) }if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }@@ -250,7 +251,7 @@ static void lm32_uclinux_init(MachineState *machine) }if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }hw/lm32/milkymist.c +3
-2@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "cpu.h" #include "hw/sysbus.h" @@ -149,7 +150,7 @@ milkymist_init(MachineState *machine)/* if no kernel is given no valid bios rom is a fatal error */ if (!kernel_filename && !dinfo && !bios_filename && !qtest_enabled ()) { -fprintf (stderr,"qemu: could not load Milkymist One bios '%s'\n" , +error_report ("qemu: could not load Milkymist One bios '%s'" , bios_name);exit (1 ); }@@ -188,7 +189,7 @@ milkymist_init(MachineState *machine) }if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }
Re: [Qemu-devel] [PATCH v2 20/47] hw/isa: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 49 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 3 lines
Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>
Quoted 39 lines
---
V2:
- Split hw patch into individual directorieshw/isa/isa-bus.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)hw/isa/isa-bus.c +4
-3@@ -17,6 +17,7 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "hw/hw.h" #include "monitor/monitor.h" @@ -186,15 +187,15 @@ ISADevice *isa_vga_init(ISABus *bus)case VGA_CIRRUS :return isa_create_simple (bus,"isa-cirrus-vga" );case VGA_QXL : -fprintf (stderr,"%s: qxl: no PCI bus\n" , __func__); +error_report ("%s: qxl: no PCI bus" , __func__);return NULL ;case VGA_STD :return isa_create_simple (bus,"isa-vga" );case VGA_VMWARE : -fprintf (stderr,"%s: vmware_vga: no PCI bus\n" , __func__); +error_report ("%s: vmware_vga: no PCI bus" , __func__);return NULL ;case VGA_VIRTIO : -fprintf (stderr,"%s: virtio-vga: no PCI bus\n" , __func__); +error_report ("%s: virtio-vga: no PCI bus" , __func__);return NULL ;case VGA_NONE :default :
Re: [Qemu-devel] [PATCH v2 19/47] hw/ipmi: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 54 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>---
V2:
- Split hw patch into individual directorieshw/ipmi/ipmi.c | 1 + hw/ipmi/ipmi_bmc_extern.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)hw/ipmi/ipmi.c +0
-0
hw/ipmi/ipmi.c line 26
Quoted 4 lines
hw/ipmi/ipmi.c +1
-0@@ -23,6 +23,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h"
Why?
Quoted 16 lines
hw/ipmi/ipmi.c +0
-0#include "hw/hw.h" #include "hw/ipmi/ipmi.h" #include "sysemu/sysemu.h" hw/ipmi/ipmi_bmc_extern.c +1
-0@@ -28,6 +28,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu/timer.h" #include "chardev/char-fe.h"
hw/ipmi/ipmi_bmc_extern.c static void ipmi_bmc_extern_handle_command(IPMIBmc *b, · line 202
Quoted 10 lines
hw/ipmi/ipmi_bmc_extern.c +2
-2@@ -194,8 +195,8 @@ static void ipmi_bmc_extern_handle_command(IPMIBmc *b,if (ibe->outlen) {/* We already have a command queued. Shouldn't ever happen. */ -fprintf (stderr,"IPMI KCS: Got command when not finished with the" -" previous command\n" ); +error_report ("IPMI KCS: Got command when not finished with the" +" previous command" );abort (); }
For ipmi_bmc_extern.c:
Re: [Qemu-devel] [PATCH v2 14/47] hw/i2c: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 53 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>---
V2:
- Split hw patch into individual directorieshw/i2c/omap_i2c.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)hw/i2c/omap_i2c.c +0
-0
hw/i2c/omap_i2c.c static void omap_i2c_write(void *opaque, hwaddr addr, · line 344
Quoted 7 lines
hw/i2c/omap_i2c.c +2
-2@@ -340,13 +340,13 @@ static void omap_i2c_write(void *opaque, hwaddr addr,break ; }if ((value & (1 <<15 )) && !(value & (1 <<10 ))) {/* MST */ -fprintf (stderr,"%s: I^2C slave mode not supported\n" , - __func__); +error_report ("%s: I^2C slave mode not supported" , + __func__);
Can you change by "i2c slave ..." instead?
Quoted 20 lines
hw/i2c/omap_i2c.c +3
-3break ; }if ((value & (1 <<15 )) && value & (1 <<8 )) {/* XA */ -fprintf (stderr,"%s: 10-bit addressing mode not supported\n" , - __func__); +error_report ("%s: 10-bit addressing mode not supported" , + __func__);break ; }if ((value & (1 <<15 )) && value & (1 <<0 )) {/* STT */ @@ -393,7 +393,7 @@ static void omap_i2c_write(void *opaque, hwaddr addr,omap_i2c_interrupts_update (s); }if (value & (1 <<15 ))/* ST_EN */ -fprintf (stderr,"%s: System Test not supported\n" , __func__); +error_report ("%s: System Test not supported" , __func__);break ;default :
Re: [Qemu-devel] [PATCH v2 12/47] hw/dma: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 142 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>---
V2:
- Split hw patch into individual directorieshw/dma/omap_dma.c | 26 ++++++++++++++------------ hw/dma/soc_dma.c | 37 +++++++++++++++++++------------------ 2 files changed, 33 insertions(+), 30 deletions(-)hw/dma/omap_dma.c +14
-12@@ -18,6 +18,7 @@* with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "qemu/timer.h" #include "hw/arm/omap.h" @@ -1898,13 +1899,13 @@ static void omap_dma4_write(void *opaque, hwaddr addr,omap_dma_reset (s->dma); s->ocp = value &0x3321 ;if (((s->ocp >>12 ) &3 ) ==3 )/* MIDLEMODE */ -fprintf (stderr,"%s: invalid DMA power mode\n" , __func__); +error_report ("%s: invalid DMA power mode" , __func__);return ;case 0x78 :/* DMA4_GCR */ s->gcr = value &0x00ff00ff ;if ((value &0xff ) ==0x00 )/* MAX_CHANNEL_FIFO_DEPTH */ -fprintf (stderr,"%s: wrong FIFO depth in GCR\n" , __func__); +error_report ("%s: wrong FIFO depth in GCR" , __func__);return ; case 0x80 ... 0xfff:@@ -1934,8 +1935,8 @@ static void omap_dma4_write(void *opaque, hwaddr addr, ch->buf_disable = (value >>25 ) &1 ; ch->src_sync = (value >>24 ) &1 ;/* XXX For CamDMA must be 1 */ if (ch->buf_disable && !ch->src_sync) -fprintf (stderr,"%s: Buffering disable is not allowed in " -"destination synchronised mode\n" , __func__); +error_report ("%s: Buffering disable is not allowed in " +"destination synchronised mode" , __func__); ch->prefetch = (value >>23 ) &1 ; ch->bs = (value >>18 ) &1 ; ch->transparent_copy = (value >>17 ) &1 ;@@ -1946,8 +1947,8 @@ static void omap_dma4_write(void *opaque, hwaddr addr, ch->priority = (value &0x0040 ) >>6 ; ch->fs = (value &0x0020 ) >>5 ;if (ch->fs && ch->bs && ch->mode[0 ] && ch->mode[1 ]) -fprintf (stderr,"%s: For a packet transfer at least one port " -"must be constant-addressed\n" , __func__); +error_report ("%s: For a packet transfer at least one port " +"must be constant-addressed" , __func__); ch->sync = (value &0x001f ) | ((value >>14 ) &0x0060 );/* XXX must be 0x01 for CamDMA */ @@ -1977,8 +1978,8 @@ static void omap_dma4_write(void *opaque, hwaddr addr, ch->endian[1 ] =(value >>19 ) &1 ; ch->endian_lock[1 ] =(value >>18 ) &1 ;if (ch->endian[0 ] != ch->endian[1 ]) -fprintf (stderr,"%s: DMA endianness conversion enable attempt\n" , - __func__); +error_report ("%s: DMA endianness conversion enable attempt" , + __func__); ch->write_mode = (value >>16 ) &3 ; ch->burst[1 ] = (value &0xc000 ) >>14 ; ch->pack[1 ] = (value &0x2000 ) >>13 ;@@ -1986,12 +1987,13 @@ static void omap_dma4_write(void *opaque, hwaddr addr, ch->burst[0 ] = (value &0x0180 ) >>7 ; ch->pack[0 ] = (value &0x0040 ) >>6 ; ch->translate[0 ] = (value &0x003c ) >>2 ; -if (ch->translate[0 ] | ch->translate[1 ]) -fprintf (stderr,"%s: bad MReqAddressTranslate sideband signal\n" , - __func__); +if (ch->translate[0 ] | ch->translate[1 ]) { +error_report ("%s: bad MReqAddressTranslate sideband signal" , + __func__); + } ch->data_type =1 << (value &3 );if ((value &3 ) ==3 ) { -printf ("%s: bad data_type for DMA channel\n" , __func__); +error_report ("%s: bad data_type for DMA channel" , __func__); ch->data_type >>=1 ; }break ;hw/dma/soc_dma.c +1
-0@@ -18,6 +18,7 @@* with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "qemu/timer.h" #include "hw/arm/soc_dma.h" @@ -270,11 +271,11 @@ void soc_dma_port_add_fifo(struct soc_dma_s *soc, hwaddr virt_base,if (entry->type == soc_dma_port_mem) {
hw/dma/soc_dma.c void soc_dma_port_add_fifo(struct soc_dma_s *soc, hwaddr virt_base, · line 276
Quoted 10 lines
hw/dma/soc_dma.c +3
-5if (entry->addr <= virt_base && entry->addr + entry->u.mem.size > virt_base) { -fprintf (stderr,"%s: FIFO at %" PRIx64 -" collides with RAM region at %" PRIx64 -"-%" PRIx64"\n" , __func__, - virt_base, entry->addr, - (entry->addr + entry->u.mem.size)); + error_report("%s: FIFO at %"PRIx64 + " collides with RAM region at %"PRIx64 + "-%"PRIx64 "", __func__,
Can you remove the ""?
Quoted 6 lines
hw/dma/soc_dma.c +2
-0+ virt_base, entry->addr, + (entry->addr + entry->u.mem.size));exit (-1 ); }
hw/dma/soc_dma.c void soc_dma_port_add_fifo(struct soc_dma_s *soc, hwaddr virt_base, · line 289
Quoted 8 lines
hw/dma/soc_dma.c +2
-3@@ -284,9 +285,9 @@ void soc_dma_port_add_fifo(struct soc_dma_s *soc, hwaddr virt_base,while (entry < dma->memmap + dma->memmap_size && entry->addr <= virt_base) {if (entry->addr == virt_base && entry->u.fifo.out == out) { -fprintf (stderr,"%s: FIFO at %" PRIx64 -" collides FIFO at %" PRIx64"\n" , - __func__, virt_base, entry->addr); + error_report("%s: FIFO at %"PRIx64 + " collides FIFO at %"PRIx64 "",
Same here
Quoted 6 lines
hw/dma/soc_dma.c +1
-0+ __func__, virt_base, entry->addr);exit (-1 ); }@@ -321,11 +322,11 @@ void soc_dma_port_add_mem(struct soc_dma_s *soc, uint8_t *phys_base, if ((entry->addr >= virt_base && entry->addr < virt_base + size) ||
hw/dma/soc_dma.c void soc_dma_port_add_mem(struct soc_dma_s *soc, uint8_t *phys_base, · line 327
Quoted 10 lines
hw/dma/soc_dma.c +3
-5(entry->addr <= virt_base && entry->addr + entry->u.mem.size > virt_base)) { -fprintf (stderr,"%s: RAM at %" PRIx64"-%" PRIx64 -" collides with RAM region at %" PRIx64 -"-%" PRIx64"\n" , __func__, - virt_base, virt_base + size, - entry->addr, entry->addr + entry->u.mem.size); + error_report("%s: RAM at %"PRIx64 "-%"PRIx64 + " collides with RAM region at %"PRIx64 + "-%"PRIx64 "", __func__,
Again
Quoted 7 lines
hw/dma/soc_dma.c +2
-0+ virt_base, virt_base + size, + entry->addr, entry->addr + entry->u.mem.size);exit (-1 ); }@@ -334,11 +335,11 @@ void soc_dma_port_add_mem(struct soc_dma_s *soc, uint8_t *phys_base, }else {
hw/dma/soc_dma.c void soc_dma_port_add_mem(struct soc_dma_s *soc, uint8_t *phys_base, · line 340
Quoted 10 lines
hw/dma/soc_dma.c +3
-5if (entry->addr >= virt_base && entry->addr < virt_base + size) { -fprintf (stderr,"%s: RAM at %" PRIx64"-%" PRIx64 -" collides with FIFO at %" PRIx64 -"\n" , __func__, - virt_base, virt_base + size, - entry->addr); + error_report("%s: RAM at %"PRIx64 "-%"PRIx64 + " collides with FIFO at %"PRIx64 + "", __func__,
Again
Quoted 6 lines
hw/dma/soc_dma.c +2
-0+ virt_base, virt_base + size, + entry->addr);exit (-1 ); }
Re: [Qemu-devel] [PATCH v2 09/47] hw/core: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 3 lines
Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>
Quoted 168 lines
Cc "Michael S. Tsirkin" <[email protected]>Cc Paolo Bonzini <[email protected]>---
V2:
- Split hw patch into individual directorieshw/core/loader.c | 31 ++++++++++++++++--------------- hw/core/ptimer.c | 7 ++++--- 2 files changed, 20 insertions(+), 18 deletions(-)hw/core/loader.c +16
-15@@ -43,6 +43,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "hw/hw.h" #include "disas/disas.h" @@ -82,7 +83,7 @@ int load_image(const char *filename, uint8_t *addr)return -1 ; size =lseek (fd,0 ,SEEK_END );if (size ==-1 ) { -fprintf (stderr,"file %-20s: get size error: %s\n" , +error_report ("file %-20s: get size error: %s" , filename,strerror (errno));close (fd);return -1 ;@@ -623,7 +624,7 @@ static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr, goto out;if (hdr->ih_type != image_type) { -fprintf (stderr,"Wrong image type %d, expected %d\n" , hdr->ih_type, +error_report ("Wrong image type %d, expected %d" , hdr->ih_type, image_type); goto out; }@@ -670,14 +671,14 @@ static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr, address = *loadaddr;break ;default : -fprintf (stderr,"Unsupported u-boot image type %d\n" , hdr->ih_type); +error_report ("Unsupported u-boot image type %d" , hdr->ih_type); goto out; } data =g_malloc (hdr->ih_size);if (read (fd, data, hdr->ih_size) != hdr->ih_size) { -fprintf (stderr,"Error reading file\n" ); +error_report ("Error reading file" ); goto out; }@@ -693,7 +694,7 @@ static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr, bytes =gunzip (data, max_bytes, compressed_data, hdr->ih_size);g_free (compressed_data);if (bytes <0 ) { -fprintf (stderr,"Unable to decompress gzipped image!\n" ); +error_report ("Unable to decompress gzipped image!" ); goto out; } hdr->ih_size = bytes;@@ -763,7 +764,7 @@ int load_image_gzipped_buffer(const char *filename, uint64_t max_sz, data =g_malloc (max_sz); bytes =gunzip (data, max_sz, compressed_data, len);if (bytes <0 ) { -fprintf (stderr,"%s: unable to decompress gzipped kernel file\n" , +error_report ("%s: unable to decompress gzipped kernel file" , filename); goto out; }@@ -893,8 +894,8 @@ int rom_add_file(const char *file, const char *fw_dir,char devpath[100 ];if (as && mr) { -fprintf (stderr,"Specifying an Address Space and Memory Region is " \ -"not valid when loading a rom\n" ); +error_report ("Specifying an Address Space and Memory Region is " \ +"not valid when loading a rom" );/* We haven't allocated anything so we don't need any cleanup */ return -1 ; }@@ -909,7 +910,7 @@ int rom_add_file(const char *file, const char *fw_dir, fd =open (rom->path,O_RDONLY |O_BINARY );if (fd ==-1 ) { -fprintf (stderr,"Could not open option rom '%s': %s\n" , +error_report ("Could not open option rom '%s': %s" , rom->path,strerror (errno)); goto err; }@@ -921,7 +922,7 @@ int rom_add_file(const char *file, const char *fw_dir, rom->addr = addr; rom->romsize =lseek (fd,0 ,SEEK_END );if (rom->romsize ==-1 ) { -fprintf (stderr,"rom: file %-20s: get size error: %s\n" , +error_report ("rom: file %-20s: get size error: %s" , rom->name,strerror (errno)); goto err; }@@ -931,7 +932,7 @@ int rom_add_file(const char *file, const char *fw_dir,lseek (fd,0 ,SEEK_SET ); rc =read (fd, rom->data, rom->datasize);if (rc != rom->datasize) { -fprintf (stderr,"rom: file %-20s: read error: rc=%d (expected %zd)\n" , +error_report ("rom: file %-20s: read error: rc=%d (expected %zd)" , rom->name, rc, rom->datasize); goto err; }@@ -1105,10 +1106,10 @@ int rom_check_and_register_reset(void)continue ; }if ((addr > rom->addr) && (as == rom->as)) { -fprintf (stderr,"rom: requested regions overlap " -"(rom %s. free=0x" TARGET_FMT_plx -", addr=0x" TARGET_FMT_plx")\n" , - rom->name, addr, rom->addr); +error_report ("rom: requested regions overlap " +"(rom %s. free=0x" TARGET_FMT_plx +", addr=0x" TARGET_FMT_plx")" , + rom->name, addr, rom->addr);return -1 ; } addr = rom->addr;hw/core/ptimer.c +4
-3@@ -6,6 +6,7 @@* This code is licensed under the GNU LGPL. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "qemu/timer.h" #include "hw/ptimer.h" @@ -56,7 +57,7 @@ static void ptimer_reload(ptimer_state *s, int delta_adjust)if (s->period ==0 ) {if (!qtest_enabled ()) { -fprintf (stderr,"Timer with period zero, disabling\n" ); +error_report ("Timer with period zero, disabling" ); }timer_del (s->timer); s->enabled =0 ;@@ -89,7 +90,7 @@ static void ptimer_reload(ptimer_state *s, int delta_adjust)if (delta ==0 ) {if (!qtest_enabled ()) { -fprintf (stderr,"Timer with delta zero, disabling\n" ); +error_report ("Timer with delta zero, disabling" ); }timer_del (s->timer); s->enabled =0 ;@@ -263,7 +264,7 @@ void ptimer_run(ptimer_state *s, int oneshot)if (was_disabled && s->period ==0 ) {if (!qtest_enabled ()) { -fprintf (stderr,"Timer with period zero, disabling\n" ); +error_report ("Timer with period zero, disabling" ); }return ; }
Re: [Qemu-devel] [PATCH v2 31/47] hw/pci*: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisHi,
Quoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 2 lines
Some lines where then manually tweaked to pass checkpatch.
We are using coccinelle with great results until now and we save the scripts in scripts/coccinelle so we can run them later/improve them.
For your task it should be a really easy script, but since your work is already done maybe is not worth it. Anyway, here is the equivalent coccinelle script:
@
expression list ARGS;
@@
- fprintf(stderr, ARGS);
+ error_report(ARGS);
To run:
Install coccinelle: dnf install coccinelle
Save the above as: <qemu_dir>/scripts/coccinelle/remove_fprintf.cocci
Run it to see the diff:
spatch --sp-file <qemu_dir>scripts/coccinelle/remove_fprintf.cocci --dir <qemu_dir> --include-headers
Thanks,
Marcel
Quoted 78 lines
Signed-off-by Alistair Francis <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Cc Marcel Apfelbaum <[email protected]>---
V2:
- Split hw patch into individual directorieshw/pci-host/bonito.c | 6 +++--- hw/pci/pci.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-)hw/pci-host/bonito.c +3
-3@@ -38,7 +38,7 @@*/ #include "qemu/osdep.h" - +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/pci/pci.h" #include "hw/i386/pc.h" @@ -449,8 +449,8 @@ static uint32_t bonito_sbridge_pciaddr(void *opaque, hwaddr addr) regno = (cfgaddr &BONITO_PCICONF_REG_MASK ) >>BONITO_PCICONF_REG_OFFSET ;if (idsel ==0 ) { -fprintf (stderr,"error in bonito pci config address " TARGET_FMT_plx -",pcimap_cfg=%x\n" , addr, s->regs[BONITO_PCIMAP_CFG ]); +error_report ("error in bonito pci config address " TARGET_FMT_plx +",pcimap_cfg=%x" , addr, s->regs[BONITO_PCIMAP_CFG ]);exit (1 ); } pciaddr =PCI_ADDR (pci_bus_num (phb->bus), devno, funno, regno);hw/pci/pci.c +5
-5@@ -515,7 +515,7 @@ static int get_pci_irq_state(QEMUFile *f, void *pv, size_t size,for (i =0 ; i <PCI_NUM_PINS ; ++i) { irq_state[i] =qemu_get_be32 (f);if (irq_state[i] !=0x1 && irq_state[i] !=0 ) { -fprintf (stderr,"irq state %d: must be 0 or 1.\n" , +error_report ("irq state %d: must be 0 or 1." , irq_state[i]);return -EINVAL ; }@@ -678,7 +678,7 @@ static PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root,unsigned slot;if (!root) { -fprintf (stderr,"No primary PCI bus\n" ); +error_report ("No primary PCI bus" );return NULL ; }@@ -694,7 +694,7 @@ static PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, }if (dom !=0 ) { -fprintf (stderr,"No support for non-zero PCI domains\n" ); +error_report ("No support for non-zero PCI domains" );return NULL ; }@@ -1118,8 +1118,8 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,assert (region_num >=0 );assert (region_num <PCI_NUM_REGIONS );if (size & (size-1 )) { -fprintf (stderr,"ERROR: PCI region size must be pow2 " -"type=0x%x, size=0x%" FMT_PCIBUS "\n" , type, size); +error_report ("ERROR: PCI region size must be pow2 " +"type=0x%x, size=0x%" FMT_PCIBUS "" , type, size);exit (1 ); }
Re: [Qemu-devel] [PATCH v2 07/47] hw/bt: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 3 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
[...]
Quoted 15 lines
hw/bt/core.c +1
-0@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "sysemu/bt.h" #include "hw/bt.h" @@ -31,24 +32,24 @@ static void bt_dummy_lmp_mode_change(struct bt_link_s *link)static void bt_dummy_lmp_connection_complete (struct bt_link_s *link) {
hw/bt/core.c static void bt_dummy_lmp_mode_change(struct bt_link_s *link) · line 39
Quoted 10 lines
hw/bt/core.c +4
-4if (link->slave->reject_reason) -fprintf (stderr,"%s: stray LMP_not_accepted received, fixme\n" , - __func__); +error_report ("%s: stray LMP_not_accepted received, fixme" , + __func__);else -fprintf (stderr,"%s: stray LMP_accepted received, fixme\n" , - __func__); +error_report ("%s: stray LMP_accepted received, fixme" , + __func__);
I think these lines should now also easily fit into one line only.
Quoted 19 lines
hw/bt/core.c +2
-2exit (-1 ); }static void bt_dummy_lmp_disconnect_master (struct bt_link_s *link) { -fprintf (stderr,"%s: stray LMP_detach received, fixme\n" , __func__); +fprintf (stderr,"%s: stray LMP_detach received, fixme" , __func__);exit (-1 ); }static void bt_dummy_lmp_acl_resp (struct bt_link_s *link,const uint8_t *data,int start,int len) { -fprintf (stderr,"%s: stray ACL response PDU, fixme\n" , __func__); +error_report ("%s: stray ACL response PDU, fixme" , __func__);exit (-1 ); }
hw/bt/core.c void bt_device_done(struct bt_device_s *dev) · line 118
Quoted 6 lines
hw/bt/core.c +1
-1@@ -113,7 +114,7 @@ void bt_device_done(struct bt_device_s *dev)while (*p && *p != dev) p = &(*p)->next;if (*p != dev) { -fprintf (stderr,"%s: bad bt device \"%s\"\n" , __func__, +error_report ("%s: bad bt device \"%s\"" , __func__, dev->lmp_name ?:"(null)" );
Bad indentation of the second line.
Quoted 32 lines
hw/bt/core.c +0
-0exit (-1 ); }hw/bt/hci-csr.c +3
-2@@ -19,6 +19,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "chardev/char-serial.h" #include "qemu/timer.h" @@ -111,14 +112,14 @@ static uint8_t *csrhci_out_packet(struct csrhci_s *s, int len)if (off <FIFO_LEN ) {if (off + len >FIFO_LEN && (s->out_size = off + len) >FIFO_LEN *2 ) { -fprintf (stderr,"%s: can't alloc %i bytes\n" , __func__, len); +error_report ("%s: can't alloc %i bytes" , __func__, len);exit (-1 ); }return s->outfifo + off; }if (s->out_len > s->out_size) { -fprintf (stderr,"%s: can't alloc %i bytes\n" , __func__, len); +error_report ("%s: can't alloc %i bytes" , __func__, len);exit (-1 ); }
hw/bt/hci-csr.c static void csrhci_in_packet_vendor(struct csrhci_s *s, int ocf, · line 175
Quoted 9 lines
hw/bt/hci-csr.c +2
-2@@ -168,8 +169,8 @@ static void csrhci_in_packet_vendor(struct csrhci_s *s, int ocf, s->bd_addr.b[5 ] = data[offset +2 ]; s->hci->bdaddr_set (s->hci, s->bd_addr.b); -fprintf (stderr,"%s: bd_address loaded from firmware: " -"%02x:%02x:%02x:%02x:%02x:%02x\n" , __func__, +error_report ("%s: bd_address loaded from firmware: " +"%02x:%02x:%02x:%02x:%02x:%02x" , __func__, s->bd_addr.b[0 ], s->bd_addr.b[1 ], s->bd_addr.b[2 ], s->bd_addr.b[3 ], s->bd_addr.b[4 ], s->bd_addr.b[5 ]);
Bad indentation again.
Quoted 50 lines
hw/bt/hci-csr.c +4
-4}@@ -181,7 +182,7 @@ static void csrhci_in_packet_vendor(struct csrhci_s *s, int ocf,break ;default : -fprintf (stderr,"%s: got a bad CMD packet\n" , __func__); +error_report ("%s: got a bad CMD packet" , __func__);return ; }@@ -226,7 +227,7 @@ static void csrhci_in_packet(struct csrhci_s *s, uint8_t *pkt)case H4_NEG_PKT :if (s->in_hdr !=sizeof (csrhci_neg_packet) ||memcmp (pkt -1 , csrhci_neg_packet, s->in_hdr)) { -fprintf (stderr,"%s: got a bad NEG packet\n" , __func__); +error_report ("%s: got a bad NEG packet" , __func__);return ; } pkt +=2 ;@@ -241,7 +242,7 @@ static void csrhci_in_packet(struct csrhci_s *s, uint8_t *pkt)case H4_ALIVE_PKT :if (s->in_hdr !=4 || pkt[1 ] !=0x55 || pkt[2 ] !=0x00 ) { -fprintf (stderr,"%s: got a bad ALIVE packet\n" , __func__); +error_report ("%s: got a bad ALIVE packet" , __func__);return ; }@@ -254,7 +255,7 @@ static void csrhci_in_packet(struct csrhci_s *s, uint8_t *pkt)default : bad_pkt:/* TODO: error out */ -fprintf (stderr,"%s: got a bad packet\n" , __func__); +error_report ("%s: got a bad packet" , __func__);break ; }hw/bt/hci.c +1
-0@@ -19,6 +19,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "qemu/timer.h"
hw/bt/hci.c static inline uint8_t *bt_hci_event_start(struct bt_hci_s *hci, · line 462
Quoted 6 lines
hw/bt/hci.c +1
-1@@ -457,7 +458,7 @@ static inline uint8_t *bt_hci_event_start(struct bt_hci_s *hci,int mask_byte;if (len >255 ) { -fprintf (stderr,"%s: HCI event params too long (%ib)\n" , +error_report ("%s: HCI event params too long (%ib)" , __func__, len);
Bad indentation again - or even better: Put it into one line only.
hw/bt/hci.c static void bt_hci_inquiry_result(struct bt_hci_s *hci, · line 594
Quoted 9 lines
hw/bt/hci.c +1
-1exit (-1 ); }@@ -589,7 +590,7 @@ static void bt_hci_inquiry_result(struct bt_hci_s *hci,bt_hci_inquiry_result_with_rssi (hci, slave);return ;default : -fprintf (stderr,"%s: bad inquiry mode %02x\n" , __func__, +error_report ("%s: bad inquiry mode %02x" , __func__, hci->lm.inquiry_mode);
Bad indentation.
hw/bt/hci.c static void bt_submit_hci(struct HCIInfo *info, · line 1976
Quoted 9 lines
hw/bt/hci.c +1
-1exit (-1 ); }@@ -1971,7 +1972,7 @@ static void bt_submit_hci(struct HCIInfo *info,break ; short_hci: -fprintf (stderr,"%s: HCI packet too short (%iB)\n" , +error_report ("%s: HCI packet too short (%iB)" , __func__, length);
One line, please.
hw/bt/hci.c static inline void bt_hci_lmp_acl_data(struct bt_hci_s *hci, uint16_t handle, · line 1996
Quoted 9 lines
hw/bt/hci.c +1
-1bt_hci_event_status (hci,HCI_INVALID_PARAMETERS );break ;@@ -1991,7 +1992,7 @@ static inline void bt_hci_lmp_acl_data(struct bt_hci_s *hci, uint16_t handle,/* TODO: avoid memcpy'ing */ if (len +HCI_ACL_HDR_SIZE >sizeof (hci->acl_buf)) { -fprintf (stderr,"%s: can't take ACL packets %i bytes long\n" , +error_report ("%s: can't take ACL packets %i bytes long" , __func__, len);
Fix indentation or put it on one line.
hw/bt/hci.c static void bt_submit_acl(struct HCIInfo *info, · line 2034
Quoted 9 lines
hw/bt/hci.c +1
-1return ; }@@ -2029,7 +2030,7 @@ static void bt_submit_acl(struct HCIInfo *info,struct bt_link_s *link;if (length <HCI_ACL_HDR_SIZE ) { -fprintf (stderr,"%s: ACL packet too short (%iB)\n" , +error_report ("%s: ACL packet too short (%iB)" , __func__, length);
One line.
hw/bt/hci.c static void bt_submit_acl(struct HCIInfo *info, · line 2046
Quoted 10 lines
hw/bt/hci.c +2
-2return ; }@@ -2041,15 +2042,15 @@ static void bt_submit_acl(struct HCIInfo *info, length -=HCI_ACL_HDR_SIZE ;if (bt_hci_handle_bad (hci, handle)) { -fprintf (stderr,"%s: invalid ACL handle %03x\n" , - __func__, handle); +error_report ("%s: invalid ACL handle %03x" , + __func__, handle);
One line.
hw/bt/hci.c static void bt_submit_acl(struct HCIInfo *info, · line 2054
Quoted 9 lines
hw/bt/hci.c +1
-1/* TODO: signal an error */ return ; } handle &= ~HCI_HANDLE_OFFSET ;if (datalen > length) { -fprintf (stderr,"%s: ACL packet too short (%iB < %iB)\n" , +fprintf (stderr,"%s: ACL packet too short (%iB < %iB)" , __func__, length, datalen);
script failure?
hw/bt/hci.c static void bt_submit_acl(struct HCIInfo *info, · line 2065
Quoted 9 lines
hw/bt/hci.c +1
-1return ; }@@ -2060,7 +2061,7 @@ static void bt_submit_acl(struct HCIInfo *info,if (!hci->asb_handle) hci->asb_handle = handle;else if (handle != hci->asb_handle) { -fprintf (stderr,"%s: Bad handle %03x in Active Slave Broadcast\n" , +error_report ("%s: Bad handle %03x in Active Slave Broadcast" , __func__, handle);
Indentation.
etc.
Please have a look at all the hunks in this patch before you submit it again!
Thomas
Re: [Qemu-devel] [PATCH v2 08/47] hw/char: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 74 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>Cc Paolo Bonzini <[email protected]>---
V2:
- Split hw patch into individual directorieshw/char/exynos4210_uart.c | 6 +++--- hw/char/mcf_uart.c | 5 +++-- hw/char/sh_serial.c | 9 +++++---- 3 files changed, 11 insertions(+), 9 deletions(-)hw/char/exynos4210_uart.c +2
-2@@ -296,7 +296,7 @@ static void exynos4210_uart_update_irq(Exynos4210UartState *s)qemu_irq_raise (s->irq);#if DEBUG_IRQ -fprintf (stderr,"UART%d: IRQ has been raised: %08x\n" , +error_report ("UART%d: IRQ has been raised: %08x" , s->channel, s->reg[I_ (UINTP )]);#endif @@ -388,7 +388,7 @@ static void exynos4210_uart_write(void *opaque, hwaddr offset,* qemu_chr_fe_write and background I/O callbacks */ qemu_chr_fe_write_all (&s->chr, &ch,1 );#if DEBUG_Tx_DATA -fprintf (stderr,"%c" , ch); +error_report ("%c" , ch);#endif s->reg[I_ (UTRSTAT )] |=UTRSTAT_TRANSMITTER_EMPTY | UTRSTAT_Tx_BUFFER_EMPTY;
hw/char/exynos4210_uart.c static void exynos4210_uart_write(void *opaque, hwaddr offset, · line 406
Quoted 8 lines
hw/char/exynos4210_uart.c +1
-1@@ -400,7 +400,7 @@ static void exynos4210_uart_write(void *opaque, hwaddr offset,case UINTP : s->reg[I_ (UINTP )] &= ~val; s->reg[I_ (UINTSP )] &= ~val; -PRINT_DEBUG ("UART%d: UINTP [%04x] have been cleared: %08x\n" , +PRINT_DEBUG ("UART%d: UINTP [%04x] have been cleared: %08x" , s->channel, offset, s->reg[I_ (UINTP )]);exynos4210_uart_update_irq (s);break ;
You didn't replace the PRINT_DEBUG macro, did you? So the last change looks wrong. IMHO it's also sounds wrong to use error_report for all the DEBUG sections in here, so I'd rather drop the changes to this file completely.
Thomas
Re: [Qemu-devel] [PATCH v2 09/47] hw/core: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 73 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Cc Paolo Bonzini <[email protected]>---
V2:
- Split hw patch into individual directorieshw/core/loader.c | 31 ++++++++++++++++--------------- hw/core/ptimer.c | 7 ++++--- 2 files changed, 20 insertions(+), 18 deletions(-)hw/core/loader.c +2
-1@@ -43,6 +43,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "hw/hw.h" #include "disas/disas.h" @@ -82,7 +83,7 @@ int load_image(const char *filename, uint8_t *addr)return -1 ; size =lseek (fd,0 ,SEEK_END );if (size ==-1 ) { -fprintf (stderr,"file %-20s: get size error: %s\n" , +error_report ("file %-20s: get size error: %s" , filename,strerror (errno));close (fd);return -1 ;
hw/core/loader.c static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr, · line 628
Quoted 6 lines
hw/core/loader.c +1
-1@@ -623,7 +624,7 @@ static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr, goto out;if (hdr->ih_type != image_type) { -fprintf (stderr,"Wrong image type %d, expected %d\n" , hdr->ih_type, +error_report ("Wrong image type %d, expected %d" , hdr->ih_type, image_type);
Looks like indentation is broken again in this patch. Please fix it first!
Thomas
Re: [Qemu-devel] [PATCH v2 10/47] hw/cris: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 3 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
[...]
Quoted 13 lines
hw/cris/boot.c +1
-0@@ -23,6 +23,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "cpu.h" #include "hw/hw.h"
hw/cris/boot.c void cris_load_image(CRISCPU *cpu, struct cris_load_info *li) · line 91
Quoted 6 lines
hw/cris/boot.c +1
-1@@ -86,14 +87,14 @@ void cris_load_image(CRISCPU *cpu, struct cris_load_info *li) }if (image_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , li->image_filename);
Put it on one line, please.
Thomas
Re: [Qemu-devel] [PATCH v2 40/47] hw/usb: Replace fprintf(stderr, "*\n" with error_report()
In reply to Philippe Mathieu-DaudéQuoted 4 lines · Philippe Mathieu-Daudé
Quoted 3 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
[...]
Quoted 10 lines
Quoted 10 lines
hw/usb/desc.c +1
-1@@ -1,5 +1,5 @@ #include "qemu/osdep.h" - +#include "qemu/error-report.h" #include "hw/usb.h" #include "hw/usb/desc.h"
Quoted 8 lines
Quoted 8 lines
hw/usb/desc.c +0
-0#include "trace.h"@@ -688,7 +688,7 @@ int usb_desc_get_descriptor(USBDevice *dev, USBPacket *p, break;default:
- fprintf(stderr, "%s: %d unknown type %d (len %zd)\n",__func__, +error_report("%s: %d unknown type %d (len %zd)", __func__, dev->addr, type, len);
Bad indentation.
Quoted 29 lines
Quoted 29 lines
break;
}hw/usb/dev-audio.c +3
-2@@ -30,6 +30,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "hw/usb.h" #include "hw/usb/desc.h"@@ -398,7 +399,7 @@ static int usb_audio_set_output_altset(USBAudioState *s, int altset) } if (s->debug) { - fprintf(stderr, "usb-audio: set interface %d\n", altset); + error_report("usb-audio: set interface %d", altset); } s->out.altset = altset; return 0;@@ -478,7 +479,7 @@ static int usb_audio_set_control(USBAudioState *s,uint8_t attrib, uint16_t vol = data[0] + (data[1] << 8); if (s->debug) { - fprintf(stderr, "usb-audio: vol %04x\n", (uint16_t)vol); + error_report("usb-audio: vol %04x", (uint16_t)vol); }
Quoted 8 lines
hw/usb/dev-audio.c static int usb_audio_set_control(USBAudioState *s, · line 501
Quoted 8 lines
hw/usb/dev-audio.c +1
-1vol -= 0x8000;@@ -496,7 +497,7 @@ static int usb_audio_set_control(USBAudioState *s, uint8_t attrib, if (set_vol) { if (s->debug) { - fprintf(stderr, "usb-audio: mute %d, lvol %3d, rvol %3d\n", + error_report("usb-audio: mute %d, lvol %3d, rvol %3d", s->out.mute, s->out.vol[0], s->out.vol[1]);
Bad indentation.
Quoted 5 lines
Quoted 5 lines
hw/usb/dev-audio.c +0
-0} AUD_set_volume_out(s->out.voice, s->out.mute,@@ -514,8 +515,8 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, int ret = 0;
Quoted 8 lines
hw/usb/dev-audio.c static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, · line 520
Quoted 8 lines
hw/usb/dev-audio.c +2
-2if (s->debug) { - fprintf(stderr, "usb-audio: control transaction: " - "request 0x%04x value 0x%04x index 0x%04x length 0x%04x\n", + error_report("usb-audio: control transaction: " + "request 0x%04x value 0x%04x index 0x%04x length 0x%04x", request, value, index, length);
Bad indentation.
Quoted 25 lines
Quoted 25 lines
}
@@ -533,7 +534,7 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p,
length, data);
if (ret < 0) {
if (s->debug) {
-fprintf(stderr, "usb-audio: fail: get control\n"); +error_report("usb-audio: fail: get control"); }
goto fail;
}hw/usb/dev-audio.c +1
-1@@ -548,7 +549,7 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, length, data); if (ret < 0) { if (s->debug) { - fprintf(stderr, "usb-audio: fail: set control\n"); + error_report("usb-audio: fail: set control"); } goto fail;}
hw/usb/dev-audio.c +0
-0@@ -557,8 +558,8 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p,default:
fail:
Quoted 8 lines
Quoted 8 lines
if (
s->debug) {
- fprintf(stderr, "usb-audio: failed control transaction: " - "request 0x%04x value 0x%04x index 0x%04x length 0x%04x\n",
+ error_report("usb-audio: failed control transaction: " + "request 0x%04x value 0x%04x index 0x%04x length 0x%04x",
request, value, index, length);
Bad indentation.
Quoted 9 lines
Quoted 9 lines
}
p->status=USB_RET_STALL;hw/usb/dev-audio.c +1
-1@@ -581,7 +582,7 @@ static void usb_audio_handle_reset(USBDevice *dev) USBAudioState *s = USB_AUDIO(dev); if (s->debug) { - fprintf(stderr, "usb-audio: reset\n"); + error_report("usb-audio: reset"); } usb_audio_set_output_altset(s, ALTSET_OFF);
Quoted 8 lines
hw/usb/dev-audio.c static void usb_audio_handle_dataout(USBAudioState · line 600
Quoted 8 lines
hw/usb/dev-audio.c +1
-1}@@ -595,7 +596,7 @@ static void usb_audio_handle_dataout(USBAudioState *s, USBPacket *p) streambuf_put(&s->out.buf, p); if (p->actual_length < p->iov.size && s->debug > 1) { - fprintf(stderr, "usb-audio: output overrun (%zd bytes)\n", + error_report("usb-audio: output overrun (%zd bytes)", p->iov.size - p->actual_length);
Bad indentation.
Quoted 11 lines
hw/usb/dev-audio.c static void usb_audio_handle_data(USBDevice *dev, · line 617
Quoted 11 lines
hw/usb/dev-audio.c +2
-2} }@@ -611,8 +612,8 @@ static void usb_audio_handle_data(USBDevice *dev, USBPacket *p) p->status = USB_RET_STALL; if (s->debug) { - fprintf(stderr, "usb-audio: failed data transaction: " - "pid 0x%x ep 0x%x len 0x%zx\n", + error_report("usb-audio: failed data transaction: " + "pid 0x%x ep 0x%x len 0x%zx", p->pid, p->ep->nr, p->iov.size);
Bad indentation.
Quoted 2 lines
Quoted 2 lines
hw/usb/dev-audio.c +0
-0} }
[...]
Quoted 10 lines
hw/usb/dev-audio.c static void usb_mtp_handle_control(USBDevice · line 1353
Quoted 7 lines
hw/usb/dev-audio.c +1
-1@@ -1348,7 +1349,7 @@ static void usb_mtp_handle_control(USBDevice *dev, USBPacket *p, static void usb_mtp_cancel_packet(USBDevice *dev, USBPacket *p) { /* we don't use async packets, so this should never be called */ - fprintf(stderr, "%s\n", __func__); + error_report("%s", __func__);what about using tracepoint instead? this report is probably confusing instead of being useful for the user imho.
A comment like "should never be called" rather sounds like we should be using g_assert_not_reached() here instead.
Thomas
Re: [Qemu-devel] [PATCH v2 02/47] Fixes after renaming __FUNCTION__ to __func__
In reply to Alistair FrancisQuoted 9 lines · Alistair Francis
Signed-off-by Alistair Francis <[email protected]>Cc Eric Blake <[email protected]>---
hw/arm/omap1.c | 4 ++-- hw/arm/omap2.c | 2 +- hw/block/onenand.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH v2 03/47] audio: Replace AUDIO_FUNC with __func__
In reply to Alistair FrancisQuoted 10 lines · Alistair Francis
Apparently we don't use
__MSC_VERas a compiler anymore and we always require a C99 compiler (which means we always have__func__) so we don't need a specialAUDIO_FUNCmacro. We can just repleaceAUDIO_FUNCwith__func__instead.Checkpatch failures where manually fixed.
Signed-off-by Alistair Francis <[email protected]>Cc Gerd Hoffmann <[email protected]>---
Module the typo fixes spotted by Thomas,
audio/audio.c static void audio_process_options (const char *prefix, · line 427
Quoted 7 lines
+++
b/audio/audio.caudio/audio.c +1
-1@@ -424,12 +424,12 @@ static void audio_process_options (const char *prefix,const char qemu_prefix[] ="QEMU_" ;size_t preflen, optlen; -if (audio_bug (AUDIO_FUNC , !prefix)) { +if (audio_bug (__func__, !prefix)) {
I wonder if it would be nicer to have audio_bug() as a macro that supplies __func__ automatically; but it's not enough of a concern to prevent this patch from going in as-is.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [PATCH v2 01/47] Replace all occurances of __FUNCTION__ with __func__
In reply to Alistair FrancisQuoted 82 lines · Alistair Francis
Replace all occurs of
__FUNCTION__except for the check in checkpatch with the non GCC specific__func__.One line in
hcd-musb.cwas manually tweaked to pass checkpatch.Signed-off-by Alistair Francis <[email protected]>Cc Gerd Hoffmann <[email protected]>Cc Andrzej Zaborowski <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>Cc John Snow <[email protected]>Cc Aurelien Jarno <[email protected]>Cc Yongbok Kim <[email protected]>Cc Peter Crosthwaite <[email protected]>Cc Stefan Hajnoczi <[email protected]>Cc Fam Zheng <[email protected]>Cc Juan Quintela <[email protected]>Cc "Dr. David Alan Gilbert" <[email protected]>Reviewed-by Eric Blake <[email protected]>---
audio/audio_int.h | 2 +- hw/arm/nseries.c | 2 +- hw/arm/omap1.c | 42 +++++++++++++++++++++--------------------- hw/arm/omap2.c | 12 ++++++------ hw/arm/palm.c | 14 +++++++------- hw/arm/pxa2xx.c | 46 +++++++++++++++++++++++----------------------- hw/arm/pxa2xx_gpio.c | 6 +++--- hw/arm/pxa2xx_pic.c | 4 ++-- hw/arm/tosa.c | 10 +++++----- hw/audio/hda-codec.c | 10 +++++----- hw/audio/intel-hda.c | 28 ++++++++++++++-------------- hw/audio/wm8750.c | 4 ++-- hw/block/nand.c | 4 ++-- hw/block/onenand.c | 8 ++++---- hw/bt/core.c | 10 +++++----- hw/bt/hci-csr.c | 14 +++++++------- hw/bt/hci.c | 26 +++++++++++++------------- hw/bt/hid.c | 2 +- hw/bt/l2cap.c | 22 +++++++++++----------- hw/bt/sdp.c | 6 +++--- hw/display/blizzard.c | 18 +++++++++--------- hw/display/omap_dss.c | 6 +++--- hw/display/pxa2xx_lcd.c | 14 +++++++------- hw/display/qxl-render.c | 6 +++--- hw/display/qxl.h | 2 +- hw/display/tc6393xb.c | 2 +- hw/display/xenfb.c | 2 +- hw/dma/omap_dma.c | 26 +++++++++++++------------- hw/dma/pxa2xx_dma.c | 14 +++++++------- hw/gpio/max7310.c | 8 ++++---- hw/gpio/omap_gpio.c | 2 +- hw/i2c/omap_i2c.c | 6 +++--- hw/ide/ahci.c | 2 +- hw/ide/microdrive.c | 4 ++-- hw/input/lm832x.c | 6 +++--- hw/input/pxa2xx_keypad.c | 6 +++--- hw/input/tsc2005.c | 8 ++++---- hw/input/tsc210x.c | 4 ++-- hw/intc/omap_intc.c | 2 +- hw/isa/vt82c686.c | 2 +- hw/mips/gt64xxx_pci.c | 2 +- hw/misc/cbus.c | 12 ++++++------ hw/misc/omap_clk.c | 4 ++-- hw/misc/omap_gpmc.c | 6 +++--- hw/misc/omap_l4.c | 4 ++-- hw/misc/omap_sdrc.c | 2 +- hw/misc/omap_tap.c | 6 +++--- hw/misc/tmp105.c | 2 +- hw/pci-host/bonito.c | 2 +- hw/sd/pxa2xx_mmci.c | 6 +++--- hw/ssi/omap_spi.c | 6 +++--- hw/timer/omap_gptimer.c | 6 +++--- hw/timer/twl92230.c | 6 +++--- hw/usb/desc.c | 2 +- hw/usb/dev-bluetooth.c | 4 ++-- hw/usb/hcd-musb.c | 4 ++-- hw/usb/tusb6010.c | 14 +++++++------- hw/xenpv/xen_domainbuild.c | 16 ++++++++--------
Quoted 8 lines
hw/xenpv/xen_machine_pv.c | 2 +- include/hw/arm/omap.h | 10 +++++----- include/hw/arm/sharpsl.h | 2 +- memory_mapping.c | 2 +- migration/block.c | 4 ++-- ui/cursor.c | 6 +++--- ui/spice-display.c | 4 ++-- 65 files changed, 273 insertions(+), 273 deletions(-)
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [Qemu-arm] [PATCH v2 01/47] Replace all occurances of __FUNCTION__ with __func__
In reply to Alistair FrancisQuoted 82 lines · Alistair Francis
Replace all occurs of
__FUNCTION__except for the check in checkpatch with the non GCC specific__func__.One line in
hcd-musb.cwas manually tweaked to pass checkpatch.Signed-off-by Alistair Francis <[email protected]>Cc Gerd Hoffmann <[email protected]>Cc Andrzej Zaborowski <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>Cc John Snow <[email protected]>Cc Aurelien Jarno <[email protected]>Cc Yongbok Kim <[email protected]>Cc Peter Crosthwaite <[email protected]>Cc Stefan Hajnoczi <[email protected]>Cc Fam Zheng <[email protected]>Cc Juan Quintela <[email protected]>Cc "Dr. David Alan Gilbert" <[email protected]>Reviewed-by Eric Blake <[email protected]>---
audio/audio_int.h | 2 +- hw/arm/nseries.c | 2 +- hw/arm/omap1.c | 42 +++++++++++++++++++++--------------------- hw/arm/omap2.c | 12 ++++++------ hw/arm/palm.c | 14 +++++++------- hw/arm/pxa2xx.c | 46 +++++++++++++++++++++++----------------------- hw/arm/pxa2xx_gpio.c | 6 +++--- hw/arm/pxa2xx_pic.c | 4 ++-- hw/arm/tosa.c | 10 +++++----- hw/audio/hda-codec.c | 10 +++++----- hw/audio/intel-hda.c | 28 ++++++++++++++-------------- hw/audio/wm8750.c | 4 ++-- hw/block/nand.c | 4 ++-- hw/block/onenand.c | 8 ++++---- hw/bt/core.c | 10 +++++----- hw/bt/hci-csr.c | 14 +++++++------- hw/bt/hci.c | 26 +++++++++++++------------- hw/bt/hid.c | 2 +- hw/bt/l2cap.c | 22 +++++++++++----------- hw/bt/sdp.c | 6 +++--- hw/display/blizzard.c | 18 +++++++++--------- hw/display/omap_dss.c | 6 +++--- hw/display/pxa2xx_lcd.c | 14 +++++++------- hw/display/qxl-render.c | 6 +++--- hw/display/qxl.h | 2 +- hw/display/tc6393xb.c | 2 +- hw/display/xenfb.c | 2 +- hw/dma/omap_dma.c | 26 +++++++++++++------------- hw/dma/pxa2xx_dma.c | 14 +++++++------- hw/gpio/max7310.c | 8 ++++---- hw/gpio/omap_gpio.c | 2 +- hw/i2c/omap_i2c.c | 6 +++--- hw/ide/ahci.c | 2 +- hw/ide/microdrive.c | 4 ++-- hw/input/lm832x.c | 6 +++--- hw/input/pxa2xx_keypad.c | 6 +++--- hw/input/tsc2005.c | 8 ++++---- hw/input/tsc210x.c | 4 ++-- hw/intc/omap_intc.c | 2 +- hw/isa/vt82c686.c | 2 +- hw/mips/gt64xxx_pci.c | 2 +- hw/misc/cbus.c | 12 ++++++------ hw/misc/omap_clk.c | 4 ++-- hw/misc/omap_gpmc.c | 6 +++--- hw/misc/omap_l4.c | 4 ++-- hw/misc/omap_sdrc.c | 2 +- hw/misc/omap_tap.c | 6 +++--- hw/misc/tmp105.c | 2 +- hw/pci-host/bonito.c | 2 +- hw/sd/pxa2xx_mmci.c | 6 +++--- hw/ssi/omap_spi.c | 6 +++--- hw/timer/omap_gptimer.c | 6 +++--- hw/timer/twl92230.c | 6 +++--- hw/usb/desc.c | 2 +- hw/usb/dev-bluetooth.c | 4 ++-- hw/usb/hcd-musb.c | 4 ++-- hw/usb/tusb6010.c | 14 +++++++------- hw/xenpv/xen_domainbuild.c | 16 ++++++++--------
Quoted 8 lines
hw/xenpv/xen_machine_pv.c | 2 +- include/hw/arm/omap.h | 10 +++++----- include/hw/arm/sharpsl.h | 2 +- memory_mapping.c | 2 +- migration/block.c | 4 ++-- ui/cursor.c | 6 +++--- ui/spice-display.c | 4 ++-- 65 files changed, 273 insertions(+), 273 deletions(-)
Re: [Qemu-devel] [PATCH v2 31/47] hw/pci*: Replace fprintf(stderr, "*\n" with error_report()
In reply to Marcel ApfelbaumQuoted 70 lines · Marcel Apfelbaum
Hi,
Quoted 50 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Quoted 2 lines
Some lines where then manually tweaked to pass checkpatch.
We are using coccinelle with great results until now and we save the scripts in
scripts/coccinelleso we can run them later/improve them.
For your task it should be a really easy script, but since your work is already done maybe is not worth it. Anyway, here is the equivalent coccinelle script:@
expression list ARGS;
@@
-fprintf(stderr, ARGS);
+error_report(ARGS);
Quoted 6 lines
To run:
Install coccinelle: dnf install coccinelle Save the above as: <qemu_dir>/scripts/coccinelle/remove_fprintf.cocci Run it to see the diff: spatch --sp-file <qemu_dir>scripts/coccinelle/remove_fprintf.cocci --dir<
qemu_dir> --include-headers
Thanks,
I have already decided that coccinelle is the way to go here, this ended up much more complex then I was hoping.
That's good to know we save the previous scripts.
Thanks,
Alistair
Quoted 88 lines
Reviewed-by Marcel Apfelbaum <[email protected]>Thanks,
MarcelQuoted 78 lines
Signed-off-by Alistair Francis <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Cc Marcel Apfelbaum <[email protected]>---
V2:
- Split hw patch into individual directorieshw/pci-host/bonito.c | 6 +++--- hw/pci/pci.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-)hw/pci-host/bonito.c +1
-2@@ -38,7 +38,7 @@*/ #include "qemu/osdep.h" - +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/pci/pci.h" #include "hw/i386/pc.h" @@ -449,8 +449,8 @@ static uint32_t bonito_sbridge_pciaddr(void *opaque, hwaddr addr) regno = (cfgaddr &BONITO_PCICONF_REG_MASK ) >>BONITO_PCICONF_REG_OFFSET ;if (idsel ==0 ) { - fprintf(stderr, "error in bonito pci config address "
TARGET_FMT_plxhw/pci-host/bonito.c +2
-1- ",pcimap_cfg=%x\n", addr, s->regs[BONITO_PCIMAP_CFG]); +error_report ("error in bonito pci config address " TARGET_FMT_plx +",pcimap_cfg=%x" , addr, s->regs[BONITO_PCIMAP_CFG ]);exit (1 ); } pciaddr =PCI_ADDR (pci_bus_num (phb->bus), devno, funno, regno);hw/pci/pci.c +1
-1@@ -515,7 +515,7 @@ static int get_pci_irq_state(QEMUFile *f, void *pv,size_t size, for (i = 0; i < PCI_NUM_PINS; ++i) { irq_state[i] =qemu_get_be32 (f);if (irq_state[i] !=0x1 && irq_state[i] !=0 ) { -fprintf (stderr,"irq state %d: must be 0 or 1.\n" , +error_report ("irq state %d: must be 0 or 1." , irq_state[i]);return -EINVAL ;}hw/pci/pci.c +1
-1@@ -678,7 +678,7 @@ static PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, unsigned slot;if (!root) { -fprintf (stderr,"No primary PCI bus\n" ); +error_report ("No primary PCI bus" );return NULL ; } @@ -694,7 +694,7 @@ static PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus*root,
} if (dom != 0) {hw/pci/pci.c +1
-1-fprintf (stderr,"No support for non-zero PCI domains\n" ); +error_report ("No support for non-zero PCI domains" );return NULL ; } @@ -1118,8 +1118,8 @@ void pci_register_bar(PCIDevice *pci_dev, int
region_num,assert(region_num >= 0); assert(region_num < PCI_NUM_REGIONS); if (size & (size-1)) {hw/pci/pci.c +2
-2-fprintf (stderr,"ERROR: PCI region size must be pow2 " -"type=0x%x, size=0x%" FMT_PCIBUS "\n" , type, size); +error_report ("ERROR: PCI region size must be pow2 " +"type=0x%x, size=0x%" FMT_PCIBUS "" , type, size);exit (1 ); }
Re: [Qemu-devel] [PATCH v2 32/47] hw/ppc: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 38 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +
Quoted 3 lines
Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>
Quoted 339 lines
---
V2:
- Split hw patch into individual directorieshw/ppc/e500.c | 20 ++++++++++---------- hw/ppc/mac_newworld.c | 2 +- hw/ppc/mac_oldworld.c | 2 +- hw/ppc/mpc8544_guts.c | 5 +++-- hw/ppc/ppc405_boards.c | 8 ++++---- hw/ppc/ppc440_bamboo.c | 19 ++++++++++--------- hw/ppc/ppc4xx_pci.c | 3 ++- hw/ppc/prep.c | 4 ++-- hw/ppc/virtex_ml507.c | 4 ++-- 9 files changed, 35 insertions(+), 32 deletions(-)hw/ppc/e500.c +10
-10@@ -333,13 +333,13 @@ static int ppce500_load_device_tree(MachineState *machine, ret =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , initrd_base);if (ret <0 ) { -fprintf (stderr,"couldn't set /chosen/linux,initrd-start\n" ); +error_report ("couldn't set /chosen/linux,initrd-start" ); } ret =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , (initrd_base + initrd_size));if (ret <0 ) { -fprintf (stderr,"couldn't set /chosen/linux,initrd-end\n" ); +error_report ("couldn't set /chosen/linux,initrd-end" ); } }@@ -353,7 +353,7 @@ static int ppce500_load_device_tree(MachineState *machine, ret =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , machine->kernel_cmdline);if (ret <0 ) -fprintf (stderr,"couldn't set /chosen/bootargs\n" ); +error_report ("couldn't set /chosen/bootargs" );if (kvm_enabled ()) {/* Read out host's frequencies */ @@ -720,7 +720,7 @@ static DeviceState *ppce500_init_mpic_kvm(PPCE500Params *params,CPU_FOREACH (cs) {if (kvm_openpic_connect_vcpu (dev, cs)) { -fprintf (stderr,"%s: failed to connect vcpu to irqchip\n" , +error_report ("%s: failed to connect vcpu to irqchip" , __func__);abort (); }@@ -821,7 +821,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) cs =CPU (cpu);if (env->mmu_model !=POWERPC_MMU_BOOKE206 ) { -fprintf (stderr,"MMU model %i not supported by this machine.\n" , +error_report ("MMU model %i not supported by this machine." , env->mmu_model);exit (1 ); }@@ -967,7 +967,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) cur_base, ram_size - cur_base);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , machine->kernel_filename);exit (1 ); }@@ -982,8 +982,8 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) ram_size - initrd_base);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - machine->initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + machine->initrd_filename);exit (1 ); }@@ -1024,7 +1024,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) kernel_size =load_uimage (filename, &bios_entry, &loadaddr,NULL ,NULL ,NULL );if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load firmware '%s'\n" , filename); +error_report ("qemu: could not load firmware '%s'" , filename);exit (1 ); } }@@ -1037,7 +1037,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) initrd_base, initrd_size, kernel_base, kernel_size);if (dt_size <0 ) { -fprintf (stderr,"couldn't load device tree\n" ); +error_report ("couldn't load device tree" );exit (1 ); }assert (dt_size <DTB_MAX_SIZE );hw/ppc/mac_newworld.c +1
-1@@ -278,7 +278,7 @@ static void ppc_core99_init(MachineState *machine) } }if (ppc_boot_device =='\0' ) { -fprintf (stderr,"No valid boot device for Mac99 machine\n" ); +error_report ("No valid boot device for Mac99 machine" );exit (1 ); } }hw/ppc/mac_oldworld.c +1
-1@@ -221,7 +221,7 @@ static void ppc_heathrow_init(MachineState *machine)#endif }if (ppc_boot_device =='\0' ) { -fprintf (stderr,"No valid boot device for G3 Beige machine\n" ); +error_report ("No valid boot device for G3 Beige machine" );exit (1 ); } }hw/ppc/mpc8544_guts.c +3
-2@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "cpu.h" #include "hw/hw.h" @@ -83,7 +84,7 @@ static uint64_t mpc8544_guts_read(void *opaque, hwaddr addr, value = env->spr[SPR_E500_SVR ];break ;default : -fprintf (stderr,"guts: Unknown register read: %x\n" , (int )addr); +error_report ("guts: Unknown register read: %x" , (int )addr);break ; }@@ -102,7 +103,7 @@ static void mpc8544_guts_write(void *opaque, hwaddr addr, }break ;default : -fprintf (stderr,"guts: Unknown register write: %x = %x\n" , +error_report ("guts: Unknown register write: %x = %x" , (int )addr, (unsigned )value);break ; }hw/ppc/ppc405_boards.c +4
-4@@ -324,7 +324,7 @@ static void ref405ep_init(MachineState *machine) kernel_size =load_image_targphys (kernel_filename, kernel_base, ram_size - kernel_base);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }@@ -336,8 +336,8 @@ static void ref405ep_init(MachineState *machine) initrd_size =load_image_targphys (initrd_filename, initrd_base, ram_size - initrd_base);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + initrd_filename);exit (1 ); } }else {@@ -607,7 +607,7 @@ static void taihu_405ep_init(MachineState *machine) kernel_size =load_image_targphys (kernel_filename, kernel_base, ram_size - kernel_base);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }hw/ppc/ppc440_bamboo.c +10
-9@@ -12,6 +12,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "net/net.h" #include "hw/hw.h" @@ -80,22 +81,22 @@ static int bamboo_load_device_tree(hwaddr addr, ret =qemu_fdt_setprop (fdt,"/memory" ,"reg" , mem_reg_property,sizeof (mem_reg_property));if (ret <0 ) -fprintf (stderr,"couldn't set /memory/reg\n" ); +error_report ("couldn't set /memory/reg" ); ret =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , initrd_base);if (ret <0 ) -fprintf (stderr,"couldn't set /chosen/linux,initrd-start\n" ); +error_report ("couldn't set /chosen/linux,initrd-start" ); ret =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , (initrd_base + initrd_size));if (ret <0 ) -fprintf (stderr,"couldn't set /chosen/linux,initrd-end\n" ); +error_report ("couldn't set /chosen/linux,initrd-end" ); ret =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , kernel_cmdline);if (ret <0 ) -fprintf (stderr,"couldn't set /chosen/bootargs\n" ); +error_report ("couldn't set /chosen/bootargs" );/* Copy data from the host device tree into the guest. Since the guest can * directly access the timebase without host involvement, we must expose @@ -190,7 +191,7 @@ static void bamboo_init(MachineState *machine) env = &cpu->env;if (env->mmu_model !=POWERPC_MMU_BOOKE ) { -fprintf (stderr,"MMU model %i not supported by this machine.\n" , +error_report ("MMU model %i not supported by this machine." , env->mmu_model);exit (1 ); }@@ -224,7 +225,7 @@ static void bamboo_init(MachineState *machine) NULL); pcibus = (PCIBus *)qdev_get_child_bus (dev,"pci.0" );if (!pcibus) { -fprintf (stderr,"couldn't create PCI controller!\n" ); +error_report ("couldn't create PCI controller!" );exit (1 ); }@@ -265,7 +266,7 @@ static void bamboo_init(MachineState *machine) }/* XXX try again as binary */ if (success <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }@@ -277,7 +278,7 @@ static void bamboo_init(MachineState *machine) ram_size - RAMDISK_ADDR);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load ram disk '%s' at %x\n" , +error_report ("qemu: could not load ram disk '%s' at %x" , initrd_filename,RAMDISK_ADDR );exit (1 ); }@@ -287,7 +288,7 @@ static void bamboo_init(MachineState *machine)if (kernel_filename) {if (bamboo_load_device_tree (FDT_ADDR , ram_size,RAMDISK_ADDR , initrd_size, kernel_cmdline) <0 ) { -fprintf (stderr,"couldn't load device tree\n" ); +error_report ("couldn't load device tree" );exit (1 ); } }hw/ppc/ppc4xx_pci.c +2
-1@@ -20,6 +20,7 @@* 4xx SoCs, such as the 440EP. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/ppc/ppc.h" #include "hw/ppc/ppc4xx.h" @@ -254,7 +255,7 @@ static void ppc4xx_pci_set_irq(void *opaque, int irq_num, int level)trace_ppc4xx_pci_set_irq (irq_num);if (irq_num <0 ) { -fprintf (stderr,"%s: PCI irq %d\n" , __func__, irq_num); +error_report ("%s: PCI irq %d" , __func__, irq_num);return ; }qemu_set_irq (pci_irqs[irq_num], level);hw/ppc/prep.c +2
-2@@ -576,7 +576,7 @@ static void ppc_prep_init(MachineState *machine) } }if (ppc_boot_device =='\0' ) { -fprintf (stderr,"No valid boot device for Mac99 machine\n" ); +error_report ("No valid boot device for Mac99 machine" );exit (1 ); } }@@ -597,7 +597,7 @@ static void ppc_prep_init(MachineState *machine)qdev_init_nofail (dev); pci_bus = (PCIBus *)qdev_get_child_bus (dev,"pci.0" );if (pci_bus ==NULL ) { -fprintf (stderr,"Couldn't create PCI host controller.\n" ); +error_report ("Couldn't create PCI host controller." );exit (1 ); } sysctrl->contiguous_map_irq =qdev_get_gpio_in (dev,0 );hw/ppc/virtex_ml507.c +2
-2@@ -187,7 +187,7 @@ static int xilinx_load_device_tree(hwaddr addr, r =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , kernel_cmdline);if (r <0 ) -fprintf (stderr,"couldn't set /chosen/bootargs\n" ); +error_report ("couldn't set /chosen/bootargs" );cpu_physical_memory_write (addr, fdt, fdt_size);return fdt_size; }@@ -219,7 +219,7 @@ static void virtex_init(MachineState *machine) env = &cpu->env;if (env->mmu_model !=POWERPC_MMU_BOOKE ) { -fprintf (stderr,"MMU model %i not supported by this machine.\n" , +error_report ("MMU model %i not supported by this machine." , env->mmu_model);exit (1 ); }
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH v2 18/47] hw/intc: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 18 lines · On Fri, 29 Sep 2017 17:15:54 -0700 Alistair Francis…
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.hw/intc/s390_flic_kvm.c +1
-1@@ -83,7 +83,7 @@ static void flic_enable_pfault(KVMS390FLICState *flic) rc =ioctl (flic->fd,KVM_SET_DEVICE_ATTR , &attr);if (rc) { -fprintf (stderr,"flic: couldn't enable pfault\n" ); +error_report ("flic: couldn't enable pfault" ); } }
hw/intc/s390_flic_kvm.c static void flic_disable_wait_pfault(KVMS390FLICState *flic) · line 103
Quoted 8 lines
hw/intc/s390_flic_kvm.c +1
-1@@ -97,7 +97,7 @@ static void flic_disable_wait_pfault(KVMS390FLICState *flic) rc =ioctl (flic->fd,KVM_SET_DEVICE_ATTR , &attr);if (rc) { -fprintf (stderr,"flic: couldn't disable pfault\n" ); +error_report ("flic: couldn't disable pfault" ); } }
s390x part:
Re: [Qemu-arm] [PATCH v2 47/47] target: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 90 lines · On Fri, 29 Sep 2017 17:17:26 -0700 Alistair Francis…
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.target/s390x/kvm.c +10
-10@@ -967,13 +967,13 @@ static void inject_vcpu_irq_legacy(CPUState *cs, struct kvm_s390_irq *irq) r =s390_kvm_irq_to_interrupt (irq, &kvmint);if (r <0 ) { -fprintf (stderr,"%s called with bogus interrupt\n" , __func__); +error_report ("%s called with bogus interrupt" , __func__);exit (1 ); } r =kvm_vcpu_ioctl (cs,KVM_S390_INTERRUPT , &kvmint);if (r <0 ) { -fprintf (stderr,"KVM failed to inject interrupt\n" ); +error_report ("KVM failed to inject interrupt" );exit (1 ); } }@@ -1002,13 +1002,13 @@ static void __kvm_s390_floating_interrupt(struct kvm_s390_irq *irq) r =s390_kvm_irq_to_interrupt (irq, &kvmint);if (r <0 ) { -fprintf (stderr,"%s called with bogus interrupt\n" , __func__); +error_report ("%s called with bogus interrupt" , __func__);exit (1 ); } r =kvm_vm_ioctl (kvm_state,KVM_S390_INTERRUPT , &kvmint);if (r <0 ) { -fprintf (stderr,"KVM failed to inject interrupt\n" ); +error_report ("KVM failed to inject interrupt" );exit (1 ); } }@@ -1116,14 +1116,14 @@ static int handle_b2(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)break ;case PRIV_B2_TSCH :/* We should only get tsch via KVM_EXIT_S390_TSCH. */ -fprintf (stderr,"Spurious tsch intercept\n" ); +error_report ("Spurious tsch intercept" );break ;case PRIV_B2_CHSC :ioinst_handle_chsc (cpu, run->s390_sieic.ipb);break ;case PRIV_B2_TPI :/* This should have been handled by kvm already. */ -fprintf (stderr,"Spurious tpi intercept\n" ); +error_report ("Spurious tpi intercept" );break ;case PRIV_B2_SCHM : ioinst_handle_schm(cpu, env->regs[1], env->regs[2],@@ -2050,15 +2050,15 @@ static int handle_intercept(S390CPU *cpu) }break ;case ICPT_SOFT_INTERCEPT : -fprintf (stderr,"KVM unimplemented icpt SOFT\n" ); +error_report ("KVM unimplemented icpt SOFT" );exit (1 );break ;case ICPT_IO : -fprintf (stderr,"KVM unimplemented icpt IO\n" ); +error_report ("KVM unimplemented icpt IO" );exit (1 );break ;default : -fprintf (stderr,"Unknown intercept code: %d\n" , icpt_code); +error_report ("Unknown intercept code: %d" , icpt_code);exit (1 );break ; }@@ -2215,7 +2215,7 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) ret =kvm_arch_handle_debug_exit (cpu);break ;default : -fprintf (stderr,"Unknown KVM exit: %d\n" , run->exit_reason); +error_report ("Unknown KVM exit: %d" , run->exit_reason);break ; }qemu_mutex_unlock_iothread ();target/s390x/misc_helper.c +0
-0
target/s390x/misc_helper.c uint32_t HELPER(sigp)(CPUS390XState *env, uint64_t order_code, uint32_t r1, · line 360
Quoted 8 lines
target/s390x/misc_helper.c +1
-1@@ -354,7 +354,7 @@ uint32_t HELPER(sigp)(CPUS390XState *env, uint64_t order_code, uint32_t r1,#endif default :/* unknown sigp */ -fprintf (stderr,"XXX unknown sigp: 0x%" PRIx64"\n" , order_code); +error_report ("XXX unknown sigp: 0x%" PRIx64"" , order_code); cc =SIGP_CC_NOT_OPERATIONAL ; }
There might be some clashes with David's patches (haven't checked), but that depends on what goes in first anyway. So, for the s390x parts:
Re: [Qemu-devel] [PATCH v2 42/47] hw/xen*: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 62 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.hw/xen/xen-common.c +6
-5@@ -9,6 +9,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/xen/xen_backend.h" #include "qmp-commands.h" #include "chardev/char.h" @@ -47,19 +48,19 @@ static int store_dev_info(int domid, Chardev *cs, const char *string)/* We now have everything we need to set the xenstore entry. */ xs =xs_open (0 );if (xs ==NULL ) { -fprintf (stderr,"Could not contact XenStore\n" ); +error_report ("Could not contact XenStore" ); goto out; } path =xs_get_domain_path (xs, domid);if (path ==NULL ) { -fprintf (stderr,"xs_get_domain_path() error\n" ); +error_report ("xs_get_domain_path() error" ); goto out; } newpath =realloc (path, (strlen (path) +strlen (string) +strlen ("/tty" ) +1 ));if (newpath ==NULL ) { -fprintf (stderr,"realloc error\n" ); +error_report ("realloc error" ); goto out; } path = newpath;@@ -96,13 +97,13 @@ static void xenstore_record_dm_state(struct xs_handle *xs, const char *state)char path[50 ];if (xs ==NULL ) { -fprintf (stderr,"xenstore connection not initialized\n" ); +error_report ("xenstore connection not initialized" );exit (1 ); }snprintf (path,sizeof (path),"device-model/%u/state" , xen_domid);if (!xs_write (xs,XBT_NULL , path, state,strlen (state))) { -fprintf (stderr,"error recording dm state\n" ); +error_report ("error recording dm state" );exit (1 ); } }hw/xen/xen_pt.c +0
-0
hw/xen/xen_pt.c void xen_pt_log(const PCIDevice *d, const char *f, ...) · line 76
Quoted 5 lines
hw/xen/xen_pt.c +1
-1@@ -73,7 +73,7 @@ void xen_pt_log(const PCIDevice *d, const char *f, ...)va_start (ap, f);if (d) { - fprintf(stderr, "[%02x:%02x.%d] ", pci_bus_num(d->bus), + error_report("[%02x:%02x.%d] ", pci_bus_num(d->bus),
This is only part of a line of a comment, this is going to be more complecated that just calling error_repport, right?
hw/xen/xen_pt.c void xen_pt_log(const PCIDevice *d, const char *f, ...) · line 79
Quoted 3 lines
hw/xen/xen_pt.c +0
-0PCI_SLOT(d->devfn), PCI_FUNC(d->devfn)); }vfprintf (stderr, f, ap);
The second part of the line is printed here.
hw/xen/xen_pt.c static int xen_pt_pci_config_access_check(PCIDevice *d, uint32_t addr, int len) · line 90
Quoted 6 lines
hw/xen/xen_pt.c +1
-1@@ -87,7 +87,7 @@ static int xen_pt_pci_config_access_check(PCIDevice *d, uint32_t addr, int len)/* check offset range */ if (addr >0xFF ) {XEN_PT_ERR (d,"Failed to access register with offset exceeding 0xFF. " -"(addr: 0x%02x, len: %d)\n" , addr, len); +"(addr: 0x%02x, len: %d)" , addr, len);
If xen_pt_log is changed, there would be many more of the XEN_PT_ERR call to change. (as well as XEN_PT_LOG and XEN_PT_WARN.)
Quoted 121 lines
hw/xen/xen_pt.c +0
-0return -1 ; }hw/xenpv/xen_domainbuild.c +12
-12@@ -25,22 +25,22 @@ static int xenstore_domain_mkdir(char *path)int i;if (!xs_mkdir (xenstore,0 , path)) { -fprintf (stderr,"%s: xs_mkdir %s: failed\n" , __func__, path); -return -1 ; +error_report ("%s: xs_mkdir %s: failed" , __func__, path); +return -1 ; }if (!xs_set_permissions (xenstore,0 , path, perms_ro,2 )) { -fprintf (stderr,"%s: xs_set_permissions failed\n" , __func__); -return -1 ; +error_report ("%s: xs_set_permissions failed" , __func__); +return -1 ; }for (i =0 ; writable[i]; i++) {snprintf (subpath,sizeof (subpath),"%s/%s" , path, writable[i]);if (!xs_mkdir (xenstore,0 , subpath)) { -fprintf (stderr,"%s: xs_mkdir %s: failed\n" , __func__, subpath); +error_report ("%s: xs_mkdir %s: failed" , __func__, subpath);return -1 ; }if (!xs_set_permissions (xenstore,0 , subpath, perms_rw,2 )) { -fprintf (stderr,"%s: xs_set_permissions failed\n" , __func__); +error_report ("%s: xs_set_permissions failed" , __func__);return -1 ; } }@@ -235,7 +235,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk,memcpy (uuid, &qemu_uuid,sizeof (uuid)); rc =xen_domain_create (xen_xc, ssidref, uuid, flags, &xen_domid);if (rc <0 ) { -fprintf (stderr,"xen: xc_domain_create() failed\n" ); +error_report ("xen: xc_domain_create() failed" ); goto err; }qemu_log ("xen: created domain %d\n" , xen_domid);@@ -248,21 +248,21 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, rc =xc_domain_max_vcpus (xen_xc, xen_domid, smp_cpus);if (rc <0 ) { -fprintf (stderr,"xen: xc_domain_max_vcpus() failed\n" ); +error_report ("xen: xc_domain_max_vcpus() failed" ); goto err; }#if 0 rc =xc_domain_setcpuweight (xen_xc, xen_domid,256 );if (rc <0 ) { -fprintf (stderr,"xen: xc_domain_setcpuweight() failed\n" ); +error_report ("xen: xc_domain_setcpuweight() failed" ); goto err; }#endif rc =xc_domain_setmaxmem (xen_xc, xen_domid, ram_size >>10 );if (rc <0 ) { -fprintf (stderr,"xen: xc_domain_setmaxmem() failed\n" ); +error_report ("xen: xc_domain_setmaxmem() failed" ); goto err; }@@ -275,7 +275,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, xenstore_port, &xenstore_mfn, console_port, &console_mfn);if (rc <0 ) { -fprintf (stderr,"xen: xc_linux_build() failed\n" ); +error_report ("xen: xc_linux_build() failed" ); goto err; }@@ -285,7 +285,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk,qemu_log ("xen: unpausing domain %d\n" , xen_domid); rc =xc_domain_unpause (xen_xc, xen_domid);if (rc <0 ) { -fprintf (stderr,"xen: xc_domain_unpause() failed\n" ); +error_report ("xen: xc_domain_unpause() failed" ); goto err; }hw/xenpv/xen_machine_pv.c +3
-2@@ -23,6 +23,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/boards.h" #include "hw/xen/xen_backend.h" @@ -36,7 +37,7 @@ static void xen_init_pv(MachineState *machine)/* Initialize backend core & drivers */ if (xen_be_init () !=0 ) { -fprintf (stderr,"%s: xen backend core setup failed\n" , __func__); +error_report ("%s: xen backend core setup failed" , __func__);exit (1 ); }@@ -51,18 +52,18 @@ static void xen_init_pv(MachineState *machine)const char *initrd_filename = machine->initrd_filename;if (xen_domain_build_pv (kernel_filename, initrd_filename, kernel_cmdline) <0 ) { -fprintf (stderr,"xen pv domain creation failed\n" ); +error_report ("xen pv domain creation failed" );exit (1 ); } break; }#endif case XEN_EMULATE :
hw/xenpv/xen_machine_pv.c static void xen_init_pv(MachineState *machine) · line 69
Quoted 10 lines
hw/xenpv/xen_machine_pv.c +2
-2-fprintf (stderr,"xen emulation not implemented (yet)\n" ); +error_report ("xen emulation not implemented (yet)" );exit (1 );break ;default : -fprintf (stderr,"unhandled xen_mode %d\n" , xen_mode); +error_report ("unhandled xen_mode %d" , xen_mode);exit (1 );break ; }
The rest of the patch looks good.
Thanks,
Signature · 1 line
Anthony PERARD
Anthony PERARD
Acked-byRe: [Qemu-devel] [PATCH v2 15/47] hw/i386: Replace fprintf(stderr, "*\n" with error_report()
In reply to a message not in the archiveQuoted 3 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
[...]
Quoted 69 lines
hw/i386/xen/xen-hvm.c +16
-14@@ -246,9 +246,10 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, MemoryRegion *mr,if (runstate_check (RUN_STATE_INMIGRATE )) {/* RAM already populated in Xen */ -fprintf (stderr,"%s: do not alloc " RAM_ADDR_FMT -" bytes of ram at " RAM_ADDR_FMT " when runstate is INMIGRATE\n" , - __func__, size, ram_addr); +error_report ("%s: do not alloc " RAM_ADDR_FMT +" bytes of ram at " RAM_ADDR_FMT " when runstate is " +" INMIGRATE" , + __func__, size, ram_addr);return ; }@@ -444,8 +445,9 @@ static int xen_remove_from_physmap(XenIOState *state, rc =xen_xc_domain_add_to_physmap (xen_xc, xen_domid, XENMAPSPACE_gmfn, idx, gpfn);if (rc) { -fprintf (stderr,"add_to_physmap MFN %" PRI_xen_pfn" to PFN %" - PRI_xen_pfn" failed: %d (errno: %d)\n" , idx, gpfn, rc, errno); +error_report ("add_to_physmap MFN %" PRI_xen_pfn" to PFN %" + PRI_xen_pfn" failed: %d (errno: %d)" , idx, + gpfn, rc, errno);return -rc; } }@@ -1090,11 +1092,11 @@ static void cpu_handle_ioreq(void *opaque) req->data = copy.data;if (req->state !=STATE_IOREQ_INPROCESS ) { -fprintf (stderr,"Badness in I/O request ... not in service?!: " -"%x, ptr: %x, port: %" PRIx64", " -"data: %" PRIx64", count: %u, size: %u, type: %u\n" , - req->state, req->data_is_ptr, req->addr, - req->data, req->count, req->size, req->type); +error_report ("Badness in I/O request ... not in service?!: " +"%x, ptr: %x, port: %" PRIx64", " +"data: %" PRIx64", count: %u, size: %u, type: %u" , + req->state, req->data_is_ptr, req->addr, + req->data, req->count, req->size, req->type);destroy_hvm_domain (false);return ; }@@ -1397,16 +1399,16 @@ void destroy_hvm_domain(bool reboot) xc_handle =xc_interface_open (0 ,0 ,0 );if (xc_handle ==NULL ) { -fprintf (stderr,"Cannot acquire xenctrl handle\n" ); +error_report ("Cannot acquire xenctrl handle" ); }else { sts =xc_domain_shutdown (xc_handle, xen_domid, reboot ? SHUTDOWN_reboot : SHUTDOWN_poweroff);if (sts !=0 ) { -fprintf (stderr,"xc_domain_shutdown failed to issue %s, " -"sts %d, %s\n" , reboot ?"reboot" :"poweroff" , +error_report ("xc_domain_shutdown failed to issue %s, " +"sts %d, %s" , reboot ?"reboot" :"poweroff" , sts,strerror (errno)); }else { -fprintf (stderr,"Issued domain %d %s\n" , xen_domid, +error_report ("Issued domain %d %s" , xen_domid, reboot ?"reboot" :"poweroff" ); }xc_interface_close (xc_handle);
hw/i386/xen/xen-hvm.c void xen_shutdown_fatal_error(const char *fmt, ...) · line 1428
Quoted 2 lines
hw/i386/xen/xen-hvm.c +0
-0@@ -1425,7 +1427,7 @@ void xen_shutdown_fatal_error(const char *fmt, ...)va_start (ap, fmt);vfprintf (stderr, fmt, ap);
Here, we may want to replace vfprintf by error_vreport as well? Or is it more complicated and needs its own patch to fix all call to xen_shutdown_fatal_error?
Quoted 56 lines
hw/i386/xen/xen-hvm.c +1
-1va_end (ap); -fprintf (stderr,"Will destroy the domain.\n" ); +error_report ("Will destroy the domain." );/* destroy the domain */ qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_ERROR ); }hw/i386/xen/xen-mapcache.c +6
-6@@ -377,7 +377,7 @@ ram_addr_t xen_ram_addr_from_mapcache(void *ptr) } }if (!found) { -fprintf (stderr,"%s, could not find %p\n" , __func__, ptr); +error_report ("%s, could not find %p" , __func__, ptr); QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {DPRINTF (" " TARGET_FMT_plx" -> %p is present\n" , reventry->paddr_index, reventry->vaddr_req);@@ -477,9 +477,9 @@ void xen_invalidate_map_cache(void)if (!reventry->dma) {continue ; } -fprintf (stderr,"Locked DMA mapping while invalidating mapcache!" -" " TARGET_FMT_plx" -> %p is present\n" , - reventry->paddr_index, reventry->vaddr_req); +error_report ("Locked DMA mapping while invalidating mapcache!" +" " TARGET_FMT_plx" -> %p is present" , + reventry->paddr_index, reventry->vaddr_req); }for (i =0 ; i < mapcache->nr_buckets; i++) {@@ -545,8 +545,8 @@ static uint8_t *xen_replace_cache_entry_unlocked(hwaddr old_phys_addr, address_index = new_phys_addr >>MCACHE_BUCKET_SHIFT ; address_offset = new_phys_addr & (MCACHE_BUCKET_SIZE -1 ); -fprintf (stderr,"Replacing a dummy mapcache entry for " TARGET_FMT_plx \ -" with " TARGET_FMT_plx"\n" , old_phys_addr, new_phys_addr); +error_report ("Replacing a dummy mapcache entry for " TARGET_FMT_plx \ +" with " TARGET_FMT_plx"" , old_phys_addr, new_phys_addr);xen_remap_bucket (entry, entry->vaddr_base, cache_size, address_index, false);hw/i386/xen/xen_apic.c +1
-0@@ -10,6 +10,7 @@* later. See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/i386/apic_internal.h" #include "hw/pci/msi.h" #include "hw/xen/xen.h"
hw/i386/xen/xen_apic.c static void xen_apic_mem_write(void *opaque, hwaddr addr, · line 31
Quoted 8 lines
hw/i386/xen/xen_apic.c +1
-1@@ -24,7 +25,7 @@ static void xen_apic_mem_write(void *opaque, hwaddr addr, uint64_t data, unsigned size) {if (size !=sizeof (uint32_t )) { -fprintf (stderr,"Xen: APIC write data size = %d, invalid\n" , size); +error_report ("Xen: APIC write data size = %d, invalid" , size);return ; }
Despite my comment, for the Xen part:
Signature · 1 line
Anthony PERARD
Re: [Qemu-devel] [PATCH v2 22/47] hw/m68k: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 3 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
[...]
hw/m68k/an5206.c static void an5206_init(MachineState *machine) · line 86
Quoted 6 lines
hw/m68k/an5206.c +1
-1@@ -83,7 +83,7 @@ static void an5206_init(MachineState *machine) entry =KERNEL_LOAD_ADDR ; }if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); +error_report ("qemu: could not load kernel '%s'" , kernel_filename);
I just noticed: The "qemu:" prefix should also be dropped when using error_report() now. I can change that while applying the patch.
Quoted 3 lines
hw/m68k/an5206.c +0
-0exit (1 ); }
[...]
Quoted 31 lines
hw/m68k/mcf5208.c +3
-2@@ -6,6 +6,7 @@* This code is licensed under the GPL */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -257,7 +258,7 @@ static void mcf5208evb_init(MachineState *machine)mcf5208_sys_init (address_space_mem, pic);if (nb_nics >1 ) { -fprintf (stderr,"Too many NICs\n" ); +error_report ("Too many NICs" );exit (1 ); }if (nd_table[0 ].used) {@@ -292,7 +293,7 @@ static void mcf5208evb_init(MachineState *machine)if (qtest_enabled ()) {return ; } -fprintf (stderr,"Kernel image must be specified\n" ); +error_report ("Kernel image must be specified" );exit (1 ); }
hw/m68k/mcf5208.c static void mcf5208evb_init(MachineState *machine) · line 315
Quoted 7 lines
hw/m68k/mcf5208.c +1
-1@@ -309,7 +310,7 @@ static void mcf5208evb_init(MachineState *machine) entry =0x40000000 ; }if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }
dito.
Thomas
Re: [Qemu-arm] [Qemu-devel] [PATCH v2 05/47] hw/arm: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 45 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>---
V2:
- Split hw patch into individual directories
[...]
hw/arm/boot.c static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo, · line 463
Quoted 7 lines
hw/arm/boot.c +1
-2@@ -459,8 +460,7 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,/* This is user error so deserves a friendlier error message * than the failure of setprop_sized_cells would provide */ -fprintf (stderr,"qemu: dtb file not compatible with " -"RAM size > 4GB\n" ); +error_report ("qemu: dtb file not compatible with RAM size > 4GB" );
Please drop the "qemu:" prefix when using error_report() now (here and also in all the other affected strings in this patch).
Thomas
Re: [Qemu-devel] [PATCH v2 10/47] hw/cris: Replace fprintf(stderr, "*\n" with error_report()
In reply to Thomas HuthQuoted 20 lines · Thomas Huth
Quoted 3 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.[...]
Quoted 15 lines
hw/cris/boot.c +1
-0@@ -23,6 +23,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "cpu.h" #include "hw/hw.h" @@ -86,14 +87,14 @@ void cris_load_image(CRISCPU *cpu, struct cris_load_info *li) }
Quoted 6 lines
hw/cris/boot.c void cris_load_image(CRISCPU *cpu, struct cris_load_info *li) · line 91
Quoted 4 lines
hw/cris/boot.c +1
-1if (image_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , li->image_filename);Put it on one line, please.
... and remove the "qemu:" prefix, please.
Thomas
Re: [Qemu-devel] [PATCH v2 17/47] hw/input: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 3 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
[...]
Quoted 13 lines
hw/input/pckbd.c +1
-0@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/isa/isa.h" #include "hw/i386/pc.h"
hw/input/pckbd.c static void kbd_write_command(void *opaque, hwaddr addr, · line 312
Quoted 6 lines
hw/input/pckbd.c +1
-1@@ -307,7 +308,7 @@ static void kbd_write_command(void *opaque, hwaddr addr,/* ignore that */ break ;default : -fprintf (stderr,"qemu: unsupported keyboard cmd=0x%02x\n" , (int )val); +error_report ("qemu: unsupported keyboard cmd=0x%02x" , (int )val);break ;
Please drop the "qemu:" prefix from the string now here, too.
Thomas
Re: [Qemu-devel] [PATCH v2 21/47] hw/lm32: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 103 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>Cc Michael Walle <[email protected]>---
V2:
- Split hw patch into individual directorieshw/lm32/lm32_boards.c | 5 +++-- hw/lm32/milkymist.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)hw/lm32/lm32_boards.c +3
-2@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "cpu.h" #include "hw/sysbus.h" @@ -152,7 +153,7 @@ static void lm32_evr_init(MachineState *machine) }if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }@@ -250,7 +251,7 @@ static void lm32_uclinux_init(MachineState *machine) }if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }hw/lm32/milkymist.c +2
-1@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "cpu.h" #include "hw/sysbus.h" @@ -149,7 +150,7 @@ milkymist_init(MachineState *machine)/* if no kernel is given no valid bios rom is a fatal error */ if (!kernel_filename && !dinfo && !bios_filename && !qtest_enabled ()) { -fprintf (stderr,"qemu: could not load Milkymist One bios '%s'\n" , +error_report ("qemu: could not load Milkymist One bios '%s'" , bios_name);exit (1 ); }
hw/lm32/milkymist.c milkymist_init(MachineState *machine) · line 195
Quoted 8 lines
hw/lm32/milkymist.c +1
-1@@ -188,7 +189,7 @@ milkymist_init(MachineState *machine) }if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , kernel_filename);exit (1 ); }
Please remove the "qemu:" prefixes here, too.
Thomas
Re: [Qemu-devel] [PATCH v2 24/47] hw/mips: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 165 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>Cc Paul Burton <[email protected]>Cc Aurelien Jarno <[email protected]>Cc Yongbok Kim <[email protected]>Cc "Hervé Poussineau" <[email protected]>---
V2:
- Split hw patch into individual directorieshw/mips/boston.c | 4 ++-- hw/mips/mips_fulong2e.c | 4 ++-- hw/mips/mips_jazz.c | 4 ++-- hw/mips/mips_malta.c | 4 ++-- hw/mips/mips_mipssim.c | 4 ++-- hw/mips/mips_r4k.c | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-)hw/mips/boston.c +2
-2@@ -353,7 +353,7 @@ static const void *boston_fdt_filter(void *opaque, const void *fdt_orig, err =fdt_open_into (fdt_orig, fdt, fdt_sz);if (err) { -fprintf (stderr,"unable to open FDT\n" ); +error_report ("unable to open FDT" );return NULL ; }@@ -361,7 +361,7 @@ static const void *boston_fdt_filter(void *opaque, const void *fdt_orig, ? machine->kernel_cmdline :" " ; err =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , cmdline);if (err <0 ) { -fprintf (stderr,"couldn't set /chosen/bootargs\n" ); +error_report ("couldn't set /chosen/bootargs" );return NULL ; }hw/mips/mips_fulong2e.c +2
-2@@ -143,7 +143,7 @@ static int64_t load_kernel (CPUMIPSState *env) initrd_offset, ram_size - initrd_offset); }if (initrd_size == (target_ulong) -1 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , +error_report ("qemu: could not load initial ram disk '%s'" , loaderparams.initrd_filename);exit (1 ); }@@ -342,7 +342,7 @@ static void mips_fulong2e_init(MachineState *machine) isa_bus =vt82c686b_init (pci_bus,PCI_DEVFN (FULONG2E_VIA_SLOT ,0 ));if (!isa_bus) { -fprintf (stderr,"vt82c686b_init error\n" ); +error_report ("vt82c686b_init error" );exit (1 ); }hw/mips/mips_jazz.c +2
-2@@ -271,10 +271,10 @@ static void mips_jazz_init(MachineState *machine,sysbus_connect_irq (sysbus,0 ,qdev_get_gpio_in (rc4030,4 ));break ; }else if (is_help_option (nd->model)) { -fprintf (stderr,"qemu: Supported NICs: dp83932\n" ); +error_report ("qemu: Supported NICs: dp83932" );exit (1 ); }else { -fprintf (stderr,"qemu: Unsupported NIC: %s\n" , nd->model); +error_report ("qemu: Unsupported NIC: %s" , nd->model);exit (1 ); } }hw/mips/mips_malta.c +2
-2@@ -856,8 +856,8 @@ static int64_t load_kernel (void) ram_size - initrd_offset); }if (initrd_size == (target_ulong) -1 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - loaderparams.initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + loaderparams.initrd_filename);exit (1 ); } }hw/mips/mips_mipssim.c +2
-2@@ -101,8 +101,8 @@ static int64_t load_kernel(void) initrd_offset, loaderparams.ram_size - initrd_offset); }if (initrd_size == (target_ulong) -1 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - loaderparams.initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + loaderparams.initrd_filename);exit (1 ); } }hw/mips/mips_r4k.c +2
-2@@ -121,8 +121,8 @@ static int64_t load_kernel(void) ram_size - initrd_offset); }if (initrd_size == (target_ulong) -1 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - loaderparams.initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + loaderparams.initrd_filename);exit (1 ); } }
hw/mips/mips_r4k.c void mips_r4k_init(MachineState *machine) · line 252
Quoted 8 lines
hw/mips/mips_r4k.c +1
-1@@ -246,7 +246,7 @@ void mips_r4k_init(MachineState *machine) blk_by_legacy_dinfo(dinfo), sector_len, mips_rom / sector_len, 4, 0, 0, 0, 0, be)) { -fprintf (stderr,"qemu: Error registering flash memory.\n" ); +error_report ("qemu: Error registering flash memory." ); } }else if (!qtest_enabled ()) {/* not fatal */
Please remove the "qemu:" prefixes from the strings here, too.
Thomas
Re: [Qemu-devel] [PATCH v2 26/47] hw/moxie: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 71 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>Cc Anthony Green <[email protected]>---
V2:
- Split hw patch into individual directorieshw/moxie/moxiesim.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)hw/moxie/moxiesim.c +2
-1@@ -25,6 +25,7 @@* THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -61,7 +62,7 @@ static void load_kernel(MoxieCPU *cpu, LoaderParams *loader_params) 0, 0);if (kernel_size <=0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , loader_params->kernel_filename);exit (1 ); }
hw/moxie/moxiesim.c static void load_kernel(MoxieCPU *cpu, LoaderParams *loader_params) · line 93
Quoted 10 lines
hw/moxie/moxiesim.c +2
-2@@ -85,8 +86,8 @@ static void load_kernel(MoxieCPU *cpu, LoaderParams *loader_params) ram_size); }if (initrd_size == (target_ulong)-1 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - loader_params->initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + loader_params->initrd_filename);exit (1 ); } }
Please remove the "qemu:" prefixes from the strings here, too.
Thomas
Re: [Qemu-devel] [PATCH v2 30/47] hw/openrisc: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 63 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>Cc Jia Liu <[email protected]>Cc Stafford Horne <[email protected]>---
V2:
- Split hw patch into individual directorieshw/openrisc/openrisc_sim.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/openrisc/openrisc_sim.c +1
-0@@ -19,6 +19,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h"
hw/openrisc/openrisc_sim.c static void cpu_openrisc_load_kernel(ram_addr_t ram_size, · line 92
Quoted 6 lines
hw/openrisc/openrisc_sim.c +1
-1@@ -87,7 +88,7 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size, }if (kernel_size <0 ) { -fprintf (stderr,"QEMU: couldn't load the kernel '%s'\n" , +error_report ("QEMU: couldn't load the kernel '%s'" , kernel_filename);
Please remove the "QEMU:" prefix here as well.
Thomas
Re: [Qemu-devel] [PATCH v2 32/47] hw/ppc: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 3 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.
[...]
Quoted 4 lines
hw/ppc/e500.c +0
-0
[...]
Quoted 21 lines
hw/ppc/e500.c +3
-3@@ -967,7 +967,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) cur_base, ram_size - cur_base);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , +error_report ("qemu: could not load kernel '%s'" , machine->kernel_filename);exit (1 ); }@@ -982,8 +982,8 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) ram_size - initrd_base);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - machine->initrd_filename); +error_report ("qemu: could not load initial ram disk '%s'" , + machine->initrd_filename);exit (1 ); }
hw/ppc/e500.c void ppce500_init(MachineState *machine, PPCE500Params *params) · line 1030
Quoted 8 lines
hw/ppc/e500.c +1
-1@@ -1024,7 +1024,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) kernel_size =load_uimage (filename, &bios_entry, &loadaddr,NULL ,NULL ,NULL );if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load firmware '%s'\n" , filename); +error_report ("qemu: could not load firmware '%s'" , filename);exit (1 ); } }
Please remove the "qemu:" prefix from the strings here, too.
Thomas
Re: [Qemu-devel] [PATCH v2 33/47] hw/s390x: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 53 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>---
V2:
- Split hw patch into individual directorieshw/s390x/virtio-ccw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/s390x/virtio-ccw.c +0
-0
hw/s390x/virtio-ccw.c static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) · line 474
Quoted 8 lines
hw/s390x/virtio-ccw.c +1
-1@@ -468,7 +468,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)* passes us zeroes for those we don't support. */ if (features.features) { -fprintf (stderr,"Guest bug: features[%i]=%x (expected 0)\n" , +error_report ("Guest bug: features[%i]=%x (expected 0)" , features.index, features.features);/* XXX: do a unit check here? */ }
Sounds like this should rather be a qemu_log_mask(LOG_GUEST_ERROR, ...) instead?
Thomas
Re: [Qemu-devel] [PATCH v2 36/47] hw/sh4: Replace fprintf(stderr, "*\n" with error_report()
In reply to Alistair FrancisQuoted 75 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} +Some lines where then manually tweaked to pass checkpatch.
Signed-off-by Alistair Francis <[email protected]>Cc Magnus Damm <[email protected]>Cc Aurelien Jarno <[email protected]>---
V2:
- Split hw patch into individual directorieshw/sh4/r2d.c | 9 ++++---- hw/sh4/sh7750.c | 64 +++++++++++++++++++++++++++++---------------------------- 2 files changed, 38 insertions(+), 35 deletions(-)hw/sh4/r2d.c +3
-2@@ -24,6 +24,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -319,8 +320,8 @@ static void r2d_init(MachineState *machine)SDRAM_BASE +LINUX_LOAD_OFFSET , INITRD_LOAD_OFFSET - LINUX_LOAD_OFFSET);if (kernel_size <0 ) { -fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +error_report ("qemu: could not load kernel '%s'" , kernel_filename); +exit (1 ); }/* initialization which should be done by firmware */
hw/sh4/r2d.c static void r2d_init(MachineState *machine) · line 345
Quoted 8 lines
hw/sh4/r2d.c +2
-2@@ -339,8 +340,8 @@ static void r2d_init(MachineState *machine) SDRAM_SIZE - INITRD_LOAD_OFFSET);if (initrd_size <0 ) { -fprintf (stderr,"qemu: could not load initrd '%s'\n" , initrd_filename); -exit (1 ); +error_report ("qemu: could not load initrd '%s'" , initrd_filename); +exit (1 ); }
Please remove the "qemu:" prefix here as well.
Thomas
Re: [Qemu-devel] [PATCH v2 07/47] hw/bt: Replace fprintf(stderr, "*\n" with error_report()
In reply to Thomas HuthQuoted 249 lines · Thomas Huth
Quoted 3 lines · Alistair Francis
Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then compiler issues where manually fixed.[...]
Quoted 15 lines
hw/bt/core.c +1
-0@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "sysemu/bt.h" #include "hw/bt.h" @@ -31,24 +32,24 @@ static void bt_dummy_lmp_mode_change(struct bt_link_s *link)static void bt_dummy_lmp_connection_complete (struct bt_link_s *link) {hw/bt/core.c static void bt_dummy_lmp_mode_change(struct bt_link_s *link) · line 39
Quoted 10 lines
hw/bt/core.c +4
-4if (link->slave->reject_reason) -fprintf (stderr,"%s: stray LMP_not_accepted received, fixme\n" , - __func__); +error_report ("%s: stray LMP_not_accepted received, fixme" , + __func__);else -fprintf (stderr,"%s: stray LMP_accepted received, fixme\n" , - __func__); +error_report ("%s: stray LMP_accepted received, fixme" , + __func__);I think these lines should now also easily fit into one line only.
Quoted 19 lines
hw/bt/core.c +2
-2exit (-1 ); }static void bt_dummy_lmp_disconnect_master (struct bt_link_s *link) { -fprintf (stderr,"%s: stray LMP_detach received, fixme\n" , __func__); +fprintf (stderr,"%s: stray LMP_detach received, fixme" , __func__);exit (-1 ); }static void bt_dummy_lmp_acl_resp (struct bt_link_s *link,const uint8_t *data,int start,int len) { -fprintf (stderr,"%s: stray ACL response PDU, fixme\n" , __func__); +error_report ("%s: stray ACL response PDU, fixme" , __func__);exit (-1 ); }hw/bt/core.c void bt_device_done(struct bt_device_s *dev) · line 118
Quoted 6 lines
hw/bt/core.c +1
-1@@ -113,7 +114,7 @@ void bt_device_done(struct bt_device_s *dev)while (*p && *p != dev) p = &(*p)->next;if (*p != dev) { -fprintf (stderr,"%s: bad bt device \"%s\"\n" , __func__, +error_report ("%s: bad bt device \"%s\"" , __func__, dev->lmp_name ?:"(null)" );Bad indentation of the second line.
Quoted 32 lines
hw/bt/core.c +0
-0exit (-1 ); }hw/bt/hci-csr.c +3
-2@@ -19,6 +19,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "chardev/char-serial.h" #include "qemu/timer.h" @@ -111,14 +112,14 @@ static uint8_t *csrhci_out_packet(struct csrhci_s *s, int len)if (off <FIFO_LEN ) {if (off + len >FIFO_LEN && (s->out_size = off + len) >FIFO_LEN *2 ) { -fprintf (stderr,"%s: can't alloc %i bytes\n" , __func__, len); +error_report ("%s: can't alloc %i bytes" , __func__, len);exit (-1 ); }return s->outfifo + off; }if (s->out_len > s->out_size) { -fprintf (stderr,"%s: can't alloc %i bytes\n" , __func__, len); +error_report ("%s: can't alloc %i bytes" , __func__, len);exit (-1 ); }hw/bt/hci-csr.c static void csrhci_in_packet_vendor(struct csrhci_s *s, int ocf, · line 175
Quoted 9 lines
hw/bt/hci-csr.c +2
-2@@ -168,8 +169,8 @@ static void csrhci_in_packet_vendor(struct csrhci_s *s, int ocf, s->bd_addr.b[5 ] = data[offset +2 ]; s->hci->bdaddr_set (s->hci, s->bd_addr.b); -fprintf (stderr,"%s: bd_address loaded from firmware: " -"%02x:%02x:%02x:%02x:%02x:%02x\n" , __func__, +error_report ("%s: bd_address loaded from firmware: " +"%02x:%02x:%02x:%02x:%02x:%02x" , __func__, s->bd_addr.b[0 ], s->bd_addr.b[1 ], s->bd_addr.b[2 ], s->bd_addr.b[3 ], s->bd_addr.b[4 ], s->bd_addr.b[5 ]);Bad indentation again.
Quoted 50 lines
hw/bt/hci-csr.c +4
-4}@@ -181,7 +182,7 @@ static void csrhci_in_packet_vendor(struct csrhci_s *s, int ocf,break ;default : -fprintf (stderr,"%s: got a bad CMD packet\n" , __func__); +error_report ("%s: got a bad CMD packet" , __func__);return ; }@@ -226,7 +227,7 @@ static void csrhci_in_packet(struct csrhci_s *s, uint8_t *pkt)case H4_NEG_PKT :if (s->in_hdr !=sizeof (csrhci_neg_packet) ||memcmp (pkt -1 , csrhci_neg_packet, s->in_hdr)) { -fprintf (stderr,"%s: got a bad NEG packet\n" , __func__); +error_report ("%s: got a bad NEG packet" , __func__);return ; } pkt +=2 ;@@ -241,7 +242,7 @@ static void csrhci_in_packet(struct csrhci_s *s, uint8_t *pkt)case H4_ALIVE_PKT :if (s->in_hdr !=4 || pkt[1 ] !=0x55 || pkt[2 ] !=0x00 ) { -fprintf (stderr,"%s: got a bad ALIVE packet\n" , __func__); +error_report ("%s: got a bad ALIVE packet" , __func__);return ; }@@ -254,7 +255,7 @@ static void csrhci_in_packet(struct csrhci_s *s, uint8_t *pkt)default : bad_pkt:/* TODO: error out */ -fprintf (stderr,"%s: got a bad packet\n" , __func__); +error_report ("%s: got a bad packet" , __func__);break ; }hw/bt/hci.c +1
-0@@ -19,6 +19,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "qemu/timer.h" hw/bt/hci.c static inline uint8_t *bt_hci_event_start(struct bt_hci_s *hci, · line 462
Quoted 6 lines
hw/bt/hci.c +1
-1@@ -457,7 +458,7 @@ static inline uint8_t *bt_hci_event_start(struct bt_hci_s *hci,int mask_byte;if (len >255 ) { -fprintf (stderr,"%s: HCI event params too long (%ib)\n" , +error_report ("%s: HCI event params too long (%ib)" , __func__, len);Bad indentation again - or even better: Put it into one line only.
hw/bt/hci.c static void bt_hci_inquiry_result(struct bt_hci_s *hci, · line 594
Quoted 9 lines
hw/bt/hci.c +1
-1exit (-1 ); }@@ -589,7 +590,7 @@ static void bt_hci_inquiry_result(struct bt_hci_s *hci,bt_hci_inquiry_result_with_rssi (hci, slave);return ;default : -fprintf (stderr,"%s: bad inquiry mode %02x\n" , __func__, +error_report ("%s: bad inquiry mode %02x" , __func__, hci->lm.inquiry_mode);Bad indentation.
hw/bt/hci.c static void bt_submit_hci(struct HCIInfo *info, · line 1976
Quoted 9 lines
hw/bt/hci.c +1
-1exit (-1 ); }@@ -1971,7 +1972,7 @@ static void bt_submit_hci(struct HCIInfo *info,break ; short_hci: -fprintf (stderr,"%s: HCI packet too short (%iB)\n" , +error_report ("%s: HCI packet too short (%iB)" , __func__, length);One line, please.
hw/bt/hci.c static inline void bt_hci_lmp_acl_data(struct bt_hci_s *hci, uint16_t handle, · line 1996
Quoted 9 lines
hw/bt/hci.c +1
-1bt_hci_event_status (hci,HCI_INVALID_PARAMETERS );break ;@@ -1991,7 +1992,7 @@ static inline void bt_hci_lmp_acl_data(struct bt_hci_s *hci, uint16_t handle,/* TODO: avoid memcpy'ing */ if (len +HCI_ACL_HDR_SIZE >sizeof (hci->acl_buf)) { -fprintf (stderr,"%s: can't take ACL packets %i bytes long\n" , +error_report ("%s: can't take ACL packets %i bytes long" , __func__, len);Fix indentation or put it on one line.
hw/bt/hci.c static void bt_submit_acl(struct HCIInfo *info, · line 2034
Quoted 9 lines
hw/bt/hci.c +1
-1return ; }@@ -2029,7 +2030,7 @@ static void bt_submit_acl(struct HCIInfo *info,struct bt_link_s *link;if (length <HCI_ACL_HDR_SIZE ) { -fprintf (stderr,"%s: ACL packet too short (%iB)\n" , +error_report ("%s: ACL packet too short (%iB)" , __func__, length);One line.
hw/bt/hci.c static void bt_submit_acl(struct HCIInfo *info, · line 2046
Quoted 10 lines
hw/bt/hci.c +2
-2return ; }@@ -2041,15 +2042,15 @@ static void bt_submit_acl(struct HCIInfo *info, length -=HCI_ACL_HDR_SIZE ;if (bt_hci_handle_bad (hci, handle)) { -fprintf (stderr,"%s: invalid ACL handle %03x\n" , - __func__, handle); +error_report ("%s: invalid ACL handle %03x" , + __func__, handle);One line.
hw/bt/hci.c static void bt_submit_acl(struct HCIInfo *info, · line 2054
Quoted 9 lines
hw/bt/hci.c +1
-1/* TODO: signal an error */ return ; } handle &= ~HCI_HANDLE_OFFSET ;if (datalen > length) { -fprintf (stderr,"%s: ACL packet too short (%iB < %iB)\n" , +fprintf (stderr,"%s: ACL packet too short (%iB < %iB)" , __func__, length, datalen);script failure?
hw/bt/hci.c static void bt_submit_acl(struct HCIInfo *info, · line 2065
Quoted 9 lines
hw/bt/hci.c +1
-1return ; }@@ -2060,7 +2061,7 @@ static void bt_submit_acl(struct HCIInfo *info,if (!hci->asb_handle) hci->asb_handle = handle;else if (handle != hci->asb_handle) { -fprintf (stderr,"%s: Bad handle %03x in Active Slave Broadcast\n" , +error_report ("%s: Bad handle %03x in Active Slave Broadcast" , __func__, handle);Indentation.
Quoted 4 lines
etc.
Please have a look at all the hunks in this patch before you submit it again!
Thanks for going through these.
I did try to review the changes, but there are just so many it's really difficult to catch them all.
Thanks,
Alistair
Quoted 2 lines
Thomas