Skip to contentSkip to conversation

hw/s390x: Mark the "sclpquiesce" device with user_creatable = false

PATCH Applied Thomas Huth 4 participants 4 messages Oct 5, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/s390x: Mark the "sclpquiesce" device with user_creatable = false

The "sclpquiesce" device is just an internal device that should not be created by the user directly. Though it currently does not seem to cause any obvious trouble when the user instantiates an additional device, let's better mark it with user_creatable = false to avoid unexpected behavior, e.g. because the quiesce notifier gets registered multiple times.

---
 hw/s390x/sclpquiesce.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
hw/s390x/sclpquiesce.c +6 -1
index 762cb18..0241643 100644
@@ -118,8 +118,13 @@ static void quiesce_class_init(ObjectClass *klass, void *data)
     dc->reset = quiesce_reset;
     dc->vmsd = &vmstate_sclpquiesce;
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
-    k->init = quiesce_init;
+    /*
+     * Reason: This is just an internal device - the notifier should
+     * not be registered multiple times in quiesce_init()
+     */
+    dc->user_creatable = false;
 
+    k->init = quiesce_init;
     k->get_send_mask = send_mask;
     k->get_receive_mask = receive_mask;
     k->can_handle_event = can_handle_event;
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Thomas Huth

The "sclpquiesce" device is just an internal device that should not be created by the user directly. Though it currently does not seem to cause any obvious trouble when the user instantiates an additional device, let's better mark it with user_creatable = false to avoid unexpected behavior, e.g. because the quiesce notifier gets registered multiple times.

Quoted 24 lines
---
 hw/s390x/sclpquiesce.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
hw/s390x/sclpquiesce.c +6 -1
index 762cb18..0241643 100644
@@ -118,8 +118,13 @@ static void quiesce_class_init(ObjectClass *klass, void *data)
     dc->reset = quiesce_reset;
     dc->vmsd = &vmstate_sclpquiesce;
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
-    k->init = quiesce_init;
+    /*
+     * Reason: This is just an internal device - the notifier should
+     * not be registered multiple times in quiesce_init()
+     */
+    dc->user_creatable = false;
 
+    k->init = quiesce_init;
     k->get_send_mask = send_mask;
     k->get_receive_mask = receive_mask;
     k->can_handle_event = can_handle_event;
Reviewed-by on v1 1/1
#2 lore raw
In reply to Thomas Huth
Quoted 8 lines · On Thu, 5 Oct 2017 10:45:05 +0200 Thomas Huth <[email protected]> wrote:

The "sclpquiesce" device is just an internal device that should not be created by the user directly. Though it currently does not seem to cause any obvious trouble when the user instantiates an additional device, let's better mark it with user_creatable = false to avoid unexpected behavior, e.g. because the quiesce notifier gets registered multiple times.

Quoted 23 lines
---
 hw/s390x/sclpquiesce.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
hw/s390x/sclpquiesce.c +6 -1
index 762cb18..0241643 100644
@@ -118,8 +118,13 @@ static void quiesce_class_init(ObjectClass
 *klass, void *data) dc->reset = quiesce_reset;
     dc->vmsd = &vmstate_sclpquiesce;
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
-    k->init = quiesce_init;
+    /*
+     * Reason: This is just an internal device - the notifier should
+     * not be registered multiple times in quiesce_init()
+     */
+    dc->user_creatable = false;
 
+    k->init = quiesce_init;
     k->get_send_mask = send_mask;
     k->get_receive_mask = receive_mask;
     k->can_handle_event = can_handle_event;
#3 lore raw
In reply to Thomas Huth
Quoted 10 lines · On Thu, 5 Oct 2017 10:45:05 +0200 Thomas Huth <[email protected]> wrote:

The "sclpquiesce" device is just an internal device that should not be created by the user directly. Though it currently does not seem to cause any obvious trouble when the user instantiates an additional device, let's better mark it with user_creatable = false to avoid unexpected behavior, e.g. because the quiesce notifier gets registered multiple times.

---
 hw/s390x/sclpquiesce.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Thanks, applied.