* [Qemu-devel] [PATCH 02/10] parallel: make optional
@ 2011-02-12 22:40 Blue Swirl
2011-02-13 17:30 ` David Ahern
0 siblings, 1 reply; 3+ messages in thread
From: Blue Swirl @ 2011-02-12 22:40 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 658 bytes --]
Ignore failure with parallel device creation.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
hw/pc.h | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/hw/pc.h b/hw/pc.h
index 443ba34..f823b7d 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -24,7 +24,10 @@ static inline bool parallel_init(int index,
CharDriverState *chr)
{
ISADevice *dev;
- dev = isa_create("isa-parallel");
+ dev = isa_try_create("isa-parallel");
+ if (!dev) {
+ return false;
+ }
qdev_prop_set_uint32(&dev->qdev, "index", index);
qdev_prop_set_chr(&dev->qdev, "chardev", chr);
if (qdev_init(&dev->qdev) < 0) {
--
1.6.2.4
[-- Attachment #2: 0002-parallel-make-optional.patch --]
[-- Type: application/mbox, Size: 1130 bytes --]
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH 02/10] parallel: make optional
2011-02-12 22:40 [Qemu-devel] [PATCH 02/10] parallel: make optional Blue Swirl
@ 2011-02-13 17:30 ` David Ahern
2011-02-13 18:39 ` Blue Swirl
0 siblings, 1 reply; 3+ messages in thread
From: David Ahern @ 2011-02-13 17:30 UTC (permalink / raw)
To: Blue Swirl; +Cc: qemu-devel
On 02/12/11 15:40, Blue Swirl wrote:
> Ignore failure with parallel device creation.
>
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
> ---
> hw/pc.h | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/hw/pc.h b/hw/pc.h
> index 443ba34..f823b7d 100644
> --- a/hw/pc.h
> +++ b/hw/pc.h
> @@ -24,7 +24,10 @@ static inline bool parallel_init(int index,
> CharDriverState *chr)
> {
> ISADevice *dev;
>
> - dev = isa_create("isa-parallel");
> + dev = isa_try_create("isa-parallel");
> + if (!dev) {
> + return false;
> + }
> qdev_prop_set_uint32(&dev->qdev, "index", index);
> qdev_prop_set_chr(&dev->qdev, "chardev", chr);
> if (qdev_init(&dev->qdev) < 0) {
How is this design supposed to be better than wrapping init functions in
#ifdef CONFIG_XXXX ... #endif?
If a hardware model is compiled out via the CONFIG options qemu should
fail to accept the command line parameters and not try to create the
device. Instead with this design it tries and fails to create the device
and yet continues on.
David
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH 02/10] parallel: make optional
2011-02-13 17:30 ` David Ahern
@ 2011-02-13 18:39 ` Blue Swirl
0 siblings, 0 replies; 3+ messages in thread
From: Blue Swirl @ 2011-02-13 18:39 UTC (permalink / raw)
To: David Ahern; +Cc: qemu-devel
On Sun, Feb 13, 2011 at 7:30 PM, David Ahern <dsahern@gmail.com> wrote:
>
>
> On 02/12/11 15:40, Blue Swirl wrote:
>> Ignore failure with parallel device creation.
>>
>> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
>> ---
>> hw/pc.h | 5 ++++-
>> 1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/hw/pc.h b/hw/pc.h
>> index 443ba34..f823b7d 100644
>> --- a/hw/pc.h
>> +++ b/hw/pc.h
>> @@ -24,7 +24,10 @@ static inline bool parallel_init(int index,
>> CharDriverState *chr)
>> {
>> ISADevice *dev;
>>
>> - dev = isa_create("isa-parallel");
>> + dev = isa_try_create("isa-parallel");
>> + if (!dev) {
>> + return false;
>> + }
>> qdev_prop_set_uint32(&dev->qdev, "index", index);
>> qdev_prop_set_chr(&dev->qdev, "chardev", chr);
>> if (qdev_init(&dev->qdev) < 0) {
>
>
> How is this design supposed to be better than wrapping init functions in
> #ifdef CONFIG_XXXX ... #endif?
We avoid the #ifdeffery and the device model is not violated. Most of
the code is not affected in any way by leaving the device out.
> If a hardware model is compiled out via the CONFIG options qemu should
> fail to accept the command line parameters and not try to create the
> device. Instead with this design it tries and fails to create the device
> and yet continues on.
Maybe command line parameter handling should be pushed to the devices.
The devices should pull their parameters, removing them thus from a
parameter pool. After the machine init finishes, errors could be
reported for unhandled parameters.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-02-13 18:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-12 22:40 [Qemu-devel] [PATCH 02/10] parallel: make optional Blue Swirl
2011-02-13 17:30 ` David Ahern
2011-02-13 18:39 ` Blue Swirl
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).