diff mbox

[v4,22/23] hpet: add API to find it

Message ID 1379857006-17451-23-git-send-email-mst@redhat.com
State New
Headers show

Commit Message

Michael S. Tsirkin Sept. 22, 2013, 1:38 p.m. UTC
Add API to find HPET using QOM.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/timer/hpet.h | 2 ++
 hw/timer/hpet.c         | 5 +++++
 2 files changed, 7 insertions(+)

Comments

Paolo Bonzini Sept. 22, 2013, 7:22 p.m. UTC | #1
Il 22/09/2013 15:38, Michael S. Tsirkin ha scritto:
> Add API to find HPET using QOM.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  include/hw/timer/hpet.h | 2 ++
>  hw/timer/hpet.c         | 5 +++++
>  2 files changed, 7 insertions(+)
> 
> 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
> diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
> index fcd22ae..676bd7d 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);

s/"hpet"/TYPE_HPET/

Paolo

> +}
> +
>  static const TypeInfo hpet_device_info = {
>      .name          = TYPE_HPET,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>
Michael S. Tsirkin Sept. 22, 2013, 7:58 p.m. UTC | #2
On Sun, Sep 22, 2013 at 09:22:09PM +0200, Paolo Bonzini wrote:
> Il 22/09/2013 15:38, Michael S. Tsirkin ha scritto:
> > Add API to find HPET using QOM.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  include/hw/timer/hpet.h | 2 ++
> >  hw/timer/hpet.c         | 5 +++++
> >  2 files changed, 7 insertions(+)
> > 
> > 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
> > diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
> > index fcd22ae..676bd7d 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);
> 
> s/"hpet"/TYPE_HPET/
> 
> Paolo

Right. I'll fix it in my tree, won't repost just for this.
Thanks!

> > +}
> > +
> >  static const TypeInfo hpet_device_info = {
> >      .name          = TYPE_HPET,
> >      .parent        = TYPE_SYS_BUS_DEVICE,
> >
diff mbox

Patch

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
diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
index fcd22ae..676bd7d 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,