Message ID | 1382058681-14957-7-git-send-email-xiawenc@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
Il 18/10/2013 03:11, Wenchao Xia ha scritto: > monitor_vprintf() is called in the code path, and it will not print > when monitor is in qmp mode, so checking monitor mode in > error_printf_unless_qmp() is useless, remove it to simplify the code. > > Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> > --- > hw/usb/bus.c | 2 +- > hw/usb/hcd-ehci.c | 4 ++-- > include/qemu/error-report.h | 1 - > util/qemu-error.c | 11 ----------- > 4 files changed, 3 insertions(+), 15 deletions(-) > > diff --git a/hw/usb/bus.c b/hw/usb/bus.c > index 72d5b92..817a69a 100644 > --- a/hw/usb/bus.c > +++ b/hw/usb/bus.c > @@ -328,7 +328,7 @@ int usb_register_companion(const char *masterbus, USBPort *ports[], > qerror_report(QERR_INVALID_PARAMETER_VALUE, "masterbus", > "an USB masterbus"); > if (bus) { > - error_printf_unless_qmp( > + error_report( > "USB bus '%s' does not allow companion controllers\n", > masterbus); > } > diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c > index 22bdbf4..bb7e003 100644 > --- a/hw/usb/hcd-ehci.c > +++ b/hw/usb/hcd-ehci.c > @@ -848,7 +848,7 @@ static int ehci_register_companion(USBBus *bus, USBPort *ports[], > if (firstport + portcount > NB_PORTS) { > qerror_report(QERR_INVALID_PARAMETER_VALUE, "firstport", > "firstport on masterbus"); > - error_printf_unless_qmp( > + error_report( > "firstport value of %u makes companion take ports %u - %u, which " > "is outside of the valid range of 0 - %u\n", firstport, firstport, > firstport + portcount - 1, NB_PORTS - 1); > @@ -859,7 +859,7 @@ static int ehci_register_companion(USBBus *bus, USBPort *ports[], > if (s->companion_ports[firstport + i]) { > qerror_report(QERR_INVALID_PARAMETER_VALUE, "masterbus", > "an USB masterbus"); > - error_printf_unless_qmp( > + error_report( > "port %u on masterbus %s already has a companion assigned\n", > firstport + i, bus->qbus.name); > return -1; > diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h > index 3b098a9..5297e65 100644 > --- a/include/qemu/error-report.h > +++ b/include/qemu/error-report.h > @@ -36,7 +36,6 @@ void loc_set_file(const char *fname, int lno); > > void error_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); > void error_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2); > -void error_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2); > void error_print_loc(void); > void error_set_progname(const char *argv0); > void error_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2); > diff --git a/util/qemu-error.c b/util/qemu-error.c > index fec02c6..85e8a79 100644 > --- a/util/qemu-error.c > +++ b/util/qemu-error.c > @@ -40,17 +40,6 @@ void error_printf(const char *fmt, ...) > va_end(ap); > } > > -void error_printf_unless_qmp(const char *fmt, ...) > -{ > - va_list ap; > - > - if (!monitor_cur_is_qmp()) { > - va_start(ap, fmt); > - error_vprintf(fmt, ap); > - va_end(ap); > - } > -} > - > static Location std_loc = { > .kind = LOC_NONE > }; >
Wenchao Xia <xiawenc@linux.vnet.ibm.com> writes: > monitor_vprintf() is called in the code path, and it will not print > when monitor is in qmp mode, so checking monitor mode in > error_printf_unless_qmp() is useless, remove it to simplify the code. Suggest to reword: error_printf_unless_qmp() is no longer useful, because plain error_printf() doesn't print anything in a QMP monitor since commit b8b0826. > Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> > --- > hw/usb/bus.c | 2 +- > hw/usb/hcd-ehci.c | 4 ++-- > include/qemu/error-report.h | 1 - > util/qemu-error.c | 11 ----------- > 4 files changed, 3 insertions(+), 15 deletions(-) > > diff --git a/hw/usb/bus.c b/hw/usb/bus.c > index 72d5b92..817a69a 100644 > --- a/hw/usb/bus.c > +++ b/hw/usb/bus.c > @@ -328,7 +328,7 @@ int usb_register_companion(const char *masterbus, USBPort *ports[], > qerror_report(QERR_INVALID_PARAMETER_VALUE, "masterbus", > "an USB masterbus"); > if (bus) { > - error_printf_unless_qmp( > + error_report( > "USB bus '%s' does not allow companion controllers\n", > masterbus); > } Doesn't this change add location information? I think you want error_printf(), not error_report(). Same for the other uses. [...]
diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 72d5b92..817a69a 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -328,7 +328,7 @@ int usb_register_companion(const char *masterbus, USBPort *ports[], qerror_report(QERR_INVALID_PARAMETER_VALUE, "masterbus", "an USB masterbus"); if (bus) { - error_printf_unless_qmp( + error_report( "USB bus '%s' does not allow companion controllers\n", masterbus); } diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 22bdbf4..bb7e003 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -848,7 +848,7 @@ static int ehci_register_companion(USBBus *bus, USBPort *ports[], if (firstport + portcount > NB_PORTS) { qerror_report(QERR_INVALID_PARAMETER_VALUE, "firstport", "firstport on masterbus"); - error_printf_unless_qmp( + error_report( "firstport value of %u makes companion take ports %u - %u, which " "is outside of the valid range of 0 - %u\n", firstport, firstport, firstport + portcount - 1, NB_PORTS - 1); @@ -859,7 +859,7 @@ static int ehci_register_companion(USBBus *bus, USBPort *ports[], if (s->companion_ports[firstport + i]) { qerror_report(QERR_INVALID_PARAMETER_VALUE, "masterbus", "an USB masterbus"); - error_printf_unless_qmp( + error_report( "port %u on masterbus %s already has a companion assigned\n", firstport + i, bus->qbus.name); return -1; diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h index 3b098a9..5297e65 100644 --- a/include/qemu/error-report.h +++ b/include/qemu/error-report.h @@ -36,7 +36,6 @@ void loc_set_file(const char *fname, int lno); void error_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); void error_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2); -void error_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2); void error_print_loc(void); void error_set_progname(const char *argv0); void error_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2); diff --git a/util/qemu-error.c b/util/qemu-error.c index fec02c6..85e8a79 100644 --- a/util/qemu-error.c +++ b/util/qemu-error.c @@ -40,17 +40,6 @@ void error_printf(const char *fmt, ...) va_end(ap); } -void error_printf_unless_qmp(const char *fmt, ...) -{ - va_list ap; - - if (!monitor_cur_is_qmp()) { - va_start(ap, fmt); - error_vprintf(fmt, ap); - va_end(ap); - } -} - static Location std_loc = { .kind = LOC_NONE };
monitor_vprintf() is called in the code path, and it will not print when monitor is in qmp mode, so checking monitor mode in error_printf_unless_qmp() is useless, remove it to simplify the code. Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> --- hw/usb/bus.c | 2 +- hw/usb/hcd-ehci.c | 4 ++-- include/qemu/error-report.h | 1 - util/qemu-error.c | 11 ----------- 4 files changed, 3 insertions(+), 15 deletions(-)