diff mbox series

[09/21] hw/usb: Inline usb_try_new()

Message ID 20240216110313.17039-10-philmd@linaro.org
State New
Headers show
Series hw: More QDev cleanups | expand

Commit Message

Philippe Mathieu-Daudé Feb. 16, 2024, 11:03 a.m. UTC
Inline the single use of usb_try_new().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/usb/bus.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Zhao Liu Feb. 22, 2024, 9:53 a.m. UTC | #1
On Fri, Feb 16, 2024 at 12:03:00PM +0100, Philippe Mathieu-Daudé wrote:
> Date: Fri, 16 Feb 2024 12:03:00 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH 09/21] hw/usb: Inline usb_try_new()
> X-Mailer: git-send-email 2.41.0
> 
> Inline the single use of usb_try_new().
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/usb/bus.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>

> 
> diff --git a/hw/usb/bus.c b/hw/usb/bus.c
> index 59c39945dd..148224f06a 100644
> --- a/hw/usb/bus.c
> +++ b/hw/usb/bus.c
> @@ -334,11 +334,6 @@ USBDevice *usb_new(const char *name)
>      return USB_DEVICE(qdev_new(name));
>  }
>  
> -static USBDevice *usb_try_new(const char *name)
> -{
> -    return USB_DEVICE(qdev_try_new(name));
> -}
> -
>  bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp)
>  {
>      return qdev_realize_and_unref(&dev->qdev, &bus->qbus, errp);
> @@ -447,7 +442,7 @@ void usb_claim_port(USBDevice *dev, Error **errp)
>      } else {
>          if (bus->nfree == 1 && strcmp(object_get_typename(OBJECT(dev)), "usb-hub") != 0) {
>              /* Create a new hub and chain it on */
> -            hub = usb_try_new("usb-hub");
> +            hub = USB_DEVICE(qdev_try_new("usb-hub"));
>              if (hub) {
>                  usb_realize_and_unref(hub, bus, NULL);
>              }
> -- 
> 2.41.0
> 
>
diff mbox series

Patch

diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index 59c39945dd..148224f06a 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -334,11 +334,6 @@  USBDevice *usb_new(const char *name)
     return USB_DEVICE(qdev_new(name));
 }
 
-static USBDevice *usb_try_new(const char *name)
-{
-    return USB_DEVICE(qdev_try_new(name));
-}
-
 bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp)
 {
     return qdev_realize_and_unref(&dev->qdev, &bus->qbus, errp);
@@ -447,7 +442,7 @@  void usb_claim_port(USBDevice *dev, Error **errp)
     } else {
         if (bus->nfree == 1 && strcmp(object_get_typename(OBJECT(dev)), "usb-hub") != 0) {
             /* Create a new hub and chain it on */
-            hub = usb_try_new("usb-hub");
+            hub = USB_DEVICE(qdev_try_new("usb-hub"));
             if (hub) {
                 usb_realize_and_unref(hub, bus, NULL);
             }