qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 07/11] sdbus: add a SD_BUS_SLAVE interface


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH 07/11] sdbus: add a SD_BUS_SLAVE interface
Date: Wed, 20 Dec 2017 14:31:36 -0300

On Wed, Dec 13, 2017 at 5:44 PM, Philippe Mathieu-Daudé <address@hidden> wrote:
> Devices implementing this interface can be (hot-)plugged to a SD bus.
>
> The sdcard device is currently the unique implementation.
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
>  hw/sd/sd-internal.h | 5 +++--
>  hw/sd/core.c        | 7 +++++++
>  hw/sd/sd.c          | 4 ++++
>  3 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/hw/sd/sd-internal.h b/hw/sd/sd-internal.h
> index 85a747ea64..4576d2f8a8 100644
> --- a/hw/sd/sd-internal.h
> +++ b/hw/sd/sd-internal.h
> @@ -66,10 +66,11 @@ typedef enum {
>
>  typedef struct SDState SDState;
>
> +#define TYPE_SD_BUS_SLAVE_INTERFACE     "sd-bus-slave"
>  #define SDBUS_SLAVE_CLASS(klass) \
> -    OBJECT_CLASS_CHECK(SDSlaveClass, (klass), TYPE_SD_CARD)
> +    OBJECT_CLASS_CHECK(SDSlaveClass, (klass), TYPE_SD_BUS_SLAVE_INTERFACE)
>  #define SDBUS_SLAVE_GET_CLASS(obj) \
> -    OBJECT_GET_CLASS(SDSlaveClass, (obj), TYPE_SD_CARD)
> +    OBJECT_GET_CLASS(SDSlaveClass, (obj), TYPE_SD_BUS_SLAVE_INTERFACE)
>
>  typedef struct {
>      /*< private >*/
> diff --git a/hw/sd/core.c b/hw/sd/core.c
> index cd5b531cfa..dc1571befc 100644
> --- a/hw/sd/core.c
> +++ b/hw/sd/core.c
> @@ -181,9 +181,16 @@ static const TypeInfo sd_bus_info = {
>      .class_size = sizeof(SDBusClass),
>  };
>
> +static const TypeInfo sd_slave_info = {
> +    .name = TYPE_SD_BUS_SLAVE_INTERFACE,
> +    .parent = TYPE_INTERFACE,
> +    .class_size = sizeof(SDBusClass),

I used the wrong class! the fixed patch will have:

        .class_size = sizeof(SDSlaveClass),

> +};
> +
>  static void sd_bus_register_types(void)
>  {
>      type_register_static(&sd_bus_info);
> +    type_register_static(&sd_slave_info);
>  }
>
>  type_init(sd_bus_register_types)
> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> index 97046df5c3..8e12b07ee4 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -1942,6 +1942,10 @@ static const TypeInfo sd_info = {
>      .class_init = sd_class_init,
>      .instance_init = sd_instance_init,
>      .instance_finalize = sd_instance_finalize,
> +    .interfaces = (InterfaceInfo[]) {
> +        { TYPE_SD_BUS_SLAVE_INTERFACE },
> +        { },
> +    },
>  };
>
>  static void sd_register_types(void)
> --
> 2.15.1
>



reply via email to

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