* [Qemu-devel] [PATCH v2] pci-assign: Fix error_report of pci-stub message
@ 2013-10-11 15:52 Cole Robinson
2013-10-14 6:47 ` Markus Armbruster
2013-11-05 23:47 ` Cole Robinson
0 siblings, 2 replies; 4+ messages in thread
From: Cole Robinson @ 2013-10-11 15:52 UTC (permalink / raw)
To: qemu-devel; +Cc: alex.williamson, Cole Robinson, armbru, mst
Using multiple calls to error_report here means every line is
prefaced with the (potentially long) pci-assign command line
arguments.
Use a single error_printf to preserve the intended formatting.
Since this code path is always preceded by an error_report call,
we don't lose the command line reporting.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
v2: Switch to error_printf
hw/i386/kvm/pci-assign.c | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index 5618173..f013a1c 100644
--- a/hw/i386/kvm/pci-assign.c
+++ b/hw/i386/kvm/pci-assign.c
@@ -791,26 +791,22 @@ static void assign_failed_examine(AssignedDevice *dev)
goto fail;
}
- error_report("*** The driver '%s' is occupying your device "
- "%04x:%02x:%02x.%x.",
- ns, dev->host.domain, dev->host.bus, dev->host.slot,
- dev->host.function);
- error_report("***");
- error_report("*** You can try the following commands to free it:");
- error_report("***");
- error_report("*** $ echo \"%04x %04x\" > /sys/bus/pci/drivers/pci-stub/"
- "new_id", vendor_id, device_id);
- error_report("*** $ echo \"%04x:%02x:%02x.%x\" > /sys/bus/pci/drivers/"
- "%s/unbind",
- dev->host.domain, dev->host.bus, dev->host.slot,
- dev->host.function, ns);
- error_report("*** $ echo \"%04x:%02x:%02x.%x\" > /sys/bus/pci/drivers/"
- "pci-stub/bind",
- dev->host.domain, dev->host.bus, dev->host.slot,
- dev->host.function);
- error_report("*** $ echo \"%04x %04x\" > /sys/bus/pci/drivers/pci-stub"
- "/remove_id", vendor_id, device_id);
- error_report("***");
+ error_printf("*** The driver '%s' is occupying your device "
+ "%04x:%02x:%02x.%x.\n"
+ "***\n"
+ "*** You can try the following commands to free it:\n"
+ "***\n"
+ "*** $ echo \"%04x %04x\" > /sys/bus/pci/drivers/pci-stub/new_id\n"
+ "*** $ echo \"%04x:%02x:%02x.%x\" > /sys/bus/pci/drivers/%s/unbind\n"
+ "*** $ echo \"%04x:%02x:%02x.%x\" > /sys/bus/pci/drivers/"
+ "pci-stub/bind\n"
+ "*** $ echo \"%04x %04x\" > /sys/bus/pci/drivers/pci-stub/remove_id\n"
+ "***",
+ ns, dev->host.domain, dev->host.bus, dev->host.slot,
+ dev->host.function, vendor_id, device_id,
+ dev->host.domain, dev->host.bus, dev->host.slot, dev->host.function,
+ ns, dev->host.domain, dev->host.bus, dev->host.slot,
+ dev->host.function, vendor_id, device_id);
return;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] pci-assign: Fix error_report of pci-stub message
2013-10-11 15:52 [Qemu-devel] [PATCH v2] pci-assign: Fix error_report of pci-stub message Cole Robinson
@ 2013-10-14 6:47 ` Markus Armbruster
2013-11-05 23:47 ` Cole Robinson
1 sibling, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2013-10-14 6:47 UTC (permalink / raw)
To: Cole Robinson; +Cc: alex.williamson, qemu-devel, mst
Cole Robinson <crobinso@redhat.com> writes:
> Using multiple calls to error_report here means every line is
> prefaced with the (potentially long) pci-assign command line
> arguments.
>
> Use a single error_printf to preserve the intended formatting.
> Since this code path is always preceded by an error_report call,
> we don't lose the command line reporting.
>
> Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] pci-assign: Fix error_report of pci-stub message
2013-10-11 15:52 [Qemu-devel] [PATCH v2] pci-assign: Fix error_report of pci-stub message Cole Robinson
2013-10-14 6:47 ` Markus Armbruster
@ 2013-11-05 23:47 ` Cole Robinson
2013-11-06 8:44 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
1 sibling, 1 reply; 4+ messages in thread
From: Cole Robinson @ 2013-11-05 23:47 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, alex.williamson, armbru, mst
cc-ing qemu-trivial since this hasn't been picked up yet AFAICT.
- Cole
On 10/11/2013 11:52 AM, Cole Robinson wrote:
> Using multiple calls to error_report here means every line is
> prefaced with the (potentially long) pci-assign command line
> arguments.
>
> Use a single error_printf to preserve the intended formatting.
> Since this code path is always preceded by an error_report call,
> we don't lose the command line reporting.
>
> Signed-off-by: Cole Robinson <crobinso@redhat.com>
> ---
>
> v2: Switch to error_printf
>
> hw/i386/kvm/pci-assign.c | 36 ++++++++++++++++--------------------
> 1 file changed, 16 insertions(+), 20 deletions(-)
>
> diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
> index 5618173..f013a1c 100644
> --- a/hw/i386/kvm/pci-assign.c
> +++ b/hw/i386/kvm/pci-assign.c
> @@ -791,26 +791,22 @@ static void assign_failed_examine(AssignedDevice *dev)
> goto fail;
> }
>
> - error_report("*** The driver '%s' is occupying your device "
> - "%04x:%02x:%02x.%x.",
> - ns, dev->host.domain, dev->host.bus, dev->host.slot,
> - dev->host.function);
> - error_report("***");
> - error_report("*** You can try the following commands to free it:");
> - error_report("***");
> - error_report("*** $ echo \"%04x %04x\" > /sys/bus/pci/drivers/pci-stub/"
> - "new_id", vendor_id, device_id);
> - error_report("*** $ echo \"%04x:%02x:%02x.%x\" > /sys/bus/pci/drivers/"
> - "%s/unbind",
> - dev->host.domain, dev->host.bus, dev->host.slot,
> - dev->host.function, ns);
> - error_report("*** $ echo \"%04x:%02x:%02x.%x\" > /sys/bus/pci/drivers/"
> - "pci-stub/bind",
> - dev->host.domain, dev->host.bus, dev->host.slot,
> - dev->host.function);
> - error_report("*** $ echo \"%04x %04x\" > /sys/bus/pci/drivers/pci-stub"
> - "/remove_id", vendor_id, device_id);
> - error_report("***");
> + error_printf("*** The driver '%s' is occupying your device "
> + "%04x:%02x:%02x.%x.\n"
> + "***\n"
> + "*** You can try the following commands to free it:\n"
> + "***\n"
> + "*** $ echo \"%04x %04x\" > /sys/bus/pci/drivers/pci-stub/new_id\n"
> + "*** $ echo \"%04x:%02x:%02x.%x\" > /sys/bus/pci/drivers/%s/unbind\n"
> + "*** $ echo \"%04x:%02x:%02x.%x\" > /sys/bus/pci/drivers/"
> + "pci-stub/bind\n"
> + "*** $ echo \"%04x %04x\" > /sys/bus/pci/drivers/pci-stub/remove_id\n"
> + "***",
> + ns, dev->host.domain, dev->host.bus, dev->host.slot,
> + dev->host.function, vendor_id, device_id,
> + dev->host.domain, dev->host.bus, dev->host.slot, dev->host.function,
> + ns, dev->host.domain, dev->host.bus, dev->host.slot,
> + dev->host.function, vendor_id, device_id);
>
> return;
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [Qemu-trivial] [PATCH v2] pci-assign: Fix error_report of pci-stub message
2013-11-05 23:47 ` Cole Robinson
@ 2013-11-06 8:44 ` Michael Tokarev
0 siblings, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2013-11-06 8:44 UTC (permalink / raw)
To: Cole Robinson; +Cc: qemu-trivial, alex.williamson, mst, qemu-devel, armbru
> On 10/11/2013 11:52 AM, Cole Robinson wrote:
>> Using multiple calls to error_report here means every line is
>> prefaced with the (potentially long) pci-assign command line
>> arguments.
>>
>> Use a single error_printf to preserve the intended formatting.
>> Since this code path is always preceded by an error_report call,
>> we don't lose the command line reporting.
Thanks, applied to the trivial-patches queue.
/mjt
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-11-06 8:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-11 15:52 [Qemu-devel] [PATCH v2] pci-assign: Fix error_report of pci-stub message Cole Robinson
2013-10-14 6:47 ` Markus Armbruster
2013-11-05 23:47 ` Cole Robinson
2013-11-06 8:44 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).