]> git.proxmox.com Git - mirror_qemu.git/blobdiff - hw/net/ne2000-isa.c
Use DECLARE_*CHECKER* macros
[mirror_qemu.git] / hw / net / ne2000-isa.c
index 8dca7c936bfabe60bfa9346a16a3521ad6c7db43..688a0cc4f653810813d66d6db7e4b4c9fd362564 100644 (file)
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include "qemu/osdep.h"
-#include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "hw/isa/isa.h"
-#include "hw/qdev.h"
-#include "net/net.h"
+#include "hw/net/ne2000-isa.h"
+#include "migration/vmstate.h"
 #include "ne2000.h"
-#include "exec/address-spaces.h"
+#include "sysemu/sysemu.h"
+#include "qapi/error.h"
 #include "qapi/visitor.h"
+#include "qemu/module.h"
+#include "qom/object.h"
 
-#define TYPE_ISA_NE2000 "ne2k_isa"
-#define ISA_NE2000(obj) OBJECT_CHECK(ISANE2000State, (obj), TYPE_ISA_NE2000)
+typedef struct ISANE2000State ISANE2000State;
+DECLARE_INSTANCE_CHECKER(ISANE2000State, ISA_NE2000,
+                         TYPE_ISA_NE2000)
 
-typedef struct ISANE2000State {
+struct ISANE2000State {
     ISADevice parent_obj;
 
     uint32_t iobase;
     uint32_t isairq;
     NE2000State ne2000;
-} ISANE2000State;
+};
 
 static NetClientInfo net_ne2000_isa_info = {
-    .type = NET_CLIENT_OPTIONS_KIND_NIC,
+    .type = NET_CLIENT_DRIVER_NIC,
     .size = sizeof(NICState),
     .receive = ne2000_receive,
 };
@@ -89,7 +92,7 @@ static void isa_ne2000_class_initfn(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = isa_ne2000_realizefn;
-    dc->props = ne2000_isa_properties;
+    device_class_set_props(dc, ne2000_isa_properties);
     dc->vmsd = &vmstate_isa_ne2000;
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
 }
@@ -113,9 +116,8 @@ static void isa_ne2000_set_bootindex(Object *obj, Visitor *v,
     int32_t boot_index;
     Error *local_err = NULL;
 
-    visit_type_int32(v, name, &boot_index, &local_err);
-    if (local_err) {
-        goto out;
+    if (!visit_type_int32(v, name, &boot_index, errp)) {
+        return;
     }
     /* check whether bootindex is present in fw_boot_order list  */
     check_boot_index(boot_index, &local_err);
@@ -126,17 +128,15 @@ static void isa_ne2000_set_bootindex(Object *obj, Visitor *v,
     s->c.bootindex = boot_index;
 
 out:
-    if (local_err) {
-        error_propagate(errp, local_err);
-    }
+    error_propagate(errp, local_err);
 }
 
 static void isa_ne2000_instance_init(Object *obj)
 {
     object_property_add(obj, "bootindex", "int32",
                         isa_ne2000_get_bootindex,
-                        isa_ne2000_set_bootindex, NULL, NULL, NULL);
-    object_property_set_int(obj, -1, "bootindex", NULL);
+                        isa_ne2000_set_bootindex, NULL, NULL);
+    object_property_set_int(obj, "bootindex", -1, NULL);
 }
 static const TypeInfo ne2000_isa_info = {
     .name          = TYPE_ISA_NE2000,