[PATCH 32/55] auxbus: Eliminate aux_create_slave()

Markus Armbruster posted 55 patches 5 years, 5 months ago
There is a newer version of this series
[PATCH 32/55] auxbus: Eliminate aux_create_slave()
Posted by Markus Armbruster 5 years, 5 months ago
aux_create_slave() has become a trivial wrapper around qdev_new().
There's just one user.  Eliminate.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 include/hw/misc/auxbus.h | 7 -------
 hw/display/xlnx_dp.c     | 2 +-
 hw/misc/auxbus.c         | 9 ---------
 3 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/include/hw/misc/auxbus.h b/include/hw/misc/auxbus.h
index 6ab6cf5bb6..60b6311eb7 100644
--- a/include/hw/misc/auxbus.h
+++ b/include/hw/misc/auxbus.h
@@ -131,13 +131,6 @@ I2CBus *aux_get_i2c_bus(AUXBus *bus);
  */
 void aux_init_mmio(AUXSlave *aux_slave, MemoryRegion *mmio);
 
-/* aux_create_slave: Create a new device on an AUX bus
- *
- * @bus The AUX bus for the new device.
- * @name The type of the device to be created.
- */
-DeviceState *aux_create_slave(AUXBus *bus, const char *name);
-
 /* aux_map_slave: Map the mmio for an AUX slave on the bus.
  *
  * @dev The AUX slave.
diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c
index 75de65ec96..77636db893 100644
--- a/hw/display/xlnx_dp.c
+++ b/hw/display/xlnx_dp.c
@@ -1247,7 +1247,7 @@ static void xlnx_dp_init(Object *obj)
     /*
      * Initialize DPCD and EDID..
      */
-    s->dpcd = DPCD(aux_create_slave(s->aux_bus, "dpcd"));
+    s->dpcd = DPCD(qdev_new("dpcd"));
     object_property_add_child(OBJECT(s), "dpcd", OBJECT(s->dpcd));
 
     s->edid = I2CDDC(qdev_new("i2c-ddc"));
diff --git a/hw/misc/auxbus.c b/hw/misc/auxbus.c
index 682c35ece8..1e9316ff73 100644
--- a/hw/misc/auxbus.c
+++ b/hw/misc/auxbus.c
@@ -273,15 +273,6 @@ static void aux_slave_dev_print(Monitor *mon, DeviceState *dev, int indent)
                    memory_region_size(s->mmio));
 }
 
-DeviceState *aux_create_slave(AUXBus *bus, const char *type)
-{
-    DeviceState *dev;
-
-    dev = qdev_new(type);
-    assert(dev);
-    return dev;
-}
-
 void aux_init_mmio(AUXSlave *aux_slave, MemoryRegion *mmio)
 {
     assert(!aux_slave->mmio);
-- 
2.21.1


Re: [PATCH 32/55] auxbus: Eliminate aux_create_slave()
Posted by Philippe Mathieu-Daudé 5 years, 5 months ago
On 5/19/20 4:55 PM, Markus Armbruster wrote:
> aux_create_slave() has become a trivial wrapper around qdev_new().
> There's just one user.  Eliminate.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>   include/hw/misc/auxbus.h | 7 -------
>   hw/display/xlnx_dp.c     | 2 +-
>   hw/misc/auxbus.c         | 9 ---------
>   3 files changed, 1 insertion(+), 17 deletions(-)
> 
> diff --git a/include/hw/misc/auxbus.h b/include/hw/misc/auxbus.h
> index 6ab6cf5bb6..60b6311eb7 100644
> --- a/include/hw/misc/auxbus.h
> +++ b/include/hw/misc/auxbus.h
> @@ -131,13 +131,6 @@ I2CBus *aux_get_i2c_bus(AUXBus *bus);
>    */
>   void aux_init_mmio(AUXSlave *aux_slave, MemoryRegion *mmio);
>   
> -/* aux_create_slave: Create a new device on an AUX bus
> - *
> - * @bus The AUX bus for the new device.
> - * @name The type of the device to be created.
> - */
> -DeviceState *aux_create_slave(AUXBus *bus, const char *name);
> -
>   /* aux_map_slave: Map the mmio for an AUX slave on the bus.
>    *
>    * @dev The AUX slave.
> diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c
> index 75de65ec96..77636db893 100644
> --- a/hw/display/xlnx_dp.c
> +++ b/hw/display/xlnx_dp.c
> @@ -1247,7 +1247,7 @@ static void xlnx_dp_init(Object *obj)
>       /*
>        * Initialize DPCD and EDID..
>        */
> -    s->dpcd = DPCD(aux_create_slave(s->aux_bus, "dpcd"));
> +    s->dpcd = DPCD(qdev_new("dpcd"));
>       object_property_add_child(OBJECT(s), "dpcd", OBJECT(s->dpcd));
>   
>       s->edid = I2CDDC(qdev_new("i2c-ddc"));
> diff --git a/hw/misc/auxbus.c b/hw/misc/auxbus.c
> index 682c35ece8..1e9316ff73 100644
> --- a/hw/misc/auxbus.c
> +++ b/hw/misc/auxbus.c
> @@ -273,15 +273,6 @@ static void aux_slave_dev_print(Monitor *mon, DeviceState *dev, int indent)
>                      memory_region_size(s->mmio));
>   }
>   
> -DeviceState *aux_create_slave(AUXBus *bus, const char *type)
> -{
> -    DeviceState *dev;
> -
> -    dev = qdev_new(type);
> -    assert(dev);
> -    return dev;
> -}
> -
>   void aux_init_mmio(AUXSlave *aux_slave, MemoryRegion *mmio)
>   {
>       assert(!aux_slave->mmio);
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>