diff mbox

[36/38] ivshmem: Drop ivshmem property x-memdev

Message ID 1456771254-17511-37-git-send-email-armbru@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Markus Armbruster Feb. 29, 2016, 6:40 p.m. UTC
Use ivshmem-plain instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/misc/ivshmem.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

Comments

Marc-André Lureau March 3, 2016, 2:03 p.m. UTC | #1
Hi

On Mon, Feb 29, 2016 at 7:40 PM, Markus Armbruster <armbru@redhat.com> wrote:
> Use ivshmem-plain instead.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  hw/misc/ivshmem.c | 15 +--------------
>  1 file changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
> index 33b6842..f6fce15 100644
> --- a/hw/misc/ivshmem.c
> +++ b/hw/misc/ivshmem.c
> @@ -1197,8 +1197,7 @@ static void ivshmem_realize(PCIDevice *dev, Error **errp)
>      }
>
>      if (!!s->server_chr + !!s->shmobj + !!s->hostmem != 1) {
> -        error_setg(errp,
> -                   "You must specify either 'shm', 'chardev' or 'x-memdev'");
> +        error_setg(errp, "You must specify either 'shm' or 'chardev'");
>          return;
>      }

You could also get rid of hostmem checks here:

-    if (!!s->server_chr + !!s->shmobj + !!s->hostmem != 1) {
+    if (!!s->server_chr + !!s->shmobj > 1) {
         error_setg(errp, "You must specify either 'shm' or 'chardev'");
         return;
     }

-    if (s->hostmem) {
-        if (s->sizearg) {
-            g_warning("size argument ignored with hostmem");
-        }
-    } else if (s->sizearg == NULL) {
+    if (s->sizearg == NULL) {

otherwise, looks good

> @@ -1246,17 +1245,6 @@ static void ivshmem_realize(PCIDevice *dev, Error **errp)
>      ivshmem_common_realize(dev, errp);
>  }
>
> -static void ivshmem_init(Object *obj)
> -{
> -    IVShmemState *s = IVSHMEM(obj);
> -
> -    object_property_add_link(obj, "x-memdev", TYPE_MEMORY_BACKEND,
> -                             (Object **)&s->hostmem,
> -                             ivshmem_check_memdev_is_busy,
> -                             OBJ_PROP_LINK_UNREF_ON_RELEASE,
> -                             &error_abort);
> -}
> -
>  static void ivshmem_class_init(ObjectClass *klass, void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
> @@ -1273,7 +1261,6 @@ static const TypeInfo ivshmem_info = {
>      .name          = TYPE_IVSHMEM,
>      .parent        = TYPE_IVSHMEM_COMMON,
>      .instance_size = sizeof(IVShmemState),
> -    .instance_init = ivshmem_init,
>      .class_init    = ivshmem_class_init,
>  };
>
> --
> 2.4.3
>
>
Markus Armbruster March 3, 2016, 2:17 p.m. UTC | #2
Marc-André Lureau <marcandre.lureau@gmail.com> writes:

> Hi
>
> On Mon, Feb 29, 2016 at 7:40 PM, Markus Armbruster <armbru@redhat.com> wrote:
>> Use ivshmem-plain instead.
>>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>  hw/misc/ivshmem.c | 15 +--------------
>>  1 file changed, 1 insertion(+), 14 deletions(-)
>>
>> diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
>> index 33b6842..f6fce15 100644
>> --- a/hw/misc/ivshmem.c
>> +++ b/hw/misc/ivshmem.c
>> @@ -1197,8 +1197,7 @@ static void ivshmem_realize(PCIDevice *dev, Error **errp)
>>      }
>>
>>      if (!!s->server_chr + !!s->shmobj + !!s->hostmem != 1) {
>> -        error_setg(errp,
>> -                   "You must specify either 'shm', 'chardev' or 'x-memdev'");
>> +        error_setg(errp, "You must specify either 'shm' or 'chardev'");
>>          return;
>>      }
>
> You could also get rid of hostmem checks here:
>
> -    if (!!s->server_chr + !!s->shmobj + !!s->hostmem != 1) {
> +    if (!!s->server_chr + !!s->shmobj > 1) {
>          error_setg(errp, "You must specify either 'shm' or 'chardev'");
>          return;
>      }
>
> -    if (s->hostmem) {
> -        if (s->sizearg) {
> -            g_warning("size argument ignored with hostmem");
> -        }
> -    } else if (s->sizearg == NULL) {
> +    if (s->sizearg == NULL) {

Will do.  No idea how I missed those :)

> otherwise, looks good

Thanks!
diff mbox

Patch

diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 33b6842..f6fce15 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -1197,8 +1197,7 @@  static void ivshmem_realize(PCIDevice *dev, Error **errp)
     }
 
     if (!!s->server_chr + !!s->shmobj + !!s->hostmem != 1) {
-        error_setg(errp,
-                   "You must specify either 'shm', 'chardev' or 'x-memdev'");
+        error_setg(errp, "You must specify either 'shm' or 'chardev'");
         return;
     }
 
@@ -1246,17 +1245,6 @@  static void ivshmem_realize(PCIDevice *dev, Error **errp)
     ivshmem_common_realize(dev, errp);
 }
 
-static void ivshmem_init(Object *obj)
-{
-    IVShmemState *s = IVSHMEM(obj);
-
-    object_property_add_link(obj, "x-memdev", TYPE_MEMORY_BACKEND,
-                             (Object **)&s->hostmem,
-                             ivshmem_check_memdev_is_busy,
-                             OBJ_PROP_LINK_UNREF_ON_RELEASE,
-                             &error_abort);
-}
-
 static void ivshmem_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -1273,7 +1261,6 @@  static const TypeInfo ivshmem_info = {
     .name          = TYPE_IVSHMEM,
     .parent        = TYPE_IVSHMEM_COMMON,
     .instance_size = sizeof(IVShmemState),
-    .instance_init = ivshmem_init,
     .class_init    = ivshmem_class_init,
 };