qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 13/14] hpet: add API to find it


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH v3 13/14] hpet: add API to find it
Date: Sun, 28 Jul 2013 01:38:28 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7

Am 24.07.2013 18:02, schrieb Michael S. Tsirkin:
> Add API to find HPET using QOM.
> 
> Signed-off-by: Michael S. Tsirkin <address@hidden>
> ---
>  hw/timer/hpet.c         | 5 +++++
>  include/hw/timer/hpet.h | 2 ++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
> index 648b383..11bf401 100644
> --- a/hw/timer/hpet.c
> +++ b/hw/timer/hpet.c
> @@ -757,6 +757,11 @@ static void hpet_device_class_init(ObjectClass *klass, 
> void *data)
>      dc->props = hpet_device_properties;
>  }
>  
> +bool hpet_find(void)
> +{
> +    return object_resolve_path_type("", "hpet", NULL);
> +}
> +
>  static const TypeInfo hpet_device_info = {
>      .name          = TYPE_HPET,
>      .parent        = TYPE_SYS_BUS_DEVICE,

"hpet" is being open-coded just above the new TYPE_HPET.

http://git.qemu.org/?p=qemu.git;a=commit;h=02f9a6f5da74251e1e5685ae57643d45c3fb6c30

But since you're doing it and the code is really trivial, you could also
inline it into ACPI code to spare us this single-use function.

> diff --git a/include/hw/timer/hpet.h b/include/hw/timer/hpet.h
> index 757f79f..ab44bd3 100644
> --- a/include/hw/timer/hpet.h
> +++ b/include/hw/timer/hpet.h
> @@ -71,4 +71,6 @@ struct hpet_fw_config
>  } QEMU_PACKED;
>  
>  extern struct hpet_fw_config hpet_cfg;
> +
> +bool hpet_find(void);
>  #endif

We could just as well move TYPE_HPET here to allow reuse from ACPI code.
Not having done above conversion patch myself, I did not notice there
was a header candidate.

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]