qemu-trivial.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH for-2.11] aux-to-i2c-bridge: don't allow user to create one
@ 2017-08-25 11:46 KONRAD Frederic
  2017-08-25 11:48 ` Thomas Huth
  2017-09-14  7:58 ` Michael Tokarev
  0 siblings, 2 replies; 3+ messages in thread
From: KONRAD Frederic @ 2017-08-25 11:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, thuth, frederic.konrad

This device is private and is created once per aux-bus.
So don't allow the user to create one from command-line.

Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
---
 hw/misc/auxbus.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/hw/misc/auxbus.c b/hw/misc/auxbus.c
index 8a90ddd..1182745 100644
--- a/hw/misc/auxbus.c
+++ b/hw/misc/auxbus.c
@@ -210,6 +210,16 @@ struct AUXTOI2CState {
     I2CBus *i2c_bus;
 };
 
+static void aux_bridge_class_init(ObjectClass *oc, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(oc);
+
+    /* This device is private and is created only once for each
+     * aux-bus in aux_init_bus(..). So don't allow the user to add one.
+     */
+    dc->user_creatable = false;
+}
+
 static void aux_bridge_init(Object *obj)
 {
     AUXTOI2CState *s = AUXTOI2C(obj);
@@ -225,6 +235,7 @@ static inline I2CBus *aux_bridge_get_i2c_bus(AUXTOI2CState *bridge)
 static const TypeInfo aux_to_i2c_type_info = {
     .name = TYPE_AUXTOI2C,
     .parent = TYPE_DEVICE,
+    .class_init = aux_bridge_class_init,
     .instance_size = sizeof(AUXTOI2CState),
     .instance_init = aux_bridge_init
 };
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-trivial] [PATCH for-2.11] aux-to-i2c-bridge: don't allow user to create one
  2017-08-25 11:46 [Qemu-trivial] [PATCH for-2.11] aux-to-i2c-bridge: don't allow user to create one KONRAD Frederic
@ 2017-08-25 11:48 ` Thomas Huth
  2017-09-14  7:58 ` Michael Tokarev
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2017-08-25 11:48 UTC (permalink / raw)
  To: KONRAD Frederic, qemu-devel; +Cc: qemu-trivial

On 25.08.2017 13:46, KONRAD Frederic wrote:
> This device is private and is created once per aux-bus.
> So don't allow the user to create one from command-line.
> 
> Reported-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
> ---
>  hw/misc/auxbus.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/hw/misc/auxbus.c b/hw/misc/auxbus.c
> index 8a90ddd..1182745 100644
> --- a/hw/misc/auxbus.c
> +++ b/hw/misc/auxbus.c
> @@ -210,6 +210,16 @@ struct AUXTOI2CState {
>      I2CBus *i2c_bus;
>  };
>  
> +static void aux_bridge_class_init(ObjectClass *oc, void *data)
> +{
> +    DeviceClass *dc = DEVICE_CLASS(oc);
> +
> +    /* This device is private and is created only once for each
> +     * aux-bus in aux_init_bus(..). So don't allow the user to add one.
> +     */
> +    dc->user_creatable = false;
> +}
> +
>  static void aux_bridge_init(Object *obj)
>  {
>      AUXTOI2CState *s = AUXTOI2C(obj);
> @@ -225,6 +235,7 @@ static inline I2CBus *aux_bridge_get_i2c_bus(AUXTOI2CState *bridge)
>  static const TypeInfo aux_to_i2c_type_info = {
>      .name = TYPE_AUXTOI2C,
>      .parent = TYPE_DEVICE,
> +    .class_init = aux_bridge_class_init,
>      .instance_size = sizeof(AUXTOI2CState),
>      .instance_init = aux_bridge_init
>  };
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-trivial] [PATCH for-2.11] aux-to-i2c-bridge: don't allow user to create one
  2017-08-25 11:46 [Qemu-trivial] [PATCH for-2.11] aux-to-i2c-bridge: don't allow user to create one KONRAD Frederic
  2017-08-25 11:48 ` Thomas Huth
@ 2017-09-14  7:58 ` Michael Tokarev
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Tokarev @ 2017-09-14  7:58 UTC (permalink / raw)
  To: KONRAD Frederic, qemu-devel; +Cc: qemu-trivial, thuth

25.08.2017 14:46, KONRAD Frederic wrote:
> This device is private and is created once per aux-bus.
> So don't allow the user to create one from command-line.

Applied to -trivial, thanks!

/mjt


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-14  7:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-25 11:46 [Qemu-trivial] [PATCH for-2.11] aux-to-i2c-bridge: don't allow user to create one KONRAD Frederic
2017-08-25 11:48 ` Thomas Huth
2017-09-14  7:58 ` Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).