diff mbox series

[16/16] RFC hw/net/smc91c111: Convert init helper into an inline function

Message ID 20190104175847.6290-17-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series hw: Remove "hw/devices.h" | expand

Commit Message

Philippe Mathieu-Daudé Jan. 4, 2019, 5:58 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
As init helper in "hw/char/pl011.h"
---
 hw/net/smc91c111.c         | 17 -----------------
 include/hw/net/smc91c111.h | 25 ++++++++++++++++++++++++-
 2 files changed, 24 insertions(+), 18 deletions(-)

Comments

Thomas Huth Jan. 4, 2019, 7:35 p.m. UTC | #1
On 2019-01-04 18:58, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> As init helper in "hw/char/pl011.h"
> ---
>  hw/net/smc91c111.c         | 17 -----------------
>  include/hw/net/smc91c111.h | 25 ++++++++++++++++++++++++-
>  2 files changed, 24 insertions(+), 18 deletions(-)

Why? If you move code around like this, you should mention the reason in
the patch description.

 Thomas
Philippe Mathieu-Daudé Feb. 4, 2019, 11:11 p.m. UTC | #2
On 1/4/19 8:35 PM, Thomas Huth wrote:
> On 2019-01-04 18:58, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> As init helper in "hw/char/pl011.h"
>> ---
>>  hw/net/smc91c111.c         | 17 -----------------
>>  include/hw/net/smc91c111.h | 25 ++++++++++++++++++++++++-
>>  2 files changed, 24 insertions(+), 18 deletions(-)
> 
> Why? If you move code around like this, you should mention the reason in
> the patch description.

Oops this one wasn't supposed to be sent, I planned to drop it before
sending but probably forgot because it was late friday :/
diff mbox series

Patch

diff --git a/hw/net/smc91c111.c b/hw/net/smc91c111.c
index d19ea0750d..3472852270 100644
--- a/hw/net/smc91c111.c
+++ b/hw/net/smc91c111.c
@@ -18,7 +18,6 @@ 
 /* Number of 2k memory pages available.  */
 #define NUM_PACKETS 4
 
-#define TYPE_SMC91C111 "smc91c111"
 #define SMC91C111(obj) OBJECT_CHECK(smc91c111_state, (obj), TYPE_SMC91C111)
 
 typedef struct {
@@ -809,20 +808,4 @@  static void smc91c111_register_types(void)
     type_register_static(&smc91c111_info);
 }
 
-/* Legacy helper function.  Should go away when machine config files are
-   implemented.  */
-void smc91c111_init(NICInfo *nd, uint32_t base, qemu_irq irq)
-{
-    DeviceState *dev;
-    SysBusDevice *s;
-
-    qemu_check_nic_model(nd, "smc91c111");
-    dev = qdev_create(NULL, TYPE_SMC91C111);
-    qdev_set_nic_properties(dev, nd);
-    qdev_init_nofail(dev);
-    s = SYS_BUS_DEVICE(dev);
-    sysbus_mmio_map(s, 0, base);
-    sysbus_connect_irq(s, 0, irq);
-}
-
 type_init(smc91c111_register_types)
diff --git a/include/hw/net/smc91c111.h b/include/hw/net/smc91c111.h
index 46f7d9a5d4..0a1097ddd2 100644
--- a/include/hw/net/smc91c111.h
+++ b/include/hw/net/smc91c111.h
@@ -10,9 +10,32 @@ 
 #ifndef HW_NET_SMC91C111_H
 #define HW_NET_SMC91C111_H
 
+#include "hw/qdev.h"
 #include "hw/irq.h"
+#include "hw/sysbus.h"
 #include "net/net.h"
 
-void smc91c111_init(NICInfo *, uint32_t, qemu_irq);
+#define TYPE_SMC91C111 "smc91c111"
+
+/*
+ * Legacy helper function.  Should go away when machine config files are
+ * implemented.
+ */
+static inline DeviceState *smc91c111_init(NICInfo *nd,
+                                          uint32_t base, qemu_irq irq)
+{
+    DeviceState *dev;
+    SysBusDevice *s;
+
+    qemu_check_nic_model(nd, "smc91c111");
+    dev = qdev_create(NULL, TYPE_SMC91C111);
+    qdev_set_nic_properties(dev, nd);
+    qdev_init_nofail(dev);
+    s = SYS_BUS_DEVICE(dev);
+    sysbus_mmio_map(s, 0, base);
+    sysbus_connect_irq(s, 0, irq);
+
+    return dev;
+}
 
 #endif