diff mbox series

[v2] ssi-sd: Make devices picking up backends unavailable with -device

Message ID 20181009060835.4608-1-armbru@redhat.com
State New
Headers show
Series [v2] ssi-sd: Make devices picking up backends unavailable with -device | expand

Commit Message

Markus Armbruster Oct. 9, 2018, 6:08 a.m. UTC
Device models aren't supposed to go on fishing expeditions for
backends.  They should expose suitable properties for the user to set.
For onboard devices, board code sets them.

Device ssi-sd picks up its block backend in its init() method with
drive_get_next() instead.  This mistake is already marked FIXME since
commit af9e40a.

Unset user_creatable to remove the mistake from our external
interface.  Since the SSI bus doesn't support hotplug, only -device
can be affected.  Only certain ARM machines have ssi-sd and provide an
SSI bus for it; this patch breaks -device ssi-sd for these machines.
No actual use of -device ssi-sd is known.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
v2:
* Rebase to master
* Improve commit message

 hw/sd/ssi-sd.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Thomas Huth Oct. 9, 2018, 6:10 a.m. UTC | #1
On 2018-10-09 08:08, Markus Armbruster wrote:
> Device models aren't supposed to go on fishing expeditions for
> backends.  They should expose suitable properties for the user to set.
> For onboard devices, board code sets them.
> 
> Device ssi-sd picks up its block backend in its init() method with
> drive_get_next() instead.  This mistake is already marked FIXME since
> commit af9e40a.
> 
> Unset user_creatable to remove the mistake from our external
> interface.  Since the SSI bus doesn't support hotplug, only -device
> can be affected.  Only certain ARM machines have ssi-sd and provide an
> SSI bus for it; this patch breaks -device ssi-sd for these machines.
> No actual use of -device ssi-sd is known.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> v2:
> * Rebase to master
> * Improve commit message
> 
>  hw/sd/ssi-sd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c
> index 95a143bfba..623d0333e8 100644
> --- a/hw/sd/ssi-sd.c
> +++ b/hw/sd/ssi-sd.c
> @@ -284,6 +284,8 @@ static void ssi_sd_class_init(ObjectClass *klass, void *data)
>      k->cs_polarity = SSI_CS_LOW;
>      dc->vmsd = &vmstate_ssi_sd;
>      dc->reset = ssi_sd_reset;
> +    /* Reason: init() method uses drive_get_next() */
> +    dc->user_creatable = false;
>  }
>  
>  static const TypeInfo ssi_sd_info = {
> 

Acked-by: Thomas Huth <thuth@redhat.com>
Markus Armbruster Oct. 18, 2018, 7:50 a.m. UTC | #2
Peter, would you be willing to take this through your ARM tree?

Markus Armbruster <armbru@redhat.com> writes:

> Device models aren't supposed to go on fishing expeditions for
> backends.  They should expose suitable properties for the user to set.
> For onboard devices, board code sets them.
>
> Device ssi-sd picks up its block backend in its init() method with
> drive_get_next() instead.  This mistake is already marked FIXME since
> commit af9e40a.
>
> Unset user_creatable to remove the mistake from our external
> interface.  Since the SSI bus doesn't support hotplug, only -device
> can be affected.  Only certain ARM machines have ssi-sd and provide an
> SSI bus for it; this patch breaks -device ssi-sd for these machines.
> No actual use of -device ssi-sd is known.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> v2:
> * Rebase to master
> * Improve commit message
>
>  hw/sd/ssi-sd.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c
> index 95a143bfba..623d0333e8 100644
> --- a/hw/sd/ssi-sd.c
> +++ b/hw/sd/ssi-sd.c
> @@ -284,6 +284,8 @@ static void ssi_sd_class_init(ObjectClass *klass, void *data)
>      k->cs_polarity = SSI_CS_LOW;
>      dc->vmsd = &vmstate_ssi_sd;
>      dc->reset = ssi_sd_reset;
> +    /* Reason: init() method uses drive_get_next() */
> +    dc->user_creatable = false;
>  }
>  
>  static const TypeInfo ssi_sd_info = {
Peter Maydell Oct. 18, 2018, 4:26 p.m. UTC | #3
On 18 October 2018 at 08:50, Markus Armbruster <armbru@redhat.com> wrote:
> Peter, would you be willing to take this through your ARM tree?

Sure; applied to target-arm.next.

thanks
-- PMM
diff mbox series

Patch

diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c
index 95a143bfba..623d0333e8 100644
--- a/hw/sd/ssi-sd.c
+++ b/hw/sd/ssi-sd.c
@@ -284,6 +284,8 @@  static void ssi_sd_class_init(ObjectClass *klass, void *data)
     k->cs_polarity = SSI_CS_LOW;
     dc->vmsd = &vmstate_ssi_sd;
     dc->reset = ssi_sd_reset;
+    /* Reason: init() method uses drive_get_next() */
+    dc->user_creatable = false;
 }
 
 static const TypeInfo ssi_sd_info = {