On Sun, Nov 01, 2026 at 12:40:02AM +0800, Yonggang Luo wrote:
> scsi-hd and scsi-cd added the s390x loadparm property from class_init
> when target_s390x() was true. Register a second type for each name
> that always adds loadparm, and select the two with target_s390x() and
> target_not_s390x().
> 
> Signed-off-by: Yonggang Luo <[email protected]>
> ---
>  hw/scsi/scsi-disk.c | 48 +++++++++++++++++++++++++++++++++++----------
>  1 file changed, 38 insertions(+), 10 deletions(-)
> 
> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
> index 6341089ddf2..bb5377fb7fa 100644
> --- a/hw/scsi/scsi-disk.c
> +++ b/hw/scsi/scsi-disk.c
> @@ -3221,14 +3221,11 @@ static void scsi_property_add_specifics(DeviceClass 
> *dc)
>  {
>      ObjectClass *oc = OBJECT_CLASS(dc);
>  
> -    /* The loadparm property is only supported on s390x */
> -    if (target_s390x()) {
> -        object_class_property_add_str(oc, "loadparm",
> -                                      scsi_property_get_loadparm,
> -                                      scsi_property_set_loadparm);
> -        object_class_property_set_description(oc, "loadparm",
> -                                              "load parameter (s390x only)");
> -    }
> +    object_class_property_add_str(oc, "loadparm",
> +                                  scsi_property_get_loadparm,
> +                                  scsi_property_set_loadparm);
> +    object_class_property_set_description(oc, "loadparm",
> +                                          "load parameter (s390x only)");
>  }

IMHO this is the only change  that should be made. It is harmless to
have the property unconditionally registered for the class. Creating
extra duplicate named classes is expanding a problem that we should
be trying to eliminate, such that we have unique named classes.

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|


Reply via email to