[PATCH 12/33] qemu: Drop qemuDomainFindSCSIControllerModel()

Andrea Bolognani posted 33 patches 8 months, 2 weeks ago
There is a newer version of this series
[PATCH 12/33] qemu: Drop qemuDomainFindSCSIControllerModel()
Posted by Andrea Bolognani 8 months, 2 weeks ago
It only has a single caller.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/qemu/qemu_alias.c          | 13 +++++++++++--
 src/qemu/qemu_domain_address.c | 26 --------------------------
 src/qemu/qemu_domain_address.h |  3 ---
 3 files changed, 11 insertions(+), 31 deletions(-)

diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index 686b5a4d80..d2c28c182b 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -214,8 +214,17 @@ qemuAssignDeviceDiskAlias(virDomainDef *def,
     if (!disk->info.alias) {
         if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
             if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
-                controllerModel = qemuDomainFindSCSIControllerModel(def,
-                                                                    &disk->info);
+                virDomainControllerDef *cont;
+
+                if (!(cont = virDomainDeviceFindSCSIController(def, &disk->info.addr.drive))) {
+                    virReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("unable to find a SCSI controller for idx=%1$d"),
+                            disk->info.addr.drive.controller);
+                    return -1;
+                }
+
+                controllerModel = cont->model;
+
                 if (controllerModel < 0)
                     return -1;
             }
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 413f152230..22af903b6a 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -99,32 +99,6 @@ qemuDomainSetSCSIControllerModel(const virDomainDef *def,
 }
 
 
-/**
- * @def: Domain definition
- * @info: Domain device info
- *
- * Using the device info, find the controller related to the
- * device by index and use that controller to return the model.
- *
- * Returns the model if found, -1 if not with an error message set
- */
-int
-qemuDomainFindSCSIControllerModel(const virDomainDef *def,
-                                  virDomainDeviceInfo *info)
-{
-    virDomainControllerDef *cont;
-
-    if (!(cont = virDomainDeviceFindSCSIController(def, &info->addr.drive))) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("unable to find a SCSI controller for idx=%1$d"),
-                       info->addr.drive.controller);
-        return -1;
-    }
-
-    return cont->model;
-}
-
-
 static int
 qemuDomainAssignVirtioSerialAddresses(virDomainDef *def)
 {
diff --git a/src/qemu/qemu_domain_address.h b/src/qemu/qemu_domain_address.h
index dbb5de915e..a571312469 100644
--- a/src/qemu/qemu_domain_address.h
+++ b/src/qemu/qemu_domain_address.h
@@ -32,9 +32,6 @@ int qemuDomainSetSCSIControllerModel(const virDomainDef *def,
                                      virDomainControllerDef *cont,
                                      virQEMUCaps *qemuCaps);
 
-int qemuDomainFindSCSIControllerModel(const virDomainDef *def,
-                                      virDomainDeviceInfo *info);
-
 int qemuDomainAssignAddresses(virDomainDef *def,
                               virQEMUCaps *qemuCaps,
                               virQEMUDriver *driver,
-- 
2.43.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [PATCH 12/33] qemu: Drop qemuDomainFindSCSIControllerModel()
Posted by Peter Krempa 8 months, 2 weeks ago
On Wed, Jan 24, 2024 at 20:37:32 +0100, Andrea Bolognani wrote:
> It only has a single caller.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  src/qemu/qemu_alias.c          | 13 +++++++++++--
>  src/qemu/qemu_domain_address.c | 26 --------------------------
>  src/qemu/qemu_domain_address.h |  3 ---
>  3 files changed, 11 insertions(+), 31 deletions(-)
> 
> diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
> index 686b5a4d80..d2c28c182b 100644
> --- a/src/qemu/qemu_alias.c
> +++ b/src/qemu/qemu_alias.c
> @@ -214,8 +214,17 @@ qemuAssignDeviceDiskAlias(virDomainDef *def,
>      if (!disk->info.alias) {
>          if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
>              if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
> -                controllerModel = qemuDomainFindSCSIControllerModel(def,
> -                                                                    &disk->info);
> +                virDomainControllerDef *cont;
> +
> +                if (!(cont = virDomainDeviceFindSCSIController(def, &disk->info.addr.drive))) {
> +                    virReportError(VIR_ERR_INTERNAL_ERROR,
> +                            _("unable to find a SCSI controller for idx=%1$d"),
> +                            disk->info.addr.drive.controller);

Broken alignment.

With that fixed:

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org